OpenApiSpex.Reference (open_api_spex v3.10.0) 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
Specs
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
Specs
Specs
resolve_request_body(t(), %{required(String.t()) => OpenApiSpex.RequestBody.t()}) :: OpenApiSpex.RequestBody.t() | nil
Specs
resolve_schema(t(), OpenApiSpex.Components.schema_map()) :: 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"}