OasObject
OasObject is an object representing an OpenAPI object schema.
Properties
| Property | Type | Description |
|---|---|---|
| oasType | 'schema' | Static value representing the OpenAPI schema type. |
| type | 'object' | Static value representing the OpenAPI object schema type. |
| title | string | undefined | Optional title of the object. |
| description | string | undefined | Optional description of the object. |
| nullable | boolean | undefined | Optional flag indicating whether the object can be null. |
| properties | Record<string, OasSchema | OasRef['schema']> | CustomValue | undefined | Optional map of property names to their corresponding schemas. |
| required | string[] | undefined | Optional array of required property names. |
| additionalProperties | boolean | OasSchema | OasRef['schema'] | undefined | Optional flag indicating whether additional properties are allowed and their corresponding schema. |
| example | Record<string, unknown> | undefined | Optional example value for the object. |
| 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
addProperty
Creates a new OasObject and adds the supplied property to it.
object.addProperty({name, schema, required})
Parameters
| Parameter | Type | Description |
|---|---|---|
| name | string | Name of the property. |
| schema | OasSchema | OasRef['schema'] | CustomValue | undefined | Schema of the property. |
| required | boolean | undefined | Optional flag indicating whether the property is required. |
removeProperty
Removes a property from the object schema.
object.removeProperty(name)
Parameters
| Parameter | Type | Description |
|---|---|---|
| name | string | Name 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.