CodeSquared docs

OasResponse

OasResponse is an object representing an OpenAPI response.

Properties

PropertyTypeDescription
oasType'response'Static value representing the OpenAPI response type.
descriptionstring | undefinedOptional description of the response.
headersRecord<string, OasHeader | OasRef<'header'>> | undefinedOptional map of response headers.
contentRecord<string, OasMediaType | OasRef<'mediaType'>> | undefinedOptional map of response content by the media type.
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 content property for the given media type.

response.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 response is not a reference.

response.isRef()

Return value

false

resolve

Returns the response object itself.

response.resolve()

Return value

Returns the response object itself.

resolveOnce

Returns the response object itself.

response.resolveOnce()

Return value

Returns the response object itself.