Class Schema<E, R>

Wrapper around the raw JSON Schema. It is recommended to use this class instead of the raw JSON Schema as it is more robust to schema changes and provides utility functions.

Type Parameters

Hierarchy

  • Schema

Constructors

Accessors

  • get entities(): EntitySchema<E, R, E[number]>[]
  • Returns the list of entity schemas in the schema using the EntitySchema abstraction class.

    Returns EntitySchema<E, R, E[number]>[]

  • get relationsDefinitions(): RelationDefinitionSchema<E, R, R[number]>[]
  • Returns the list of relation definitions schemas in the schema using the RelationDefinitionSchema abstraction class.

    Returns RelationDefinitionSchema<E, R, R[number]>[]

Methods

  • Returns the entity schema for the given entity type if it exists. When using TypeScript, this method can detect if the given type does not exist in the schema.

    Type Parameters

    • EType extends string

    Parameters

    • entityType: EType

      The entity type string

    Returns IsLooseSchema<E> extends true
        ? null | EntitySchema<E, R, E[number]>
        : IsETypeInStrictSchema<E, EType> extends true
            ? EntitySchema<E, R, EntityRawSchemaByType<E, EType>>
            : null

    A new EntitySchema or null if the type does not exist

Generated using TypeDoc