Interface: JsonDefinition

Type definition for JSON Schema

Properties
Name Type Description
additionalItems

Type definition for JSON Schema

additionalProperties

Type definition for JSON Schema

allOf

Type definition for JSON Schema

anyOf

Type definition for JSON Schema

definitions

Type definition for JSON Schema

enum

Type definition for JSON Schema

items

Type definition for JSON Schema

oneOf

Type definition for JSON Schema

properties

Type definition for JSON Schema

Function: getJsonSchema

getJsonSchema(ctor: Function) : JsonDefinition

Gets the JSON Schema of a TypeScript model/class by seeing if one exists in a cache. If not, one is generated and then cached.

Arguments
Name Type Description
ctor Function

Contructor of class to get JSON Schema from

Function: isComplexType

isComplexType(ctor: Function) : boolean

Determines whether the given constructor is a custom type or not

Arguments
Name Type Description
ctor Function

Constructor

Function: metaToJsonProperty

metaToJsonProperty(meta: PropertyDefinition) : JsonDefinition

Converts property metadata into a JSON property definition

Arguments
Name Type Description
meta PropertyDefinition

Function: modelToJsonSchema

modelToJsonSchema(ctor: Function) : JsonDefinition

Converts a TypeScript class into a JSON Schema using TypeScript's reflection API

Arguments
Name Type Description
ctor Function

Constructor of class to convert from

Function: stringTypeToWrapper

stringTypeToWrapper(type: string) : Function

Gets the wrapper function of primitives string, number, and boolean

Arguments
Name Type Description
type string

Name of type