Spaces:
Running
Running
File size: 1,271 Bytes
1df763a |
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 {ErrorObject, Vocabulary} from "../../types"
import limitNumber, {LimitNumberError} from "./limitNumber"
import multipleOf, {MultipleOfError} from "./multipleOf"
import limitLength from "./limitLength"
import pattern, {PatternError} from "./pattern"
import limitProperties from "./limitProperties"
import required, {RequiredError} from "./required"
import limitItems from "./limitItems"
import uniqueItems, {UniqueItemsError} from "./uniqueItems"
import constKeyword, {ConstError} from "./const"
import enumKeyword, {EnumError} from "./enum"
const validation: Vocabulary = [
// number
limitNumber,
multipleOf,
// string
limitLength,
pattern,
// object
limitProperties,
required,
// array
limitItems,
uniqueItems,
// any
{keyword: "type", schemaType: ["string", "array"]},
{keyword: "nullable", schemaType: "boolean"},
constKeyword,
enumKeyword,
]
export default validation
type LimitError = ErrorObject<
"maxItems" | "minItems" | "minProperties" | "maxProperties" | "minLength" | "maxLength",
{limit: number},
number | {$data: string}
>
export type ValidationKeywordError =
| LimitError
| LimitNumberError
| MultipleOfError
| PatternError
| RequiredError
| UniqueItemsError
| ConstError
| EnumError
|