1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.checkMetadata = void 0;
|
4 | const util_1 = require("../../compile/util");
|
5 | const def = {
|
6 | keyword: "metadata",
|
7 | schemaType: "object",
|
8 | code(cxt) {
|
9 | checkMetadata(cxt);
|
10 | const { gen, schema, it } = cxt;
|
11 | if ((0, util_1.alwaysValidSchema)(it, schema))
|
12 | return;
|
13 | const valid = gen.name("valid");
|
14 | cxt.subschema({ keyword: "metadata", jtdMetadata: true }, valid);
|
15 | cxt.ok(valid);
|
16 | },
|
17 | };
|
18 | function checkMetadata({ it, keyword }, metadata) {
|
19 | if (it.jtdMetadata !== metadata) {
|
20 | throw new Error(`JTD: "${keyword}" cannot be used in this schema location`);
|
21 | }
|
22 | }
|
23 | exports.checkMetadata = checkMetadata;
|
24 | exports.default = def;
|
25 |
|
\ | No newline at end of file |