1 | import type {ErrorNoParams, Vocabulary} from "../../types"
|
---|
2 | import additionalItems, {AdditionalItemsError} from "./additionalItems"
|
---|
3 | import prefixItems from "./prefixItems"
|
---|
4 | import items from "./items"
|
---|
5 | import items2020, {ItemsError} from "./items2020"
|
---|
6 | import contains, {ContainsError} from "./contains"
|
---|
7 | import dependencies, {DependenciesError} from "./dependencies"
|
---|
8 | import propertyNames, {PropertyNamesError} from "./propertyNames"
|
---|
9 | import additionalProperties, {AdditionalPropertiesError} from "./additionalProperties"
|
---|
10 | import properties from "./properties"
|
---|
11 | import patternProperties from "./patternProperties"
|
---|
12 | import notKeyword, {NotKeywordError} from "./not"
|
---|
13 | import anyOf, {AnyOfError} from "./anyOf"
|
---|
14 | import oneOf, {OneOfError} from "./oneOf"
|
---|
15 | import allOf from "./allOf"
|
---|
16 | import ifKeyword, {IfKeywordError} from "./if"
|
---|
17 | import thenElse from "./thenElse"
|
---|
18 |
|
---|
19 | export default function getApplicator(draft2020 = false): Vocabulary {
|
---|
20 | const applicator = [
|
---|
21 | // any
|
---|
22 | notKeyword,
|
---|
23 | anyOf,
|
---|
24 | oneOf,
|
---|
25 | allOf,
|
---|
26 | ifKeyword,
|
---|
27 | thenElse,
|
---|
28 | // object
|
---|
29 | propertyNames,
|
---|
30 | additionalProperties,
|
---|
31 | dependencies,
|
---|
32 | properties,
|
---|
33 | patternProperties,
|
---|
34 | ]
|
---|
35 | // array
|
---|
36 | if (draft2020) applicator.push(prefixItems, items2020)
|
---|
37 | else applicator.push(additionalItems, items)
|
---|
38 | applicator.push(contains)
|
---|
39 | return applicator
|
---|
40 | }
|
---|
41 |
|
---|
42 | export type ApplicatorKeywordError =
|
---|
43 | | ErrorNoParams<"false schema">
|
---|
44 | | AdditionalItemsError
|
---|
45 | | ItemsError
|
---|
46 | | ContainsError
|
---|
47 | | AdditionalPropertiesError
|
---|
48 | | DependenciesError
|
---|
49 | | IfKeywordError
|
---|
50 | | AnyOfError
|
---|
51 | | OneOfError
|
---|
52 | | NotKeywordError
|
---|
53 | | PropertyNamesError
|
---|