[79a0317] | 1 | import type {Vocabulary, KeywordDefinition, ErrorNoParams} from "ajv"
|
---|
| 2 | import type {DefinitionOptions, GetDefinition} from "./_types"
|
---|
| 3 | import typeofDef from "./typeof"
|
---|
| 4 | import instanceofDef from "./instanceof"
|
---|
| 5 | import range from "./range"
|
---|
| 6 | import exclusiveRange from "./exclusiveRange"
|
---|
| 7 | import regexp from "./regexp"
|
---|
| 8 | import transform from "./transform"
|
---|
| 9 | import uniqueItemProperties from "./uniqueItemProperties"
|
---|
| 10 | import allRequired from "./allRequired"
|
---|
| 11 | import anyRequired from "./anyRequired"
|
---|
| 12 | import oneRequired from "./oneRequired"
|
---|
| 13 | import patternRequired, {PatternRequiredError} from "./patternRequired"
|
---|
| 14 | import prohibited from "./prohibited"
|
---|
| 15 | import deepProperties from "./deepProperties"
|
---|
| 16 | import deepRequired from "./deepRequired"
|
---|
| 17 | import dynamicDefaults from "./dynamicDefaults"
|
---|
| 18 | import selectDef, {SelectError} from "./select"
|
---|
| 19 |
|
---|
| 20 | const definitions: GetDefinition<KeywordDefinition>[] = [
|
---|
| 21 | typeofDef,
|
---|
| 22 | instanceofDef,
|
---|
| 23 | range,
|
---|
| 24 | exclusiveRange,
|
---|
| 25 | regexp,
|
---|
| 26 | transform,
|
---|
| 27 | uniqueItemProperties,
|
---|
| 28 | allRequired,
|
---|
| 29 | anyRequired,
|
---|
| 30 | oneRequired,
|
---|
| 31 | patternRequired,
|
---|
| 32 | prohibited,
|
---|
| 33 | deepProperties,
|
---|
| 34 | deepRequired,
|
---|
| 35 | dynamicDefaults,
|
---|
| 36 | ]
|
---|
| 37 |
|
---|
| 38 | export default function ajvKeywords(opts?: DefinitionOptions): Vocabulary {
|
---|
| 39 | return definitions.map((d) => d(opts)).concat(selectDef(opts))
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | export type AjvKeywordsError =
|
---|
| 43 | | PatternRequiredError
|
---|
| 44 | | SelectError
|
---|
| 45 | | ErrorNoParams<
|
---|
| 46 | | "range"
|
---|
| 47 | | "exclusiveRange"
|
---|
| 48 | | "anyRequired"
|
---|
| 49 | | "oneRequired"
|
---|
| 50 | | "allRequired"
|
---|
| 51 | | "deepProperties"
|
---|
| 52 | | "deepRequired"
|
---|
| 53 | | "dynamicDefaults"
|
---|
| 54 | | "instanceof"
|
---|
| 55 | | "prohibited"
|
---|
| 56 | | "regexp"
|
---|
| 57 | | "transform"
|
---|
| 58 | | "uniqueItemProperties"
|
---|
| 59 | >
|
---|
| 60 |
|
---|
| 61 | module.exports = ajvKeywords
|
---|