View Source OpenApiSpex.Reference (open_api_spex v3.19.0)
Defines the OpenApiSpex.Reference.t
type.
Link to this section Summary
Functions
Resolve a Reference
to the Schema
it refers to.
Link to this section Types
@type t() :: %OpenApiSpex.Reference{"$ref": String.t()}
A simple object to allow referencing other components in the specification, internally and externally. The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules.
Link to this section Functions
@spec resolve_parameter(t(), %{required(String.t()) => OpenApiSpex.Parameter.t()}) :: OpenApiSpex.Parameter.t() | nil
@spec resolve_request_body(t(), %{required(String.t()) => OpenApiSpex.RequestBody.t()}) :: OpenApiSpex.RequestBody.t() | nil
@spec resolve_response(t(), %{required(String.t()) => OpenApiSpex.Response.t()}) :: OpenApiSpex.Response.t() | nil
@spec resolve_schema(t(), OpenApiSpex.Components.schemas_map()) :: OpenApiSpex.Schema.t() | nil
Resolve a Reference
to the Schema
it refers to.
examples
Examples
iex> alias OpenApiSpex.{Reference, Schema}
...> schemas = %{"user" => %Schema{title: "user", type: :object}}
...> Reference.resolve_schema(%Reference{"$ref": "#/components/schemas/user"}, schemas)
%OpenApiSpex.Schema{type: :object, title: "user"}