source: trip-planner-front/node_modules/ajv/lib/ajv.ts@ b738035

Last change on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[6a3a178]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
11class 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
35Object.defineProperty(exports, "__esModule", {value: true})
36
37export default Ajv
38
39export {
40 Format,
41 FormatDefinition,
42 AsyncFormatDefinition,
43 KeywordDefinition,
44 KeywordErrorDefinition,
45 CodeKeywordDefinition,
46 MacroKeywordDefinition,
47 FuncKeywordDefinition,
48 Vocabulary,
49 Schema,
50 SchemaObject,
51 AnySchemaObject,
52 AsyncSchema,
53 AnySchema,
54 ValidateFunction,
55 AsyncValidateFunction,
56 SchemaValidateFunction,
57 ErrorObject,
58 ErrorNoParams,
59} from "./types"
60
61export {Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions} from "./core"
62export {SchemaCxt, SchemaObjCxt} from "./compile"
63export {KeywordCxt} from "./compile/validate"
64export {DefinedError} from "./vocabularies/errors"
65export {JSONType} from "./compile/rules"
66export {JSONSchemaType} from "./types/json-schema"
67export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen"
Note: See TracBrowser for help on using the repository browser.