Docs@skmtc/core

Schemas

CLASS

OasInteger

@skmtc/core 0.63.4

An integer schema: the OasSchema whose type is 'integer'. A schema of type: number is an OasNumber.

  • The parser keeps only the formats int32 and int64. For another one, such as uint32, format is undefined.
  • In each OpenAPI version, an exclusive limit is in maximum or minimum, and exclusiveMaximum or exclusiveMinimum is true.

Signature

import { OasInteger } from '@skmtc/core'

class OasInteger<Nullable extends boolean | undefined = boolean | undefined> extends OasBase

Constructor

constructor

constructor(fields?: IntegerFields<Nullable>, context?: ParseContextType)

Properties

oasType, 'schema'

Object is part the 'schema' set which is used to define data types in an OpenAPI document.

type, 'integer'

Constant value 'integer' useful for type narrowing and tagged unions.

title, string | undefined

A short summary of the integer.

description, string | undefined

A description of the integer.

nullable, Nullable | undefined

Indicates whether value can be null.

format, 'int32' | 'int64' | undefined

The format of the integer.

enums, Nullable extends true ? (number | null)[] | undefined : number[] | undefined

An array of allowed values for the integer.

extensionFields, Record<string, unknown> | undefined

Specification Extension fields

example, Nullable extends true ? number | null | undefined : number | undefined

An example of the integer.

multipleOf, number | undefined

The multiple of the integer.

maximum, number | undefined

The maximum value of the integer.

exclusiveMaximum, boolean | undefined

Whether the maximum value is exclusive.

minimum, number | undefined

The minimum value of the integer.

exclusiveMinimum, boolean | undefined

Whether the minimum value is exclusive.

default, Nullable extends true ? number | null | undefined : number | undefined

The default value of the integer.

readOnly, boolean | undefined

Whether the integer is read-only.

writeOnly, boolean | undefined

Whether the integer is write-only.

deprecated, boolean | undefined

Whether the integer is deprecated.

not, OasUnknown | undefined

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(): boolean

Whether the value is readOnly: sent by the API only, never in a request.

isWriteOnly

isWriteOnly(): boolean

Whether the value is writeOnly: sent in a request only, never by the API.

clone

clone(ref?: OasRef<'schema'>): OasInteger

A 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(): OasInteger<Nullable>

resolveOnce

resolveOnce(): OasInteger<Nullable>

toJsonSchema

toJsonSchema(options?: ToJsonSchemaOptions): OpenAPIV3.NonArraySchemaObject