pub struct Parameter {
pub name: String,
pub _in: ParameterIn,
pub description: Option<String>,
pub required: Option<bool>,
pub deprecated: Option<bool>,
pub allow_empty_value: Option<bool>,
pub style: Option<ParameterStyle>,
pub explode: Option<bool>,
pub allow_reserved: Option<bool>,
pub definition: Option<ParameterDefinition>,
pub example: Option<Examples>,
pub extensions: IndexMap<String, Value>,
}
Expand description
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 isitemId
. - query - Parameters that are appended to the URL. For example, in
/items?id=###
, the query parameter isid
. - 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.
Fields§
§name: String
The name of the parameter. Parameter names are case sensitive.
- If
in
is"path"
, thename
field MUST correspond to a template expression occurring within the path field in the Paths Object. See Path Templating for further information. - If
in
is"header"
and thename
field is"Accept"
,"Content-Type"
or"Authorization"
, the parameter definition SHALL be ignored. - For all other cases, the
name
corresponds to the parameter name used by thein
property.
_in: ParameterIn
The location of the parameter. Possible values are "query"
, "header"
, "path"
or "cookie"
.
description: Option<String>
A brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
required: Option<bool>
Determines whether this parameter is mandatory. If the parameter location is "path"
, this property is REQUIRED and its value MUST be true
. Otherwise, the property MAY be included and its default value is false
.
deprecated: Option<bool>
Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. Default value is false
.
allow_empty_value: Option<bool>
Sets the ability to pass empty-valued parameters. This is valid only for query
parameters and allows sending a parameter with an empty value. Default value is false
. If style
is used, and if behavior is n/a
(cannot be serialized), the value of allowEmptyValue
SHALL be ignored. Use of this property is NOT RECOMMENDED, as it is likely to be removed in a later revision.
style: Option<ParameterStyle>
Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of in
): for query
- form
; for path
- simple
; for header
- simple
; for cookie
- form
.
explode: Option<bool>
When this is true, parameter values of type array
or object
generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When style
is form
, the default value is true
. For all other styles, the default value is false
.
allow_reserved: Option<bool>
Determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986 :/?#[]@!$&'()*+,;=
to be included without percent-encoding. This property only applies to parameters with an in
value of query
. The default value is false
.
definition: Option<ParameterDefinition>
§example: Option<Examples>
§extensions: IndexMap<String, Value>
This object MAY be extended with Specification Extensions.