CodeSquared docs

OasObject

OasObject is an object representing an OpenAPI object schema.

Properties

PropertyTypeDescription
oasType'schema'Static value representing the OpenAPI schema type.
type'object'Static value representing the OpenAPI object schema type.
titlestring | undefinedOptional title of the object.
descriptionstring | undefinedOptional description of the object.
nullableboolean | undefinedOptional flag indicating whether the object can be null.
propertiesRecord<string, OasSchema | OasRef['schema']> | CustomValue | undefinedOptional map of property names to their corresponding schemas.
requiredstring[] | undefinedOptional array of required property names.
additionalPropertiesboolean | OasSchema | OasRef['schema'] | undefinedOptional flag indicating whether additional properties are allowed and their corresponding schema.
exampleRecord<string, unknown> | undefinedOptional example value for the object.
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

addProperty

Creates a new OasObject and adds the supplied property to it.

object.addProperty({name, schema, required})
Parameters
ParameterTypeDescription
namestringName of the property.
schemaOasSchema | OasRef['schema'] | CustomValue | undefinedSchema of the property.
requiredboolean | undefinedOptional flag indicating whether the property is required.

removeProperty

Removes a property from the object schema.

object.removeProperty(name)
Parameters
ParameterTypeDescription
namestringName of the property to remove.

isRef

Returns false indicating that the object is not a reference.

object.isRef()

Return value

false

resolve

Returns the object itself.

object.resolve()

Return value

The object itself.

resolveOnce

Returns the object itself.

object.resolveOnce()

Return value

The object itself.