CodeSquared docs

OasParameter

OasParameter represents an OpenAPI parameter.

Properties

PropertyTypeDescription
oasType'parameter'Static value representing the OpenAPI parameter type.
namestringParameter 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.
descriptionstring | undefinedOptional description
requiredboolean | undefinedOptional flag marking the parameter as required.
style"simple" | "label" | "matrix" | "spaceDelimited" | "pipeDelimited" | "deepObject"Optional style of the parameter.
explodeboolean | undefinedOptional flag to explode the array if style is deepObject.
schemaOasSchema | OasRef<'schema'> | undefinedOptional OasSchema or reference to it.
examplesRecord<string, OasExample | OasRef<'example'>> | undefinedOptional map of examples for the parameter.
contentRecord<string, OasMediaType | undefinedOptional map of parameter representations by the media type.
deprecatedboolean | undefinedOptional flag marking the parameter as deprecated.
allowEmptyValueboolean | undefinedOptional flag allowing use of empty parameter values.
allowReservedboolean | undefinedOptional flag allowing reserved characters. This property only applies to parameters with a location of query. The default value is false.
extensionFieldsRecord<string, unknown> | undefinedOptional 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
ParameterTypeDescription
mediaTypestringThe 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.