open_api_spex v3.2.0 OpenApiSpex.Reference View Source
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
Link to this type
t()
View Source
t()
View Source
t() :: %OpenApiSpex.Reference{"$ref": String.t()}
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
Link to this function
resolve_schema(reference, schemas)
View Source
resolve_schema(reference, schemas)
View Source
resolve_schema(OpenApiSpex.Reference.t(), %{optional(String.t()) => Schema.t()}) ::
Schema.t() | nil
resolve_schema(OpenApiSpex.Reference.t(), %{optional(String.t()) => Schema.t()}) :: 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"}