View Source OpenApiSpex.Reference (open_api_spex v3.21.1)
Defines the OpenApiSpex.Reference.t
type.
Summary
Functions
Resolve a Reference
to the Schema
it refers to.
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.
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
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"}