Schemas
OasString
A string schema: the OasSchema whose type is 'string'. A string enum is also one, with its values in enums.
format can be any text, because the parser keeps what the document has. nullable does not add null to enums.
Signature
import { OasString } from '@skmtc/core'
class OasString<Nullable extends boolean | undefined = boolean | undefined> extends OasBaseConstructor
constructor
constructor(fields?: StringFields<Nullable>, context?: ParseContextType)Properties
Object is part the 'schema' set which is used to define data types in an OpenAPI document.
Constant value 'string' useful for type narrowing and tagged unions.
A short summary of the string.
A description of the string.
The format of the string.
An array of allowed values for the string.
The maximum length of the string.
The minimum length of the string.
Indicates whether value can be null.
Specification Extension fields
An example of the string.
The pattern of the string.
The default value of the string.
Whether the string is read-only.
Whether the string is write-only.
Whether the string 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'>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'>): OasStringA 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(): OasString<Nullable>resolveOnce
resolveOnce(): OasString<Nullable>toJsonSchema
toJsonSchema(options?: ToJsonSchemaOptions): OpenAPIV3.NonArraySchemaObject