Schemas
OasArray
An array schema: the OasSchema whose type is 'array'. Its items are a schema or a reference to one.
- The default value is in
defaultValue. The string, number, integer and boolean schemas have it indefault. - When the document gives no
items, they are anOasUnknown. - The parser does not read
prefixItems, so a tuple has only itsitems. - The parser cannot read
items: trueoritems: false. It logs an error and leaves out the component, operation or response that has the schema.
Signature
import { OasArray } from '@skmtc/core'
class OasArray<Nullable extends boolean | undefined = boolean | undefined> extends OasBaseConstructor
constructor
constructor(fields: ArrayFields<Nullable>, context?: ParseContextType)Properties
Object is part the 'schema' set which is used to define data types in an OpenAPI document.
Constant value 'array' useful for type narrowing and tagged unions.
A short summary of the array.
A description of the array.
Indicates whether value can be null.
Indicates whether the array items must be unique.
Specification Extension fields
An example of the array.
The maximum number of items in the array.
The minimum number of items in the array.
The enum values for the array.
The default value for the array.
Whether the array is read-only.
Whether the array is write-only.
Whether the array is deprecated.
The schema's not, kept as an OasUnknown under skmtc.config.json parse.not: unknown: the document says "not something", and core does not read what. undefined otherwise.
Methods
isRef
isRef(): this is OasRef<'schema'>Determines if this array is a reference object.
Always returns false since this is a concrete array instance, not a reference
isReadOnly
isReadOnly(): booleanWhether the value is readOnly: sent by the API only, never in a request.
isWriteOnly
isWriteOnly(): booleanWhether the value is writeOnly: sent in a request only, never by the API.
clone
clone(ref?: OasRef<'schema'>): OasArrayA copy of this schema with what ref adds at its site applied: its nullable, readOnly, writeOnly and the keywords next to it (SiblingKeywords) that this type takes, a sibling's value winning. A value that does not fit this type is left out (the parser reports it). For OasRef.resolve(). This schema does not change, and the copy shares its child schemas.
traverse
traverse(path: SchemaPath): OasSchema | OasRef<'schema'>resolve
resolve(): OasArray<Nullable>Resolves this array object.
The array instance itself since it's already a concrete object, not a reference
resolveOnce
resolveOnce(): OasArray<Nullable>Resolves this array object one level.
The array instance itself since it's already a concrete object, not a reference
toJsonSchema
toJsonSchema(options: ToJsonSchemaOptions): OpenAPIV3.ArraySchemaObjectConverts this OAS array to an OpenAPI v3 JSON schema representation.
Conversion options including reference handling and formatting preferences
OpenAPI v3 array schema object with type, items schema, and all validation constraints