View Source OpenApiSpex.Response (open_api_spex v3.21.1)

Defines the OpenApiSpex.Response.t type.

Summary

Functions

Resolve a Reference to the Response it refers to.

Types

@type t() :: %OpenApiSpex.Response{
  content: %{required(String.t()) => OpenApiSpex.MediaType.t()} | nil,
  description: String.t(),
  extensions: %{required(String.t()) => any()} | nil,
  headers:
    %{
      required(String.t()) => OpenApiSpex.Header.t() | OpenApiSpex.Reference.t()
    }
    | nil,
  links:
    %{required(String.t()) => OpenApiSpex.Link.t() | OpenApiSpex.Reference.t()}
    | nil
}

Response Object

Describes a single response from an API Operation, including design-time, static links to operations based on the response.

Functions

Link to this function

resolve_response(response, responses)

View Source
@spec resolve_response(
  OpenApiSpex.Reference.t(),
  OpenApiSpex.Components.responses_map()
) :: t() | nil

Resolve a Reference to the Response it refers to.

Examples

iex> alias OpenApiSpex.{Response, Reference}
...> responses = %{"aresponse" => %Response{description: "Some response"}}
...> Response.resolve_response(%Reference{"$ref": "#/components/responses/aresponse"}, responses)
%OpenApiSpex.Response{description: "Some response"}