Options
All
  • Public
  • Public/Protected
  • All
Menu

Class JsonSchema

A Json-Schema holder.

There are 2 kinds of Json-Schema's:

  • JSON Object based
  • Boolean based

This is a common interface to handle all kinds of schemas.

Hierarchy

  • JsonSchema

Index

Properties

Static Readonly EXCLUDE_ANNOTATIONS

EXCLUDE_ANNOTATIONS: any

Predicate to filter out annotation keys.

Static Readonly EXCLUDE_ANNOTATION_ENTRIES

EXCLUDE_ANNOTATION_ENTRIES: any

Predicate to filter out annotation keys.

Methods

annotate

  • annotate(key: string, value: string): JsonSchema
  • Annotates the schema. An annotation is a extra key-value added to the schema that are not relevant for validation but can be used to store pre-computed state.

    Parameters

    • key: string
    • value: string

    Returns JsonSchema

containsKey

  • containsKey(key: string): boolean
  • Checks if the given key is present in the schema object.

    Parameters

    • key: string

    Returns boolean

fieldNames

  • fieldNames(): string
  • Returns the field names on the underlying object.

    Returns string

get

  • get<R>(key: string): R
  • get<R>(key: string, fallback: R): R
  • Get a type casted value by key.

    Type parameters

    • R

    Parameters

    • key: string

    Returns R

  • Get a type casted value by key. If the key is missing, then the fallback value is returned.

    Type parameters

    • R

    Parameters

    • key: string
    • fallback: R

    Returns R

resolve

  • resolve(): {}
  • Tries to resolve all internal references. External references are not resolved.

    The result is an object where all references have been resolved. Resolution of circular references is shallow. This should normally not be a problem for this use case.

    Returns {}

    • [key: string]: any

Static of

  • Factory method to create a JsonSchema from a .

    Parameters

    • json: {}
      • [key: string]: any

    Returns JsonSchema

  • Factory method to create a JsonSchema from a .

    Parameters

    • id: string
    • json: {}
      • [key: string]: any

    Returns JsonSchema

  • Factory method to create a JsonSchema from a Boolean.

    Parameters

    • bool: boolean

    Returns JsonSchema

Generated using TypeDoc