source: imaps-frontend/node_modules/ajv/lib/ajv.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 from "./core"
3import draft7Vocabularies from "./vocabularies/draft7"
4import discriminator from "./vocabularies/discriminator"
5import * as draft7MetaSchema from "./refs/json-schema-draft-07.json"
6
7const META_SUPPORT_DATA = ["/properties"]
8
9const META_SCHEMA_ID = "http://json-schema.org/draft-07/schema"
10
11export class Ajv extends AjvCore {
12 _addVocabularies(): void {
13 super._addVocabularies()
14 draft7Vocabularies.forEach((v) => this.addVocabulary(v))
15 if (this.opts.discriminator) this.addKeyword(discriminator)
16 }
17
18 _addDefaultMetaSchema(): void {
19 super._addDefaultMetaSchema()
20 if (!this.opts.meta) return
21 const metaSchema = this.opts.$data
22 ? this.$dataMetaSchema(draft7MetaSchema, META_SUPPORT_DATA)
23 : draft7MetaSchema
24 this.addMetaSchema(metaSchema, META_SCHEMA_ID, false)
25 this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID
26 }
27
28 defaultMeta(): string | AnySchemaObject | undefined {
29 return (this.opts.defaultMeta =
30 super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined))
31 }
32}
33
34module.exports = exports = Ajv
35module.exports.Ajv = Ajv
36Object.defineProperty(exports, "__esModule", {value: true})
37
38export default Ajv
39
40export {
41 Format,
42 FormatDefinition,
43 AsyncFormatDefinition,
44 KeywordDefinition,
45 KeywordErrorDefinition,
46 CodeKeywordDefinition,
47 MacroKeywordDefinition,
48 FuncKeywordDefinition,
49 Vocabulary,
50 Schema,
51 SchemaObject,
52 AnySchemaObject,
53 AsyncSchema,
54 AnySchema,
55 ValidateFunction,
56 AsyncValidateFunction,
57 SchemaValidateFunction,
58 ErrorObject,
59 ErrorNoParams,
60} from "./types"
61
62export {Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions} from "./core"
63export {SchemaCxt, SchemaObjCxt} from "./compile"
64export {KeywordCxt} from "./compile/validate"
65export {DefinedError} from "./vocabularies/errors"
66export {JSONType} from "./compile/rules"
67export {JSONSchemaType} from "./types/json-schema"
68export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen"
69export {default as ValidationError} from "./runtime/validation_error"
70export {default as MissingRefError} from "./compile/ref_error"
Note: See TracBrowser for help on using the repository browser.