1- export type JsonSchemaType =
2- | 'string'
3- | 'number'
4- | 'integer'
5- | 'object'
6- | 'array'
7- | 'boolean'
8- | 'null' ;
1+ import type { SchemaPropertyType } from '@/schema/jsonSchemaType.ts' ;
92
10- const COMMON = [ 'title' , 'description' , 'default' , 'examples' , 'enum' , 'const' ] ;
113
12- const GENERIC = [ 'allOf' , 'anyOf' , 'oneOf' , 'not' ] ;
13-
14- export const SUPPORTED_KEYWORDS : Record < JsonSchemaType , string [ ] > = {
15- string : [ ...COMMON , ...GENERIC , 'minLength' , 'maxLength' , 'pattern' , 'format' ] ,
16- number : [
17- ...COMMON ,
18- ...GENERIC ,
19- 'minimum' ,
20- 'maximum' ,
21- 'exclusiveMinimum' ,
22- 'exclusiveMaximum' ,
23- 'multipleOf' ,
24- ] ,
25- integer : [
26- ...COMMON ,
27- ...GENERIC ,
28- 'minimum' ,
29- 'maximum' ,
30- 'exclusiveMinimum' ,
31- 'exclusiveMaximum' ,
32- 'multipleOf' ,
33- ] ,
34- object : [ ...COMMON , ...GENERIC , 'properties' , 'required' , 'additionalProperties' ] ,
35- array : [ ...COMMON , ...GENERIC , 'items' , 'minItems' , 'maxItems' , 'uniqueItems' ] ,
36- boolean : [ ...COMMON , ...GENERIC ] ,
37- null : [ ...COMMON , ...GENERIC ] ,
38- } ;
4+ export const CONSTRAINED_KEYWORDS : Record < string , SchemaPropertyType [ ] > = {
5+ minLength : [ 'string' ] ,
6+ maxLength : [ 'string' ] ,
7+ pattern : [ 'string' ] ,
8+ format : [ 'string' ] ,
9+ minimum : [ 'number' , 'integer' ] ,
10+ maximum : [ 'number' , 'integer' ] ,
11+ exclusiveMinimum : [ 'number' , 'integer' ] ,
12+ exclusiveMaximum : [ 'number' , 'integer' ] ,
13+ multipleOf : [ 'number' , 'integer' ] ,
14+ properties : [ 'object' ] ,
15+ patternProperties : [ 'object' ] ,
16+ required : [ 'object' ] ,
17+ additionalProperties : [ 'object' ] ,
18+ propertyNames : [ 'object' ] ,
19+ items : [ 'array' ] ,
20+ minItems : [ 'array' ] ,
21+ maxItems : [ 'array' ] ,
22+ uniqueItems : [ 'array' ] ,
23+ contains : [ 'array' ] ,
24+ maxContains : [ 'array' ] ,
25+ minContains : [ 'array' ] ,
26+ }
0 commit comments