# JsonSchema Class

Module
import { JsonSchema } from "@tsed/common"
Source/packages/common/src/jsonschema/class/JsonSchema.ts

# Overview

class JsonSchema implements JSONSchema6 {
    $id: string;
    id: string;
    $ref: string;
    $schema: any;
    title: string;
    description: string;
    default: JSONSchema6Type;
    additionalItems: boolean | JSONSchema6;
    items: JsonSchema;
    maxItems: number;
    minItems: number;
    uniqueItems: boolean;
    maxProperties: number;
    minProperties: number;
    required: any | string[];
    properties: {
        [key: string]: JsonSchema;
    };
    additionalProperties: JsonSchema;
    definitions: {
        [p: string]: JSONSchema6;
    };
    patternProperties: {
        [p: string]: JSONSchema6;
    };
    dependencies: {
        [p: string]: JSONSchema6 | string[];
    };
    allOf: JSONSchema6[];
    anyOf: JSONSchema6[];
    oneOf: JSONSchema6[];
    not: JSONSchema6;
    extends: string | string[];
    multipleOf: number;
    maximum: number;
    exclusiveMaximum: number;
    minimum: number;
    exclusiveMinimum: number;
    maxLength: number;
    minLength: number;
    pattern: string;
    format: string;
    enum: JSONSchema6Type[];
    [key: string]: any;
    constructor();
    get mapper(): JSONSchema6;
    get type(): any | JSONSchema6TypeName | JSONSchema6TypeName[];
    set type(value: any | JSONSchema6TypeName | JSONSchema6TypeName[]);
    get refName(): string;
    get isCollection(): boolean;
    get isArray(): boolean;
    get schemaType(): "collection" | JSONSchema6TypeName | JSONSchema6TypeName[];
    static getJsonType(value: any): JSONSchema6TypeName | JSONSchema6TypeName[];
    static ref(type: any): JsonSchema;
    mapValue(key: string, value: any): void;
    toCollection(collectionType: any): void;
    toJSON(): any;
    toObject(): any;
    merge(obj: any): this;
}

# Members

$id: string

id: string

$ref: string

$schema: any

title: string

description: string

default: JSONSchema6Type

additionalItems: boolean | JSONSchema6

items: JsonSchema

maxItems: number

minItems: number

uniqueItems: boolean

maxProperties: number

minProperties: number

required: any | string[]

properties: {
     [key: string]: JsonSchema;
 };

additionalProperties: JsonSchema

definitions: {
     [p: string]: JSONSchema6;
 };

patternProperties: {
     [p: string]: JSONSchema6;
 };

dependencies: {
     [p: string]: JSONSchema6 | string[];
 };

allOf: JSONSchema6[]

anyOf: JSONSchema6[]

oneOf: JSONSchema6[]

not: JSONSchema6

extends: string | string[]

multipleOf: number

maximum: number

exclusiveMaximum: number

minimum: number

exclusiveMinimum: number

maxLength: number

minLength: number

pattern: string

format: string

enum: JSONSchema6Type[]

[key: string]: any

get mapper(): JSONSchema6

get type(): any | JSONSchema6TypeName | JSONSchema6TypeName[]

set type(value: any | JSONSchema6TypeName | JSONSchema6TypeName[])

get refName(): string

get isCollection(): boolean

get isArray(): boolean

get schemaType(): "collection" | JSONSchema6TypeName | JSONSchema6TypeName[]

static getJsonType(value: any): JSONSchema6TypeName | JSONSchema6TypeName[]

static ref(type: any): JsonSchema

mapValue(key: string, value: any): void

Write value on the right place according to the schema type


toCollection(collectionType: any): void

toJSON(): any

toObject(): any

merge(obj: any): this