# Class Discriminator
ClassModule | import { Discriminator } from "@tsed/schema" |
---|---|
Source | /packages/specs/schema/src/types/domain/JsonDiscriminator.ts |
# Overview
class Discriminator {
propertyName: string;
base: Type<any>;
values: Map<string, Type>;
types: Map<Type, string[]>;
constructor({ base, propertyName, types, values }?: Partial<{
base: Type<any>;
propertyName: string;
values: Map<string, Type<any>>;
types: Map<Type, string[]>;
}>);
add(type: Type<string>, values: string[]): this;
getType(discriminatorValue: string): Type<any>;
getValues(type: Type): string[] | undefined;
getDefaultValue(type: Type<any>): string | undefined;
children(): Type<any>[];
}
# Members
propertyName: string;
base: Type<any>;
values: Map<string, Type>;
types: Map<Type, string[]>;
add(type: Type<string>, values: string[]): this;
getType(discriminatorValue: string): Type<any>;
getValues(type: Type): string[] | undefined;
getDefaultValue(type: Type<any>): string | undefined;
children(): Type<any>[];