import { SchemaObject } from 'openapi3-ts' ; import 'reflect-metadata' ; import { IOptions } from './options' ; const SCHEMA_KEY = Symbol ( 'class-validator-jsonschema:JSONSchema' ) ; /**
 * Either a plain JSON Schema object that gets merged into the existing schema,
 * or a function that receives as parameters the existing schema and global
 * options, returning an updated schema.
 */ export type DecoratorSchema = SchemaObject | ( ( source : SchemaObject , options : IOptions ) => SchemaObject ) ; param schema export function JSONSchema ( schema ) { return ( target , key ? ) => { if ( key ) { setMetadataSchema ( schema , target . constructor , key ) ; } else { setMetadataSchema ( schema , target , ( target as Function ) . name ) ; } } ; } /**
 * Get the JSON Schema stored in given target's metadata.
 */ export function getMetadataSchema ( target , key ) { return Reflect . getMetadata ( SCHEMA_KEY , target . constructor , key ) || { } ; } /**
 * Store given JSON Schema into target object's metadata.
 */ function setMetadataSchema ( value , target , key ) { return Reflect . defineMetadata ( SCHEMA_KEY , value , target , key ) ; }