|
| 1 | +type CoreKeywords = { |
| 2 | + $anchor?: string; |
| 3 | + $comment?: string; |
| 4 | + $defs?: { [key: string]: JsonSchema }; |
| 5 | + $dynamicAnchor?: string; |
| 6 | + $dynamicRef?: string; |
| 7 | + $id?: string; |
| 8 | + $ref?: string; |
| 9 | + $schema?: string; |
| 10 | + $vocabulary?: { [uri: string]: boolean }; |
| 11 | +}; |
| 12 | + |
| 13 | +type LogicSubschemasKeywords = { |
| 14 | + allOf?: Array<JsonSchema>; |
| 15 | + anyOf?: Array<JsonSchema>; |
| 16 | + not?: JsonSchema; |
| 17 | + oneOf?: Array<JsonSchema>; |
| 18 | +}; |
| 19 | + |
| 20 | +type ConditionalSubschemasKeywords = { |
| 21 | + dependentSchemas?: { [key: string]: JsonSchema }; |
| 22 | + else?: JsonSchema; |
| 23 | + if?: JsonSchema; |
| 24 | + then?: JsonSchema; |
| 25 | +}; |
| 26 | + |
| 27 | +type JsonSchemaType = 'null' | 'boolean' | 'string' | 'integer' | 'number' | 'array' | 'object'; |
| 28 | + |
| 29 | +type AnyValidationKeywords = { |
| 30 | + const?: any; |
| 31 | + enum?: Array<any>; |
| 32 | + type?: JsonSchemaType | Array<JsonSchemaType>; |
| 33 | +}; |
| 34 | + |
| 35 | +type MetaDataAnnotationKeywords = { |
| 36 | + default?: any; |
| 37 | + deprecated?: boolean; |
| 38 | + description?: string; |
| 39 | + examples?: Array<any>; |
| 40 | + readOnly?: boolean; |
| 41 | + title?: string; |
| 42 | + writeOnly?: boolean; |
| 43 | +}; |
| 44 | + |
| 45 | +type StringValidationKeywords = { |
| 46 | + maxLength?: number; |
| 47 | + minLength?: number; |
| 48 | + pattern?: string; |
| 49 | +}; |
| 50 | + |
| 51 | +type NumericValidationKeywords = { |
| 52 | + exclusiveMaximum?: number; |
| 53 | + exclusiveMinimum?: number; |
| 54 | + maximum?: number; |
| 55 | + minimum?: number; |
| 56 | + multipleOf?: number; |
| 57 | +}; |
| 58 | + |
| 59 | +type ArrayValidationKeywords = { |
| 60 | + contains?: JsonSchema; |
| 61 | + items?: JsonSchema; |
| 62 | + maxContains?: number; |
| 63 | + maxItems?: number; |
| 64 | + minContains?: number; |
| 65 | + minItems?: number; |
| 66 | + prefixItems?: Array<JsonSchema>; |
| 67 | + uniqueItems?: boolean; |
| 68 | +}; |
| 69 | + |
| 70 | +type ObjectValidationKeywords = { |
| 71 | + dependentRequired?: Record<string, Array<string>>; |
| 72 | + maxProperties?: number; |
| 73 | + minProperties?: number; |
| 74 | + required: string[]; |
| 75 | +}; |
| 76 | + |
| 77 | +type ObjectSubschemaKeywords = { |
| 78 | + additionalProperties?: JsonSchema; |
| 79 | + patternProperties?: { [propertyNameRegex: string]: JsonSchema }; |
| 80 | + properties?: { [propertyName: string]: JsonSchema }; |
| 81 | + propertyNames?: JsonSchema; |
| 82 | +}; |
| 83 | + |
| 84 | +type UnevaluatedLocationsKeywords = { |
| 85 | + unevaluatedItems?: JsonSchema; |
| 86 | + unevaluatedProperties?: JsonSchema; |
| 87 | +}; |
| 88 | + |
| 89 | +export type JsonSchema = CoreKeywords & |
| 90 | + LogicSubschemasKeywords & |
| 91 | + ConditionalSubschemasKeywords & |
| 92 | + JsonSchemaType & |
| 93 | + AnyValidationKeywords & |
| 94 | + MetaDataAnnotationKeywords & |
| 95 | + StringValidationKeywords & |
| 96 | + NumericValidationKeywords & |
| 97 | + ArrayValidationKeywords & |
| 98 | + ObjectValidationKeywords & |
| 99 | + UnevaluatedLocationsKeywords & |
| 100 | + ObjectSubschemaKeywords; |
0 commit comments