View Source OpenApiSpex.Response (open_api_spex v3.18.0)

Defines the OpenApiSpex.Response.t type.

Link to this section Summary

Functions

Resolve a Reference to the Response it refers to.

Link to this section 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.

Link to this section 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

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"}