Last change
on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
899 bytes
|
Line | |
---|
1 | import type Ajv from "../../core"
|
---|
2 | import type {AnySchemaObject} from "../../types"
|
---|
3 | import * as metaSchema from "./schema.json"
|
---|
4 | import * as applicator from "./meta/applicator.json"
|
---|
5 | import * as content from "./meta/content.json"
|
---|
6 | import * as core from "./meta/core.json"
|
---|
7 | import * as format from "./meta/format.json"
|
---|
8 | import * as metadata from "./meta/meta-data.json"
|
---|
9 | import * as validation from "./meta/validation.json"
|
---|
10 |
|
---|
11 | const META_SUPPORT_DATA = ["/properties"]
|
---|
12 |
|
---|
13 | export default function addMetaSchema2019(this: Ajv, $data?: boolean): Ajv {
|
---|
14 | ;[
|
---|
15 | metaSchema,
|
---|
16 | applicator,
|
---|
17 | content,
|
---|
18 | core,
|
---|
19 | with$data(this, format),
|
---|
20 | metadata,
|
---|
21 | with$data(this, validation),
|
---|
22 | ].forEach((sch) => this.addMetaSchema(sch, undefined, false))
|
---|
23 | return this
|
---|
24 |
|
---|
25 | function with$data(ajv: Ajv, sch: AnySchemaObject): AnySchemaObject {
|
---|
26 | return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch
|
---|
27 | }
|
---|
28 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.