forked from epiphone/class-validator-jsonschema
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.ts
50 lines (43 loc) · 1.56 KB
/
options.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import type { MetadataStorage as ClassTransformerMetadataStorage } from 'class-transformer/types/MetadataStorage' // tslint:disable-line:no-submodule-imports
import {
getMetadataStorage,
MetadataStorage,
ValidatorOptions,
} from 'class-validator'
import { ISchemaConverters } from './defaultConverters'
export interface IOptions extends ValidatorOptions {
/**
* A map of additional metadata-to-schema converters that can be used to
* supplement or override the default ones. The key should correspond to the
* 'type' property of a ValidationMetadata object.
*/
additionalConverters: ISchemaConverters
/**
* Metadata storage instance of class-transformer. This value can be
* optionally defined in order for class-transformer's @Type decorators to
* have effect in JSON Schema generation.
*/
classTransformerMetadataStorage?: ClassTransformerMetadataStorage
/**
* Metadata storage instance of class-validator. This value can be
* optionally defined in order to override the default storage used
* to parse decorator metadata.
*/
classValidatorMetadataStorage: MetadataStorage
/**
* A prefix added to all `$ref` JSON pointers referencing other schemas.
* Defaults to '#/definitions/'.
*/
refPointerPrefix: string
/**
* Property used to group schemas.
* Defaults to `name`, i.e., class name.
*/
schemaNameField: string
}
export const defaultOptions: IOptions = {
additionalConverters: {},
classValidatorMetadataStorage: getMetadataStorage(),
refPointerPrefix: '#/definitions/',
schemaNameField: 'name',
}