Class CommonModel

Common internal representation for a model.

Hierarchy

  • CommonModel

Constructors

Properties

$id?: string
additionalItems?: CommonModel
additionalProperties?: CommonModel
const?: unknown
discriminator?: string
enum?: any[]
extend?: CommonModel[]
format?: string
originalInput?: any
patternProperties?: {
    [key: string]: CommonModel;
}

Type declaration

properties?: {
    [key: string]: CommonModel;
}

Type declaration

required?: string[]
type?: string | string[]
union?: CommonModel[]

Methods

  • Adds additionalItems to the model. If another model already exist the two are merged.

    Parameters

    • additionalItemsModel: CommonModel
    • originalInput: any

      corresponding input that got interpreted to this model

    Returns void

  • Adds additionalProperty to the model. If another model already exist the two are merged.

    Parameters

    • additionalPropertiesModel: CommonModel
    • originalInput: any

      corresponding input that got interpreted to this model corresponding input that got interpreted to this model

    Returns void

  • Add enum value to the model.

    Ensures no duplicates are added.

    Parameters

    • enumValue: any

    Returns void

  • Adds another model this model should extend.

    It is only allowed to extend if the other model have $id and is not already being extended.

    Parameters

    Returns void

  • Adds an item to the model.

    If items already exist the two are merged.

    Parameters

    • itemModel: CommonModel
    • originalInput: any

      corresponding input that got interpreted to this model

    Returns void

  • Adds a tuple to the model.

    If a item already exist it will be merged.

    Parameters

    • tupleModel: CommonModel
    • originalInput: any

      corresponding input that got interpreted to this model

    • index: number

    Returns void

  • Adds a patternProperty to the model. If the pattern already exist the two models are merged.

    Parameters

    • pattern: string
    • patternModel: CommonModel
    • originalInput: any

      corresponding input that got interpreted to this model

    Returns void

  • Adds a property to the model. If the property already exist the two are merged.

    Parameters

    • propertyName: string
    • propertyModel: CommonModel
    • originalInput: any

      corresponding input that got interpreted to this model

    Returns void

  • Adds types to the existing model types.

    Makes sure to only keep a single type incase of duplicates.

    Parameters

    • types: string | string[]

      which types we should try and add to the existing output

    Returns void

  • Retrieves data from originalInput by given key

    Type Parameters

    • K extends string | number | symbol

    Parameters

    • key: K

      given key

    Returns any

  • Checks if given property name is required in object

    Parameters

    • propertyName: string

      given property name

    Returns boolean

  • Removes type(s) from model type

    Parameters

    • typesToRemove: string | string[]

    Returns void

  • Set the types of the model

    Parameters

    • type: undefined | string | string[]

    Returns void

  • Returns true if the $id of a CommonModel includes anonymous_schema

    Parameters

    Returns undefined | boolean

  • Merge two common model additionalProperties together

    Parameters

    Returns void

  • Merge items together, prefer tuples over simple array since it is more strict.

    Parameters

    Returns void

  • Merge two common model pattern properties together

    Parameters

    Returns void

Generated using TypeDoc