OasParameter
OasParameter represents an OpenAPI parameter.
Properties
Property | Type | Description |
---|---|---|
oasType | 'parameter' | Static value representing the OpenAPI parameter type. |
name | string | Parameter name |
location | 'path' | 'query' | 'header' | 'cookie' | The location of the parameter. We replaced OpenAPI's in with because in is a reserved word in JavaScript. |
description | string | undefined | Optional description |
required | boolean | undefined | Optional flag marking the parameter as required. |
style | "simple" | "label" | "matrix" | "spaceDelimited" | "pipeDelimited" | "deepObject" | Optional style of the parameter. |
explode | boolean | undefined | Optional flag to explode the array if style is deepObject . |
schema | OasSchema | OasRef<'schema'> | undefined | Optional OasSchema or reference to it. |
examples | Record<string, OasExample | OasRef<'example'>> | undefined | Optional map of examples for the parameter. |
content | Record<string, OasMediaType | undefined | Optional map of parameter representations by the media type. |
deprecated | boolean | undefined | Optional flag marking the parameter as deprecated. |
allowEmptyValue | boolean | undefined | Optional flag allowing use of empty parameter values. |
allowReserved | boolean | undefined | Optional flag allowing reserved characters. This property only applies to parameters with a location of query . The default value is false . |
extensionFields | Record<string, unknown> | undefined | Optional map of custom fields defined by OpenAPI extensions. Keys are strings beginning with x- and values are of any valid JSON type. |
Methods
toSchema
Returns the schema
property if it exists or the content
property for the given media type.
parameter.toSchema( mediaType = 'application/json' )
Parameters
Parameter | Type | Description |
---|---|---|
mediaType | string | The media type to get the schema for. Defaults to 'application/json' . |
Return value
An OasSchema or OasRef object.
isRef
Returns false
indicating that the parameter is not a reference.
parameter.isRef()
Return value
false
resolve
Returns the parameter object itself.
parameter.resolve()
Return value
The parameter object itself.
resolveOnce
Returns the parameter object itself.
parameter.resolveOnce()
Return value
The parameter object itself.