View Source OpenApiSpex.Parameter (open_api_spex v3.21.2)
Defines the OpenApiSpex.Parameter.t type.
Summary
Types
Valid values for the in key in the OpenApiSpex.Parameter struct.
Valid values for the style key in the OpenApiSpex.Parameter struct.
Functions
Gets the media type for a parameter, if not present nil is returned.
Sets the schema for a parameter from a simple type, reference or Schema
Gets the schema for a parameter, from the schema key or content key, which ever is populated.
Types
@type location() :: :path | :query | :header | :cookie
Valid values for the in key in the OpenApiSpex.Parameter struct.
@type parameters() :: %{required(String.t()) => t() | OpenApiSpex.Reference.t()} | nil
@type style() ::
:matrix
| :label
| :form
| :simple
| :spaceDelimited
| :pipeDelimited
| :deepObject
Valid values for the style key in the OpenApiSpex.Parameter struct.
@type t() :: %OpenApiSpex.Parameter{ allowEmptyValue: boolean() | nil, allowReserved: boolean() | nil, content: %{required(String.t()) => OpenApiSpex.MediaType.t()} | nil, deprecated: boolean() | nil, description: String.t() | nil, example: any(), examples: %{ required(String.t()) => OpenApiSpex.Example.t() | OpenApiSpex.Reference.t() } | nil, explode: boolean() | nil, extensions: %{required(String.t()) => any()} | nil, in: location(), name: atom(), required: boolean() | nil, schema: OpenApiSpex.Schema.t() | OpenApiSpex.Reference.t() | atom() | nil, style: style() | nil }
Describes a single operation parameter.
A unique parameter is defined by a combination of a name and location.
Parameter Locations
There are four possible parameter locations specified by the in field:
- path: Used together with Path Templating, where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in
/items/{itemId}, the path parameter is itemId. - query: Parameters that are appended to the URL. For example, in
/items?id=###, the query parameter is id. - header: Custom headers that are expected as part of the request. Note that RFC7230 states header names are case insensitive.
- cookie: Used to pass a specific cookie value to the API.
@type type() :: :boolean | :integer | :number | :string | :array | :object
Functions
Gets the media type for a parameter, if not present nil is returned.
@spec put_schema(t(), OpenApiSpex.Reference.t() | OpenApiSpex.Schema.t() | type()) :: t()
Sets the schema for a parameter from a simple type, reference or Schema
@spec schema(t()) :: OpenApiSpex.Schema.t() | OpenApiSpex.Reference.t() | atom()
Gets the schema for a parameter, from the schema key or content key, which ever is populated.