| 1 | import type {ErrorObject, Vocabulary} from "../../types" |
| 2 | import limitNumber, {LimitNumberError} from "./limitNumber" |
| 3 | import multipleOf, {MultipleOfError} from "./multipleOf" |
| 4 | import limitLength from "./limitLength" |
| 5 | import pattern, {PatternError} from "./pattern" |
| 6 | import limitProperties from "./limitProperties" |
| 7 | import required, {RequiredError} from "./required" |
| 8 | import limitItems from "./limitItems" |
| 9 | import uniqueItems, {UniqueItemsError} from "./uniqueItems" |
| 10 | import constKeyword, {ConstError} from "./const" |
| 11 | import enumKeyword, {EnumError} from "./enum" |
| 12 | |
| 13 | const validation: Vocabulary = [ |
| 14 | // number |
| 15 | limitNumber, |
| 16 | multipleOf, |
| 17 | // string |
| 18 | limitLength, |
| 19 | pattern, |
| 20 | // object |
| 21 | limitProperties, |
| 22 | required, |
| 23 | // array |
| 24 | limitItems, |
| 25 | uniqueItems, |
| 26 | // any |
| 27 | {keyword: "type", schemaType: ["string", "array"]}, |
| 28 | {keyword: "nullable", schemaType: "boolean"}, |
| 29 | constKeyword, |
| 30 | enumKeyword, |
| 31 | ] |
| 32 | |
| 33 | export default validation |
| 34 | |
| 35 | type LimitError = ErrorObject< |
| 36 | "maxItems" | "minItems" | "minProperties" | "maxProperties" | "minLength" | "maxLength", |
| 37 | {limit: number}, |
| 38 | number | {$data: string} |
| 39 | > |
| 40 | |
| 41 | export type ValidationKeywordError = |
| 42 | | LimitError |
| 43 | | LimitNumberError |
| 44 | | MultipleOfError |
| 45 | | PatternError |
| 46 | | RequiredError |
| 47 | | UniqueItemsError |
| 48 | | ConstError |
| 49 | | EnumError |