source: imaps-frontend/node_modules/ajv/lib/2020.ts@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 2.2 KB
Line 
1import type {AnySchemaObject} from "./types"
2import AjvCore, {Options} from "./core"
3
4import draft2020Vocabularies from "./vocabularies/draft2020"
5import discriminator from "./vocabularies/discriminator"
6import addMetaSchema2020 from "./refs/json-schema-2020-12"
7
8const META_SCHEMA_ID = "https://json-schema.org/draft/2020-12/schema"
9
10export class Ajv2020 extends AjvCore {
11 constructor(opts: Options = {}) {
12 super({
13 ...opts,
14 dynamicRef: true,
15 next: true,
16 unevaluated: true,
17 })
18 }
19
20 _addVocabularies(): void {
21 super._addVocabularies()
22 draft2020Vocabularies.forEach((v) => this.addVocabulary(v))
23 if (this.opts.discriminator) this.addKeyword(discriminator)
24 }
25
26 _addDefaultMetaSchema(): void {
27 super._addDefaultMetaSchema()
28 const {$data, meta} = this.opts
29 if (!meta) return
30 addMetaSchema2020.call(this, $data)
31 this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID
32 }
33
34 defaultMeta(): string | AnySchemaObject | undefined {
35 return (this.opts.defaultMeta =
36 super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined))
37 }
38}
39
40module.exports = exports = Ajv2020
41module.exports.Ajv2020 = Ajv2020
42Object.defineProperty(exports, "__esModule", {value: true})
43
44export default Ajv2020
45
46export {
47 Format,
48 FormatDefinition,
49 AsyncFormatDefinition,
50 KeywordDefinition,
51 KeywordErrorDefinition,
52 CodeKeywordDefinition,
53 MacroKeywordDefinition,
54 FuncKeywordDefinition,
55 Vocabulary,
56 Schema,
57 SchemaObject,
58 AnySchemaObject,
59 AsyncSchema,
60 AnySchema,
61 ValidateFunction,
62 AsyncValidateFunction,
63 ErrorObject,
64 ErrorNoParams,
65} from "./types"
66
67export {Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions} from "./core"
68export {SchemaCxt, SchemaObjCxt} from "./compile"
69export {KeywordCxt} from "./compile/validate"
70export {DefinedError} from "./vocabularies/errors"
71export {JSONType} from "./compile/rules"
72export {JSONSchemaType} from "./types/json-schema"
73export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen"
74export {default as ValidationError} from "./runtime/validation_error"
75export {default as MissingRefError} from "./compile/ref_error"
Note: See TracBrowser for help on using the repository browser.