open_api_spex v3.2.0 OpenApiSpex.Parameter View Source
Defines the OpenApiSpex.Parameter.t
type.
Link to this section 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
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
Link to this section Types
location()
View Source
location() :: :path | :query | :header | :cookie
location() :: :path | :query | :header | :cookie
Valid values for the in
key in the OpenApiSpex.Parameter
struct.
style()
View Source
style() ::
:matrix
| :label
| :form
| :simple
| :spaceDelimited
| :pipeDelimited
| :deepObject
style() :: :matrix | :label | :form | :simple | :spaceDelimited | :pipeDelimited | :deepObject
Valid values for the style
key in the OpenApiSpex.Parameter
struct.
t()
View Source
t() :: %OpenApiSpex.Parameter{
allowEmptyValue: boolean() | nil,
allowReserved: boolean() | nil,
content: %{optional(String.t()) => OpenApiSpex.MediaType.t()} | nil,
deprecated: boolean() | nil,
description: String.t() | nil,
example: any(),
examples:
%{
optional(String.t()) =>
OpenApiSpex.Example.t() | OpenApiSpex.Reference.t()
}
| nil,
explode: boolean() | nil,
in: location(),
name: atom(),
required: boolean() | nil,
schema: OpenApiSpex.Schema.t() | OpenApiSpex.Reference.t() | atom() | nil,
style: style() | nil
}
t() :: %OpenApiSpex.Parameter{ allowEmptyValue: boolean() | nil, allowReserved: boolean() | nil, content: %{optional(String.t()) => OpenApiSpex.MediaType.t()} | nil, deprecated: boolean() | nil, description: String.t() | nil, example: any(), examples: %{ optional(String.t()) => OpenApiSpex.Example.t() | OpenApiSpex.Reference.t() } | nil, explode: boolean() | 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.
Link to this section Functions
put_schema(parameter, type)
View Source
put_schema(t(), OpenApiSpex.Reference.t() | OpenApiSpex.Schema.t() | atom()) ::
t()
put_schema(t(), OpenApiSpex.Reference.t() | OpenApiSpex.Schema.t() | atom()) :: t()
Sets the schema for a parameter from a simple type, reference or Schema
schema(parameter)
View Source
schema(OpenApiSpex.Parameter.t()) ::
OpenApiSpex.Schema.t() | OpenApiSpex.Reference.t() | atom()
schema(OpenApiSpex.Parameter.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.