Delete 100 files via Git Manager GUI
This commit is contained in:
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"jtd.js","sourceRoot":"","sources":["../lib/jtd.ts"],"names":[],"mappings":";;;AAEA,iCAA8C;AAC9C,4CAA8C;AAC9C,kDAA6C;AAC7C,uDAAuD;AACvD,+CAA+C;AAG/C,MAAM,cAAc,GAAG,iBAAiB,CAAA;AA4BxC,MAAa,GAAI,SAAQ,cAAO;IAC9B,YAAY,OAAmB,EAAE;QAC/B,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,GAAG,EAAE,IAAI;SACV,CAAC,CAAA;IACJ,CAAC;IAED,gBAAgB;QACd,KAAK,CAAC,gBAAgB,EAAE,CAAA;QACxB,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,CAAA;IACnC,CAAC;IAED,qBAAqB;QACnB,KAAK,CAAC,qBAAqB,EAAE,CAAA;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAM;QAC3B,IAAI,CAAC,aAAa,CAAC,oBAAa,EAAE,cAAc,EAAE,KAAK,CAAC,CAAA;IAC1D,CAAC;IAED,WAAW;QACT,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW;YAC3B,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;IACzF,CAAC;IAMD,iBAAiB,CAAc,MAAoB;QACjD,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;QACnC,OAAO,GAAG,CAAC,SAAS,IAAI,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAA;IACtD,CAAC;IAMD,aAAa,CAAc,MAAoB;QAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;QACnC,OAAO,CAAC,GAAG,CAAC,KAAK,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|
|
||||||
"$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",
|
|
||||||
"description": "Meta-schema for $data reference (JSON AnySchema extension proposal)",
|
|
||||||
"type": "object",
|
|
||||||
"required": ["$data"],
|
|
||||||
"properties": {
|
|
||||||
"$data": {
|
|
||||||
"type": "string",
|
|
||||||
"anyOf": [{"format": "relative-json-pointer"}, {"format": "json-pointer"}]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"additionalProperties": false
|
|
||||||
}
|
|
||||||
-2
@@ -1,2 +0,0 @@
|
|||||||
import type Ajv from "../../core";
|
|
||||||
export default function addMetaSchema2019(this: Ajv, $data?: boolean): Ajv;
|
|
||||||
-28
@@ -1,28 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const metaSchema = require("./schema.json");
|
|
||||||
const applicator = require("./meta/applicator.json");
|
|
||||||
const content = require("./meta/content.json");
|
|
||||||
const core = require("./meta/core.json");
|
|
||||||
const format = require("./meta/format.json");
|
|
||||||
const metadata = require("./meta/meta-data.json");
|
|
||||||
const validation = require("./meta/validation.json");
|
|
||||||
const META_SUPPORT_DATA = ["/properties"];
|
|
||||||
function addMetaSchema2019($data) {
|
|
||||||
;
|
|
||||||
[
|
|
||||||
metaSchema,
|
|
||||||
applicator,
|
|
||||||
content,
|
|
||||||
core,
|
|
||||||
with$data(this, format),
|
|
||||||
metadata,
|
|
||||||
with$data(this, validation),
|
|
||||||
].forEach((sch) => this.addMetaSchema(sch, undefined, false));
|
|
||||||
return this;
|
|
||||||
function with$data(ajv, sch) {
|
|
||||||
return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.default = addMetaSchema2019;
|
|
||||||
//# sourceMappingURL=index.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/refs/json-schema-2019-09/index.ts"],"names":[],"mappings":";;AAEA,4CAA2C;AAC3C,qDAAoD;AACpD,+CAA8C;AAC9C,yCAAwC;AACxC,6CAA4C;AAC5C,kDAAiD;AACjD,qDAAoD;AAEpD,MAAM,iBAAiB,GAAG,CAAC,aAAa,CAAC,CAAA;AAEzC,SAAwB,iBAAiB,CAAY,KAAe;IAClE,CAAC;IAAA;QACC,UAAU;QACV,UAAU;QACV,OAAO;QACP,IAAI;QACJ,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;QACvB,QAAQ;QACR,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC;KAC5B,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAA;IAC7D,OAAO,IAAI,CAAA;IAEX,SAAS,SAAS,CAAC,GAAQ,EAAE,GAAoB;QAC/C,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;IAClE,CAAC;AACH,CAAC;AAfD,oCAeC"}
|
|
||||||
-53
@@ -1,53 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
|
||||||
"$id": "https://json-schema.org/draft/2019-09/meta/applicator",
|
|
||||||
"$vocabulary": {
|
|
||||||
"https://json-schema.org/draft/2019-09/vocab/applicator": true
|
|
||||||
},
|
|
||||||
"$recursiveAnchor": true,
|
|
||||||
|
|
||||||
"title": "Applicator vocabulary meta-schema",
|
|
||||||
"type": ["object", "boolean"],
|
|
||||||
"properties": {
|
|
||||||
"additionalItems": {"$recursiveRef": "#"},
|
|
||||||
"unevaluatedItems": {"$recursiveRef": "#"},
|
|
||||||
"items": {
|
|
||||||
"anyOf": [{"$recursiveRef": "#"}, {"$ref": "#/$defs/schemaArray"}]
|
|
||||||
},
|
|
||||||
"contains": {"$recursiveRef": "#"},
|
|
||||||
"additionalProperties": {"$recursiveRef": "#"},
|
|
||||||
"unevaluatedProperties": {"$recursiveRef": "#"},
|
|
||||||
"properties": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {"$recursiveRef": "#"},
|
|
||||||
"default": {}
|
|
||||||
},
|
|
||||||
"patternProperties": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {"$recursiveRef": "#"},
|
|
||||||
"propertyNames": {"format": "regex"},
|
|
||||||
"default": {}
|
|
||||||
},
|
|
||||||
"dependentSchemas": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"$recursiveRef": "#"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"propertyNames": {"$recursiveRef": "#"},
|
|
||||||
"if": {"$recursiveRef": "#"},
|
|
||||||
"then": {"$recursiveRef": "#"},
|
|
||||||
"else": {"$recursiveRef": "#"},
|
|
||||||
"allOf": {"$ref": "#/$defs/schemaArray"},
|
|
||||||
"anyOf": {"$ref": "#/$defs/schemaArray"},
|
|
||||||
"oneOf": {"$ref": "#/$defs/schemaArray"},
|
|
||||||
"not": {"$recursiveRef": "#"}
|
|
||||||
},
|
|
||||||
"$defs": {
|
|
||||||
"schemaArray": {
|
|
||||||
"type": "array",
|
|
||||||
"minItems": 1,
|
|
||||||
"items": {"$recursiveRef": "#"}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-17
@@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
|
||||||
"$id": "https://json-schema.org/draft/2019-09/meta/content",
|
|
||||||
"$vocabulary": {
|
|
||||||
"https://json-schema.org/draft/2019-09/vocab/content": true
|
|
||||||
},
|
|
||||||
"$recursiveAnchor": true,
|
|
||||||
|
|
||||||
"title": "Content vocabulary meta-schema",
|
|
||||||
|
|
||||||
"type": ["object", "boolean"],
|
|
||||||
"properties": {
|
|
||||||
"contentMediaType": {"type": "string"},
|
|
||||||
"contentEncoding": {"type": "string"},
|
|
||||||
"contentSchema": {"$recursiveRef": "#"}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-57
@@ -1,57 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
|
||||||
"$id": "https://json-schema.org/draft/2019-09/meta/core",
|
|
||||||
"$vocabulary": {
|
|
||||||
"https://json-schema.org/draft/2019-09/vocab/core": true
|
|
||||||
},
|
|
||||||
"$recursiveAnchor": true,
|
|
||||||
|
|
||||||
"title": "Core vocabulary meta-schema",
|
|
||||||
"type": ["object", "boolean"],
|
|
||||||
"properties": {
|
|
||||||
"$id": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "uri-reference",
|
|
||||||
"$comment": "Non-empty fragments not allowed.",
|
|
||||||
"pattern": "^[^#]*#?$"
|
|
||||||
},
|
|
||||||
"$schema": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "uri"
|
|
||||||
},
|
|
||||||
"$anchor": {
|
|
||||||
"type": "string",
|
|
||||||
"pattern": "^[A-Za-z][-A-Za-z0-9.:_]*$"
|
|
||||||
},
|
|
||||||
"$ref": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "uri-reference"
|
|
||||||
},
|
|
||||||
"$recursiveRef": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "uri-reference"
|
|
||||||
},
|
|
||||||
"$recursiveAnchor": {
|
|
||||||
"type": "boolean",
|
|
||||||
"default": false
|
|
||||||
},
|
|
||||||
"$vocabulary": {
|
|
||||||
"type": "object",
|
|
||||||
"propertyNames": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "uri"
|
|
||||||
},
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"$comment": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"$defs": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {"$recursiveRef": "#"},
|
|
||||||
"default": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-14
@@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
|
||||||
"$id": "https://json-schema.org/draft/2019-09/meta/format",
|
|
||||||
"$vocabulary": {
|
|
||||||
"https://json-schema.org/draft/2019-09/vocab/format": true
|
|
||||||
},
|
|
||||||
"$recursiveAnchor": true,
|
|
||||||
|
|
||||||
"title": "Format vocabulary meta-schema",
|
|
||||||
"type": ["object", "boolean"],
|
|
||||||
"properties": {
|
|
||||||
"format": {"type": "string"}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-37
@@ -1,37 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
|
||||||
"$id": "https://json-schema.org/draft/2019-09/meta/meta-data",
|
|
||||||
"$vocabulary": {
|
|
||||||
"https://json-schema.org/draft/2019-09/vocab/meta-data": true
|
|
||||||
},
|
|
||||||
"$recursiveAnchor": true,
|
|
||||||
|
|
||||||
"title": "Meta-data vocabulary meta-schema",
|
|
||||||
|
|
||||||
"type": ["object", "boolean"],
|
|
||||||
"properties": {
|
|
||||||
"title": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"default": true,
|
|
||||||
"deprecated": {
|
|
||||||
"type": "boolean",
|
|
||||||
"default": false
|
|
||||||
},
|
|
||||||
"readOnly": {
|
|
||||||
"type": "boolean",
|
|
||||||
"default": false
|
|
||||||
},
|
|
||||||
"writeOnly": {
|
|
||||||
"type": "boolean",
|
|
||||||
"default": false
|
|
||||||
},
|
|
||||||
"examples": {
|
|
||||||
"type": "array",
|
|
||||||
"items": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-90
@@ -1,90 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
|
||||||
"$id": "https://json-schema.org/draft/2019-09/meta/validation",
|
|
||||||
"$vocabulary": {
|
|
||||||
"https://json-schema.org/draft/2019-09/vocab/validation": true
|
|
||||||
},
|
|
||||||
"$recursiveAnchor": true,
|
|
||||||
|
|
||||||
"title": "Validation vocabulary meta-schema",
|
|
||||||
"type": ["object", "boolean"],
|
|
||||||
"properties": {
|
|
||||||
"multipleOf": {
|
|
||||||
"type": "number",
|
|
||||||
"exclusiveMinimum": 0
|
|
||||||
},
|
|
||||||
"maximum": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"exclusiveMaximum": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"minimum": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"exclusiveMinimum": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"maxLength": {"$ref": "#/$defs/nonNegativeInteger"},
|
|
||||||
"minLength": {"$ref": "#/$defs/nonNegativeIntegerDefault0"},
|
|
||||||
"pattern": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "regex"
|
|
||||||
},
|
|
||||||
"maxItems": {"$ref": "#/$defs/nonNegativeInteger"},
|
|
||||||
"minItems": {"$ref": "#/$defs/nonNegativeIntegerDefault0"},
|
|
||||||
"uniqueItems": {
|
|
||||||
"type": "boolean",
|
|
||||||
"default": false
|
|
||||||
},
|
|
||||||
"maxContains": {"$ref": "#/$defs/nonNegativeInteger"},
|
|
||||||
"minContains": {
|
|
||||||
"$ref": "#/$defs/nonNegativeInteger",
|
|
||||||
"default": 1
|
|
||||||
},
|
|
||||||
"maxProperties": {"$ref": "#/$defs/nonNegativeInteger"},
|
|
||||||
"minProperties": {"$ref": "#/$defs/nonNegativeIntegerDefault0"},
|
|
||||||
"required": {"$ref": "#/$defs/stringArray"},
|
|
||||||
"dependentRequired": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"$ref": "#/$defs/stringArray"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"const": true,
|
|
||||||
"enum": {
|
|
||||||
"type": "array",
|
|
||||||
"items": true
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
"anyOf": [
|
|
||||||
{"$ref": "#/$defs/simpleTypes"},
|
|
||||||
{
|
|
||||||
"type": "array",
|
|
||||||
"items": {"$ref": "#/$defs/simpleTypes"},
|
|
||||||
"minItems": 1,
|
|
||||||
"uniqueItems": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"$defs": {
|
|
||||||
"nonNegativeInteger": {
|
|
||||||
"type": "integer",
|
|
||||||
"minimum": 0
|
|
||||||
},
|
|
||||||
"nonNegativeIntegerDefault0": {
|
|
||||||
"$ref": "#/$defs/nonNegativeInteger",
|
|
||||||
"default": 0
|
|
||||||
},
|
|
||||||
"simpleTypes": {
|
|
||||||
"enum": ["array", "boolean", "integer", "null", "number", "object", "string"]
|
|
||||||
},
|
|
||||||
"stringArray": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {"type": "string"},
|
|
||||||
"uniqueItems": true,
|
|
||||||
"default": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-39
@@ -1,39 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
|
||||||
"$id": "https://json-schema.org/draft/2019-09/schema",
|
|
||||||
"$vocabulary": {
|
|
||||||
"https://json-schema.org/draft/2019-09/vocab/core": true,
|
|
||||||
"https://json-schema.org/draft/2019-09/vocab/applicator": true,
|
|
||||||
"https://json-schema.org/draft/2019-09/vocab/validation": true,
|
|
||||||
"https://json-schema.org/draft/2019-09/vocab/meta-data": true,
|
|
||||||
"https://json-schema.org/draft/2019-09/vocab/format": false,
|
|
||||||
"https://json-schema.org/draft/2019-09/vocab/content": true
|
|
||||||
},
|
|
||||||
"$recursiveAnchor": true,
|
|
||||||
|
|
||||||
"title": "Core and Validation specifications meta-schema",
|
|
||||||
"allOf": [
|
|
||||||
{"$ref": "meta/core"},
|
|
||||||
{"$ref": "meta/applicator"},
|
|
||||||
{"$ref": "meta/validation"},
|
|
||||||
{"$ref": "meta/meta-data"},
|
|
||||||
{"$ref": "meta/format"},
|
|
||||||
{"$ref": "meta/content"}
|
|
||||||
],
|
|
||||||
"type": ["object", "boolean"],
|
|
||||||
"properties": {
|
|
||||||
"definitions": {
|
|
||||||
"$comment": "While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {"$recursiveRef": "#"},
|
|
||||||
"default": {}
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"$comment": "\"dependencies\" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to \"dependentSchemas\" and \"dependentRequired\"",
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"anyOf": [{"$recursiveRef": "#"}, {"$ref": "meta/validation#/$defs/stringArray"}]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-2
@@ -1,2 +0,0 @@
|
|||||||
import type Ajv from "../../core";
|
|
||||||
export default function addMetaSchema2020(this: Ajv, $data?: boolean): Ajv;
|
|
||||||
-30
@@ -1,30 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const metaSchema = require("./schema.json");
|
|
||||||
const applicator = require("./meta/applicator.json");
|
|
||||||
const unevaluated = require("./meta/unevaluated.json");
|
|
||||||
const content = require("./meta/content.json");
|
|
||||||
const core = require("./meta/core.json");
|
|
||||||
const format = require("./meta/format-annotation.json");
|
|
||||||
const metadata = require("./meta/meta-data.json");
|
|
||||||
const validation = require("./meta/validation.json");
|
|
||||||
const META_SUPPORT_DATA = ["/properties"];
|
|
||||||
function addMetaSchema2020($data) {
|
|
||||||
;
|
|
||||||
[
|
|
||||||
metaSchema,
|
|
||||||
applicator,
|
|
||||||
unevaluated,
|
|
||||||
content,
|
|
||||||
core,
|
|
||||||
with$data(this, format),
|
|
||||||
metadata,
|
|
||||||
with$data(this, validation),
|
|
||||||
].forEach((sch) => this.addMetaSchema(sch, undefined, false));
|
|
||||||
return this;
|
|
||||||
function with$data(ajv, sch) {
|
|
||||||
return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.default = addMetaSchema2020;
|
|
||||||
//# sourceMappingURL=index.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/refs/json-schema-2020-12/index.ts"],"names":[],"mappings":";;AAEA,4CAA2C;AAC3C,qDAAoD;AACpD,uDAAsD;AACtD,+CAA8C;AAC9C,yCAAwC;AACxC,wDAAuD;AACvD,kDAAiD;AACjD,qDAAoD;AAEpD,MAAM,iBAAiB,GAAG,CAAC,aAAa,CAAC,CAAA;AAEzC,SAAwB,iBAAiB,CAAY,KAAe;IAClE,CAAC;IAAA;QACC,UAAU;QACV,UAAU;QACV,WAAW;QACX,OAAO;QACP,IAAI;QACJ,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;QACvB,QAAQ;QACR,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC;KAC5B,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAA;IAC7D,OAAO,IAAI,CAAA;IAEX,SAAS,SAAS,CAAC,GAAQ,EAAE,GAAoB;QAC/C,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;IAClE,CAAC;AACH,CAAC;AAhBD,oCAgBC"}
|
|
||||||
-48
@@ -1,48 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
||||||
"$id": "https://json-schema.org/draft/2020-12/meta/applicator",
|
|
||||||
"$vocabulary": {
|
|
||||||
"https://json-schema.org/draft/2020-12/vocab/applicator": true
|
|
||||||
},
|
|
||||||
"$dynamicAnchor": "meta",
|
|
||||||
|
|
||||||
"title": "Applicator vocabulary meta-schema",
|
|
||||||
"type": ["object", "boolean"],
|
|
||||||
"properties": {
|
|
||||||
"prefixItems": {"$ref": "#/$defs/schemaArray"},
|
|
||||||
"items": {"$dynamicRef": "#meta"},
|
|
||||||
"contains": {"$dynamicRef": "#meta"},
|
|
||||||
"additionalProperties": {"$dynamicRef": "#meta"},
|
|
||||||
"properties": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {"$dynamicRef": "#meta"},
|
|
||||||
"default": {}
|
|
||||||
},
|
|
||||||
"patternProperties": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {"$dynamicRef": "#meta"},
|
|
||||||
"propertyNames": {"format": "regex"},
|
|
||||||
"default": {}
|
|
||||||
},
|
|
||||||
"dependentSchemas": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {"$dynamicRef": "#meta"},
|
|
||||||
"default": {}
|
|
||||||
},
|
|
||||||
"propertyNames": {"$dynamicRef": "#meta"},
|
|
||||||
"if": {"$dynamicRef": "#meta"},
|
|
||||||
"then": {"$dynamicRef": "#meta"},
|
|
||||||
"else": {"$dynamicRef": "#meta"},
|
|
||||||
"allOf": {"$ref": "#/$defs/schemaArray"},
|
|
||||||
"anyOf": {"$ref": "#/$defs/schemaArray"},
|
|
||||||
"oneOf": {"$ref": "#/$defs/schemaArray"},
|
|
||||||
"not": {"$dynamicRef": "#meta"}
|
|
||||||
},
|
|
||||||
"$defs": {
|
|
||||||
"schemaArray": {
|
|
||||||
"type": "array",
|
|
||||||
"minItems": 1,
|
|
||||||
"items": {"$dynamicRef": "#meta"}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-17
@@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
||||||
"$id": "https://json-schema.org/draft/2020-12/meta/content",
|
|
||||||
"$vocabulary": {
|
|
||||||
"https://json-schema.org/draft/2020-12/vocab/content": true
|
|
||||||
},
|
|
||||||
"$dynamicAnchor": "meta",
|
|
||||||
|
|
||||||
"title": "Content vocabulary meta-schema",
|
|
||||||
|
|
||||||
"type": ["object", "boolean"],
|
|
||||||
"properties": {
|
|
||||||
"contentEncoding": {"type": "string"},
|
|
||||||
"contentMediaType": {"type": "string"},
|
|
||||||
"contentSchema": {"$dynamicRef": "#meta"}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-51
@@ -1,51 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
||||||
"$id": "https://json-schema.org/draft/2020-12/meta/core",
|
|
||||||
"$vocabulary": {
|
|
||||||
"https://json-schema.org/draft/2020-12/vocab/core": true
|
|
||||||
},
|
|
||||||
"$dynamicAnchor": "meta",
|
|
||||||
|
|
||||||
"title": "Core vocabulary meta-schema",
|
|
||||||
"type": ["object", "boolean"],
|
|
||||||
"properties": {
|
|
||||||
"$id": {
|
|
||||||
"$ref": "#/$defs/uriReferenceString",
|
|
||||||
"$comment": "Non-empty fragments not allowed.",
|
|
||||||
"pattern": "^[^#]*#?$"
|
|
||||||
},
|
|
||||||
"$schema": {"$ref": "#/$defs/uriString"},
|
|
||||||
"$ref": {"$ref": "#/$defs/uriReferenceString"},
|
|
||||||
"$anchor": {"$ref": "#/$defs/anchorString"},
|
|
||||||
"$dynamicRef": {"$ref": "#/$defs/uriReferenceString"},
|
|
||||||
"$dynamicAnchor": {"$ref": "#/$defs/anchorString"},
|
|
||||||
"$vocabulary": {
|
|
||||||
"type": "object",
|
|
||||||
"propertyNames": {"$ref": "#/$defs/uriString"},
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"$comment": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"$defs": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {"$dynamicRef": "#meta"}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"$defs": {
|
|
||||||
"anchorString": {
|
|
||||||
"type": "string",
|
|
||||||
"pattern": "^[A-Za-z_][-A-Za-z0-9._]*$"
|
|
||||||
},
|
|
||||||
"uriString": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "uri"
|
|
||||||
},
|
|
||||||
"uriReferenceString": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "uri-reference"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-14
@@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
||||||
"$id": "https://json-schema.org/draft/2020-12/meta/format-annotation",
|
|
||||||
"$vocabulary": {
|
|
||||||
"https://json-schema.org/draft/2020-12/vocab/format-annotation": true
|
|
||||||
},
|
|
||||||
"$dynamicAnchor": "meta",
|
|
||||||
|
|
||||||
"title": "Format vocabulary meta-schema for annotation results",
|
|
||||||
"type": ["object", "boolean"],
|
|
||||||
"properties": {
|
|
||||||
"format": {"type": "string"}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-37
@@ -1,37 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
||||||
"$id": "https://json-schema.org/draft/2020-12/meta/meta-data",
|
|
||||||
"$vocabulary": {
|
|
||||||
"https://json-schema.org/draft/2020-12/vocab/meta-data": true
|
|
||||||
},
|
|
||||||
"$dynamicAnchor": "meta",
|
|
||||||
|
|
||||||
"title": "Meta-data vocabulary meta-schema",
|
|
||||||
|
|
||||||
"type": ["object", "boolean"],
|
|
||||||
"properties": {
|
|
||||||
"title": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"default": true,
|
|
||||||
"deprecated": {
|
|
||||||
"type": "boolean",
|
|
||||||
"default": false
|
|
||||||
},
|
|
||||||
"readOnly": {
|
|
||||||
"type": "boolean",
|
|
||||||
"default": false
|
|
||||||
},
|
|
||||||
"writeOnly": {
|
|
||||||
"type": "boolean",
|
|
||||||
"default": false
|
|
||||||
},
|
|
||||||
"examples": {
|
|
||||||
"type": "array",
|
|
||||||
"items": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-15
@@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
||||||
"$id": "https://json-schema.org/draft/2020-12/meta/unevaluated",
|
|
||||||
"$vocabulary": {
|
|
||||||
"https://json-schema.org/draft/2020-12/vocab/unevaluated": true
|
|
||||||
},
|
|
||||||
"$dynamicAnchor": "meta",
|
|
||||||
|
|
||||||
"title": "Unevaluated applicator vocabulary meta-schema",
|
|
||||||
"type": ["object", "boolean"],
|
|
||||||
"properties": {
|
|
||||||
"unevaluatedItems": {"$dynamicRef": "#meta"},
|
|
||||||
"unevaluatedProperties": {"$dynamicRef": "#meta"}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-90
@@ -1,90 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
||||||
"$id": "https://json-schema.org/draft/2020-12/meta/validation",
|
|
||||||
"$vocabulary": {
|
|
||||||
"https://json-schema.org/draft/2020-12/vocab/validation": true
|
|
||||||
},
|
|
||||||
"$dynamicAnchor": "meta",
|
|
||||||
|
|
||||||
"title": "Validation vocabulary meta-schema",
|
|
||||||
"type": ["object", "boolean"],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"anyOf": [
|
|
||||||
{"$ref": "#/$defs/simpleTypes"},
|
|
||||||
{
|
|
||||||
"type": "array",
|
|
||||||
"items": {"$ref": "#/$defs/simpleTypes"},
|
|
||||||
"minItems": 1,
|
|
||||||
"uniqueItems": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"const": true,
|
|
||||||
"enum": {
|
|
||||||
"type": "array",
|
|
||||||
"items": true
|
|
||||||
},
|
|
||||||
"multipleOf": {
|
|
||||||
"type": "number",
|
|
||||||
"exclusiveMinimum": 0
|
|
||||||
},
|
|
||||||
"maximum": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"exclusiveMaximum": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"minimum": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"exclusiveMinimum": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"maxLength": {"$ref": "#/$defs/nonNegativeInteger"},
|
|
||||||
"minLength": {"$ref": "#/$defs/nonNegativeIntegerDefault0"},
|
|
||||||
"pattern": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "regex"
|
|
||||||
},
|
|
||||||
"maxItems": {"$ref": "#/$defs/nonNegativeInteger"},
|
|
||||||
"minItems": {"$ref": "#/$defs/nonNegativeIntegerDefault0"},
|
|
||||||
"uniqueItems": {
|
|
||||||
"type": "boolean",
|
|
||||||
"default": false
|
|
||||||
},
|
|
||||||
"maxContains": {"$ref": "#/$defs/nonNegativeInteger"},
|
|
||||||
"minContains": {
|
|
||||||
"$ref": "#/$defs/nonNegativeInteger",
|
|
||||||
"default": 1
|
|
||||||
},
|
|
||||||
"maxProperties": {"$ref": "#/$defs/nonNegativeInteger"},
|
|
||||||
"minProperties": {"$ref": "#/$defs/nonNegativeIntegerDefault0"},
|
|
||||||
"required": {"$ref": "#/$defs/stringArray"},
|
|
||||||
"dependentRequired": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"$ref": "#/$defs/stringArray"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"$defs": {
|
|
||||||
"nonNegativeInteger": {
|
|
||||||
"type": "integer",
|
|
||||||
"minimum": 0
|
|
||||||
},
|
|
||||||
"nonNegativeIntegerDefault0": {
|
|
||||||
"$ref": "#/$defs/nonNegativeInteger",
|
|
||||||
"default": 0
|
|
||||||
},
|
|
||||||
"simpleTypes": {
|
|
||||||
"enum": ["array", "boolean", "integer", "null", "number", "object", "string"]
|
|
||||||
},
|
|
||||||
"stringArray": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {"type": "string"},
|
|
||||||
"uniqueItems": true,
|
|
||||||
"default": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-55
@@ -1,55 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
||||||
"$id": "https://json-schema.org/draft/2020-12/schema",
|
|
||||||
"$vocabulary": {
|
|
||||||
"https://json-schema.org/draft/2020-12/vocab/core": true,
|
|
||||||
"https://json-schema.org/draft/2020-12/vocab/applicator": true,
|
|
||||||
"https://json-schema.org/draft/2020-12/vocab/unevaluated": true,
|
|
||||||
"https://json-schema.org/draft/2020-12/vocab/validation": true,
|
|
||||||
"https://json-schema.org/draft/2020-12/vocab/meta-data": true,
|
|
||||||
"https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
|
|
||||||
"https://json-schema.org/draft/2020-12/vocab/content": true
|
|
||||||
},
|
|
||||||
"$dynamicAnchor": "meta",
|
|
||||||
|
|
||||||
"title": "Core and Validation specifications meta-schema",
|
|
||||||
"allOf": [
|
|
||||||
{"$ref": "meta/core"},
|
|
||||||
{"$ref": "meta/applicator"},
|
|
||||||
{"$ref": "meta/unevaluated"},
|
|
||||||
{"$ref": "meta/validation"},
|
|
||||||
{"$ref": "meta/meta-data"},
|
|
||||||
{"$ref": "meta/format-annotation"},
|
|
||||||
{"$ref": "meta/content"}
|
|
||||||
],
|
|
||||||
"type": ["object", "boolean"],
|
|
||||||
"$comment": "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",
|
|
||||||
"properties": {
|
|
||||||
"definitions": {
|
|
||||||
"$comment": "\"definitions\" has been replaced by \"$defs\".",
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {"$dynamicRef": "#meta"},
|
|
||||||
"deprecated": true,
|
|
||||||
"default": {}
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"$comment": "\"dependencies\" has been split and replaced by \"dependentSchemas\" and \"dependentRequired\" in order to serve their differing semantics.",
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"anyOf": [{"$dynamicRef": "#meta"}, {"$ref": "meta/validation#/$defs/stringArray"}]
|
|
||||||
},
|
|
||||||
"deprecated": true,
|
|
||||||
"default": {}
|
|
||||||
},
|
|
||||||
"$recursiveAnchor": {
|
|
||||||
"$comment": "\"$recursiveAnchor\" has been replaced by \"$dynamicAnchor\".",
|
|
||||||
"$ref": "meta/core#/$defs/anchorString",
|
|
||||||
"deprecated": true
|
|
||||||
},
|
|
||||||
"$recursiveRef": {
|
|
||||||
"$comment": "\"$recursiveRef\" has been replaced by \"$dynamicRef\".",
|
|
||||||
"$ref": "meta/core#/$defs/uriReferenceString",
|
|
||||||
"deprecated": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-137
@@ -1,137 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
||||||
"$id": "http://json-schema.org/draft-06/schema#",
|
|
||||||
"title": "Core schema meta-schema",
|
|
||||||
"definitions": {
|
|
||||||
"schemaArray": {
|
|
||||||
"type": "array",
|
|
||||||
"minItems": 1,
|
|
||||||
"items": {"$ref": "#"}
|
|
||||||
},
|
|
||||||
"nonNegativeInteger": {
|
|
||||||
"type": "integer",
|
|
||||||
"minimum": 0
|
|
||||||
},
|
|
||||||
"nonNegativeIntegerDefault0": {
|
|
||||||
"allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}]
|
|
||||||
},
|
|
||||||
"simpleTypes": {
|
|
||||||
"enum": ["array", "boolean", "integer", "null", "number", "object", "string"]
|
|
||||||
},
|
|
||||||
"stringArray": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {"type": "string"},
|
|
||||||
"uniqueItems": true,
|
|
||||||
"default": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": ["object", "boolean"],
|
|
||||||
"properties": {
|
|
||||||
"$id": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "uri-reference"
|
|
||||||
},
|
|
||||||
"$schema": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "uri"
|
|
||||||
},
|
|
||||||
"$ref": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "uri-reference"
|
|
||||||
},
|
|
||||||
"title": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"default": {},
|
|
||||||
"examples": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {}
|
|
||||||
},
|
|
||||||
"multipleOf": {
|
|
||||||
"type": "number",
|
|
||||||
"exclusiveMinimum": 0
|
|
||||||
},
|
|
||||||
"maximum": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"exclusiveMaximum": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"minimum": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"exclusiveMinimum": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"maxLength": {"$ref": "#/definitions/nonNegativeInteger"},
|
|
||||||
"minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"},
|
|
||||||
"pattern": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "regex"
|
|
||||||
},
|
|
||||||
"additionalItems": {"$ref": "#"},
|
|
||||||
"items": {
|
|
||||||
"anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}],
|
|
||||||
"default": {}
|
|
||||||
},
|
|
||||||
"maxItems": {"$ref": "#/definitions/nonNegativeInteger"},
|
|
||||||
"minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"},
|
|
||||||
"uniqueItems": {
|
|
||||||
"type": "boolean",
|
|
||||||
"default": false
|
|
||||||
},
|
|
||||||
"contains": {"$ref": "#"},
|
|
||||||
"maxProperties": {"$ref": "#/definitions/nonNegativeInteger"},
|
|
||||||
"minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"},
|
|
||||||
"required": {"$ref": "#/definitions/stringArray"},
|
|
||||||
"additionalProperties": {"$ref": "#"},
|
|
||||||
"definitions": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {"$ref": "#"},
|
|
||||||
"default": {}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {"$ref": "#"},
|
|
||||||
"default": {}
|
|
||||||
},
|
|
||||||
"patternProperties": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {"$ref": "#"},
|
|
||||||
"default": {}
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"propertyNames": {"$ref": "#"},
|
|
||||||
"const": {},
|
|
||||||
"enum": {
|
|
||||||
"type": "array",
|
|
||||||
"minItems": 1,
|
|
||||||
"uniqueItems": true
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
"anyOf": [
|
|
||||||
{"$ref": "#/definitions/simpleTypes"},
|
|
||||||
{
|
|
||||||
"type": "array",
|
|
||||||
"items": {"$ref": "#/definitions/simpleTypes"},
|
|
||||||
"minItems": 1,
|
|
||||||
"uniqueItems": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"format": {"type": "string"},
|
|
||||||
"allOf": {"$ref": "#/definitions/schemaArray"},
|
|
||||||
"anyOf": {"$ref": "#/definitions/schemaArray"},
|
|
||||||
"oneOf": {"$ref": "#/definitions/schemaArray"},
|
|
||||||
"not": {"$ref": "#"}
|
|
||||||
},
|
|
||||||
"default": {}
|
|
||||||
}
|
|
||||||
-151
@@ -1,151 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
||||||
"$id": "http://json-schema.org/draft-07/schema#",
|
|
||||||
"title": "Core schema meta-schema",
|
|
||||||
"definitions": {
|
|
||||||
"schemaArray": {
|
|
||||||
"type": "array",
|
|
||||||
"minItems": 1,
|
|
||||||
"items": {"$ref": "#"}
|
|
||||||
},
|
|
||||||
"nonNegativeInteger": {
|
|
||||||
"type": "integer",
|
|
||||||
"minimum": 0
|
|
||||||
},
|
|
||||||
"nonNegativeIntegerDefault0": {
|
|
||||||
"allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}]
|
|
||||||
},
|
|
||||||
"simpleTypes": {
|
|
||||||
"enum": ["array", "boolean", "integer", "null", "number", "object", "string"]
|
|
||||||
},
|
|
||||||
"stringArray": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {"type": "string"},
|
|
||||||
"uniqueItems": true,
|
|
||||||
"default": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": ["object", "boolean"],
|
|
||||||
"properties": {
|
|
||||||
"$id": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "uri-reference"
|
|
||||||
},
|
|
||||||
"$schema": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "uri"
|
|
||||||
},
|
|
||||||
"$ref": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "uri-reference"
|
|
||||||
},
|
|
||||||
"$comment": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"title": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"default": true,
|
|
||||||
"readOnly": {
|
|
||||||
"type": "boolean",
|
|
||||||
"default": false
|
|
||||||
},
|
|
||||||
"examples": {
|
|
||||||
"type": "array",
|
|
||||||
"items": true
|
|
||||||
},
|
|
||||||
"multipleOf": {
|
|
||||||
"type": "number",
|
|
||||||
"exclusiveMinimum": 0
|
|
||||||
},
|
|
||||||
"maximum": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"exclusiveMaximum": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"minimum": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"exclusiveMinimum": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"maxLength": {"$ref": "#/definitions/nonNegativeInteger"},
|
|
||||||
"minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"},
|
|
||||||
"pattern": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "regex"
|
|
||||||
},
|
|
||||||
"additionalItems": {"$ref": "#"},
|
|
||||||
"items": {
|
|
||||||
"anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}],
|
|
||||||
"default": true
|
|
||||||
},
|
|
||||||
"maxItems": {"$ref": "#/definitions/nonNegativeInteger"},
|
|
||||||
"minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"},
|
|
||||||
"uniqueItems": {
|
|
||||||
"type": "boolean",
|
|
||||||
"default": false
|
|
||||||
},
|
|
||||||
"contains": {"$ref": "#"},
|
|
||||||
"maxProperties": {"$ref": "#/definitions/nonNegativeInteger"},
|
|
||||||
"minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"},
|
|
||||||
"required": {"$ref": "#/definitions/stringArray"},
|
|
||||||
"additionalProperties": {"$ref": "#"},
|
|
||||||
"definitions": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {"$ref": "#"},
|
|
||||||
"default": {}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {"$ref": "#"},
|
|
||||||
"default": {}
|
|
||||||
},
|
|
||||||
"patternProperties": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {"$ref": "#"},
|
|
||||||
"propertyNames": {"format": "regex"},
|
|
||||||
"default": {}
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"propertyNames": {"$ref": "#"},
|
|
||||||
"const": true,
|
|
||||||
"enum": {
|
|
||||||
"type": "array",
|
|
||||||
"items": true,
|
|
||||||
"minItems": 1,
|
|
||||||
"uniqueItems": true
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
"anyOf": [
|
|
||||||
{"$ref": "#/definitions/simpleTypes"},
|
|
||||||
{
|
|
||||||
"type": "array",
|
|
||||||
"items": {"$ref": "#/definitions/simpleTypes"},
|
|
||||||
"minItems": 1,
|
|
||||||
"uniqueItems": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"format": {"type": "string"},
|
|
||||||
"contentMediaType": {"type": "string"},
|
|
||||||
"contentEncoding": {"type": "string"},
|
|
||||||
"if": {"$ref": "#"},
|
|
||||||
"then": {"$ref": "#"},
|
|
||||||
"else": {"$ref": "#"},
|
|
||||||
"allOf": {"$ref": "#/definitions/schemaArray"},
|
|
||||||
"anyOf": {"$ref": "#/definitions/schemaArray"},
|
|
||||||
"oneOf": {"$ref": "#/definitions/schemaArray"},
|
|
||||||
"not": {"$ref": "#"}
|
|
||||||
},
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
-88
@@ -1,88 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
||||||
"$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/json-schema-secure.json#",
|
|
||||||
"title": "Meta-schema for the security assessment of JSON Schemas",
|
|
||||||
"description": "If a JSON AnySchema fails validation against this meta-schema, it may be unsafe to validate untrusted data",
|
|
||||||
"definitions": {
|
|
||||||
"schemaArray": {
|
|
||||||
"type": "array",
|
|
||||||
"minItems": 1,
|
|
||||||
"items": {"$ref": "#"}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"patternProperties": {
|
|
||||||
"description": "prevent slow validation of large property names",
|
|
||||||
"required": ["propertyNames"],
|
|
||||||
"properties": {
|
|
||||||
"propertyNames": {
|
|
||||||
"required": ["maxLength"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"uniqueItems": {
|
|
||||||
"description": "prevent slow validation of large non-scalar arrays",
|
|
||||||
"if": {
|
|
||||||
"properties": {
|
|
||||||
"uniqueItems": {"const": true},
|
|
||||||
"items": {
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"anyOf": [
|
|
||||||
{
|
|
||||||
"enum": ["object", "array"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "array",
|
|
||||||
"contains": {"enum": ["object", "array"]}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"then": {
|
|
||||||
"required": ["maxItems"]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"pattern": {
|
|
||||||
"description": "prevent slow pattern matching of large strings",
|
|
||||||
"required": ["maxLength"]
|
|
||||||
},
|
|
||||||
"format": {
|
|
||||||
"description": "prevent slow format validation of large strings",
|
|
||||||
"required": ["maxLength"]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"additionalItems": {"$ref": "#"},
|
|
||||||
"additionalProperties": {"$ref": "#"},
|
|
||||||
"dependencies": {
|
|
||||||
"additionalProperties": {
|
|
||||||
"anyOf": [{"type": "array"}, {"$ref": "#"}]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"items": {
|
|
||||||
"anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}]
|
|
||||||
},
|
|
||||||
"definitions": {
|
|
||||||
"additionalProperties": {"$ref": "#"}
|
|
||||||
},
|
|
||||||
"patternProperties": {
|
|
||||||
"additionalProperties": {"$ref": "#"}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"additionalProperties": {"$ref": "#"}
|
|
||||||
},
|
|
||||||
"if": {"$ref": "#"},
|
|
||||||
"then": {"$ref": "#"},
|
|
||||||
"else": {"$ref": "#"},
|
|
||||||
"allOf": {"$ref": "#/definitions/schemaArray"},
|
|
||||||
"anyOf": {"$ref": "#/definitions/schemaArray"},
|
|
||||||
"oneOf": {"$ref": "#/definitions/schemaArray"},
|
|
||||||
"not": {"$ref": "#"},
|
|
||||||
"contains": {"$ref": "#"},
|
|
||||||
"propertyNames": {"$ref": "#"}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
import { SchemaObject } from "../types";
|
|
||||||
declare const jtdMetaSchema: SchemaObject;
|
|
||||||
export default jtdMetaSchema;
|
|
||||||
-118
@@ -1,118 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const shared = (root) => {
|
|
||||||
const sch = {
|
|
||||||
nullable: { type: "boolean" },
|
|
||||||
metadata: {
|
|
||||||
optionalProperties: {
|
|
||||||
union: { elements: { ref: "schema" } },
|
|
||||||
},
|
|
||||||
additionalProperties: true,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
if (root)
|
|
||||||
sch.definitions = { values: { ref: "schema" } };
|
|
||||||
return sch;
|
|
||||||
};
|
|
||||||
const emptyForm = (root) => ({
|
|
||||||
optionalProperties: shared(root),
|
|
||||||
});
|
|
||||||
const refForm = (root) => ({
|
|
||||||
properties: {
|
|
||||||
ref: { type: "string" },
|
|
||||||
},
|
|
||||||
optionalProperties: shared(root),
|
|
||||||
});
|
|
||||||
const typeForm = (root) => ({
|
|
||||||
properties: {
|
|
||||||
type: {
|
|
||||||
enum: [
|
|
||||||
"boolean",
|
|
||||||
"timestamp",
|
|
||||||
"string",
|
|
||||||
"float32",
|
|
||||||
"float64",
|
|
||||||
"int8",
|
|
||||||
"uint8",
|
|
||||||
"int16",
|
|
||||||
"uint16",
|
|
||||||
"int32",
|
|
||||||
"uint32",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
optionalProperties: shared(root),
|
|
||||||
});
|
|
||||||
const enumForm = (root) => ({
|
|
||||||
properties: {
|
|
||||||
enum: { elements: { type: "string" } },
|
|
||||||
},
|
|
||||||
optionalProperties: shared(root),
|
|
||||||
});
|
|
||||||
const elementsForm = (root) => ({
|
|
||||||
properties: {
|
|
||||||
elements: { ref: "schema" },
|
|
||||||
},
|
|
||||||
optionalProperties: shared(root),
|
|
||||||
});
|
|
||||||
const propertiesForm = (root) => ({
|
|
||||||
properties: {
|
|
||||||
properties: { values: { ref: "schema" } },
|
|
||||||
},
|
|
||||||
optionalProperties: {
|
|
||||||
optionalProperties: { values: { ref: "schema" } },
|
|
||||||
additionalProperties: { type: "boolean" },
|
|
||||||
...shared(root),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const optionalPropertiesForm = (root) => ({
|
|
||||||
properties: {
|
|
||||||
optionalProperties: { values: { ref: "schema" } },
|
|
||||||
},
|
|
||||||
optionalProperties: {
|
|
||||||
additionalProperties: { type: "boolean" },
|
|
||||||
...shared(root),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const discriminatorForm = (root) => ({
|
|
||||||
properties: {
|
|
||||||
discriminator: { type: "string" },
|
|
||||||
mapping: {
|
|
||||||
values: {
|
|
||||||
metadata: {
|
|
||||||
union: [propertiesForm(false), optionalPropertiesForm(false)],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
optionalProperties: shared(root),
|
|
||||||
});
|
|
||||||
const valuesForm = (root) => ({
|
|
||||||
properties: {
|
|
||||||
values: { ref: "schema" },
|
|
||||||
},
|
|
||||||
optionalProperties: shared(root),
|
|
||||||
});
|
|
||||||
const schema = (root) => ({
|
|
||||||
metadata: {
|
|
||||||
union: [
|
|
||||||
emptyForm,
|
|
||||||
refForm,
|
|
||||||
typeForm,
|
|
||||||
enumForm,
|
|
||||||
elementsForm,
|
|
||||||
propertiesForm,
|
|
||||||
optionalPropertiesForm,
|
|
||||||
discriminatorForm,
|
|
||||||
valuesForm,
|
|
||||||
].map((s) => s(root)),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const jtdMetaSchema = {
|
|
||||||
definitions: {
|
|
||||||
schema: schema(false),
|
|
||||||
},
|
|
||||||
...schema(true),
|
|
||||||
};
|
|
||||||
exports.default = jtdMetaSchema;
|
|
||||||
//# sourceMappingURL=jtd-schema.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"jtd-schema.js","sourceRoot":"","sources":["../../lib/refs/jtd-schema.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM,GAAe,CAAC,IAAI,EAAE,EAAE;IAClC,MAAM,GAAG,GAAiB;QACxB,QAAQ,EAAE,EAAC,IAAI,EAAE,SAAS,EAAC;QAC3B,QAAQ,EAAE;YACR,kBAAkB,EAAE;gBAClB,KAAK,EAAE,EAAC,QAAQ,EAAE,EAAC,GAAG,EAAE,QAAQ,EAAC,EAAC;aACnC;YACD,oBAAoB,EAAE,IAAI;SAC3B;KACF,CAAA;IACD,IAAI,IAAI;QAAE,GAAG,CAAC,WAAW,GAAG,EAAC,MAAM,EAAE,EAAC,GAAG,EAAE,QAAQ,EAAC,EAAC,CAAA;IACrD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,MAAM,SAAS,GAAe,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACvC,kBAAkB,EAAE,MAAM,CAAC,IAAI,CAAC;CACjC,CAAC,CAAA;AAEF,MAAM,OAAO,GAAe,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACrC,UAAU,EAAE;QACV,GAAG,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;KACtB;IACD,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,aAAa,CAAA"}
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
import * as equal from "fast-deep-equal";
|
|
||||||
type Equal = typeof equal & {
|
|
||||||
code: string;
|
|
||||||
};
|
|
||||||
declare const _default: Equal;
|
|
||||||
export default _default;
|
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
// https://github.com/ajv-validator/ajv/issues/889
|
|
||||||
const equal = require("fast-deep-equal");
|
|
||||||
equal.code = 'require("ajv/dist/runtime/equal").default';
|
|
||||||
exports.default = equal;
|
|
||||||
//# sourceMappingURL=equal.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"equal.js","sourceRoot":"","sources":["../../lib/runtime/equal.ts"],"names":[],"mappings":";;AAAA,kDAAkD;AAClD,yCAAwC;AAGtC,KAAe,CAAC,IAAI,GAAG,2CAA2C,CAAA;AAEpE,kBAAe,KAAc,CAAA"}
|
|
||||||
-18
@@ -1,18 +0,0 @@
|
|||||||
export declare function parseJson(s: string, pos: number): unknown;
|
|
||||||
export declare namespace parseJson {
|
|
||||||
var message: string | undefined;
|
|
||||||
var position: number;
|
|
||||||
var code: string;
|
|
||||||
}
|
|
||||||
export declare function parseJsonNumber(s: string, pos: number, maxDigits?: number): number | undefined;
|
|
||||||
export declare namespace parseJsonNumber {
|
|
||||||
var message: string | undefined;
|
|
||||||
var position: number;
|
|
||||||
var code: string;
|
|
||||||
}
|
|
||||||
export declare function parseJsonString(s: string, pos: number): string | undefined;
|
|
||||||
export declare namespace parseJsonString {
|
|
||||||
var message: string | undefined;
|
|
||||||
var position: number;
|
|
||||||
var code: string;
|
|
||||||
}
|
|
||||||
-185
@@ -1,185 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.parseJsonString = exports.parseJsonNumber = exports.parseJson = void 0;
|
|
||||||
const rxParseJson = /position\s(\d+)(?: \(line \d+ column \d+\))?$/;
|
|
||||||
function parseJson(s, pos) {
|
|
||||||
let endPos;
|
|
||||||
parseJson.message = undefined;
|
|
||||||
let matches;
|
|
||||||
if (pos)
|
|
||||||
s = s.slice(pos);
|
|
||||||
try {
|
|
||||||
parseJson.position = pos + s.length;
|
|
||||||
return JSON.parse(s);
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
matches = rxParseJson.exec(e.message);
|
|
||||||
if (!matches) {
|
|
||||||
parseJson.message = "unexpected end";
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
endPos = +matches[1];
|
|
||||||
const c = s[endPos];
|
|
||||||
s = s.slice(0, endPos);
|
|
||||||
parseJson.position = pos + endPos;
|
|
||||||
try {
|
|
||||||
return JSON.parse(s);
|
|
||||||
}
|
|
||||||
catch (e1) {
|
|
||||||
parseJson.message = `unexpected token ${c}`;
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.parseJson = parseJson;
|
|
||||||
parseJson.message = undefined;
|
|
||||||
parseJson.position = 0;
|
|
||||||
parseJson.code = 'require("ajv/dist/runtime/parseJson").parseJson';
|
|
||||||
function parseJsonNumber(s, pos, maxDigits) {
|
|
||||||
let numStr = "";
|
|
||||||
let c;
|
|
||||||
parseJsonNumber.message = undefined;
|
|
||||||
if (s[pos] === "-") {
|
|
||||||
numStr += "-";
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
if (s[pos] === "0") {
|
|
||||||
numStr += "0";
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (!parseDigits(maxDigits)) {
|
|
||||||
errorMessage();
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (maxDigits) {
|
|
||||||
parseJsonNumber.position = pos;
|
|
||||||
return +numStr;
|
|
||||||
}
|
|
||||||
if (s[pos] === ".") {
|
|
||||||
numStr += ".";
|
|
||||||
pos++;
|
|
||||||
if (!parseDigits()) {
|
|
||||||
errorMessage();
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (((c = s[pos]), c === "e" || c === "E")) {
|
|
||||||
numStr += "e";
|
|
||||||
pos++;
|
|
||||||
if (((c = s[pos]), c === "+" || c === "-")) {
|
|
||||||
numStr += c;
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
if (!parseDigits()) {
|
|
||||||
errorMessage();
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
parseJsonNumber.position = pos;
|
|
||||||
return +numStr;
|
|
||||||
function parseDigits(maxLen) {
|
|
||||||
let digit = false;
|
|
||||||
while (((c = s[pos]), c >= "0" && c <= "9" && (maxLen === undefined || maxLen-- > 0))) {
|
|
||||||
digit = true;
|
|
||||||
numStr += c;
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
return digit;
|
|
||||||
}
|
|
||||||
function errorMessage() {
|
|
||||||
parseJsonNumber.position = pos;
|
|
||||||
parseJsonNumber.message = pos < s.length ? `unexpected token ${s[pos]}` : "unexpected end";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.parseJsonNumber = parseJsonNumber;
|
|
||||||
parseJsonNumber.message = undefined;
|
|
||||||
parseJsonNumber.position = 0;
|
|
||||||
parseJsonNumber.code = 'require("ajv/dist/runtime/parseJson").parseJsonNumber';
|
|
||||||
const escapedChars = {
|
|
||||||
b: "\b",
|
|
||||||
f: "\f",
|
|
||||||
n: "\n",
|
|
||||||
r: "\r",
|
|
||||||
t: "\t",
|
|
||||||
'"': '"',
|
|
||||||
"/": "/",
|
|
||||||
"\\": "\\",
|
|
||||||
};
|
|
||||||
const CODE_A = "a".charCodeAt(0);
|
|
||||||
const CODE_0 = "0".charCodeAt(0);
|
|
||||||
function parseJsonString(s, pos) {
|
|
||||||
let str = "";
|
|
||||||
let c;
|
|
||||||
parseJsonString.message = undefined;
|
|
||||||
// eslint-disable-next-line no-constant-condition, @typescript-eslint/no-unnecessary-condition
|
|
||||||
while (true) {
|
|
||||||
c = s[pos++];
|
|
||||||
if (c === '"')
|
|
||||||
break;
|
|
||||||
if (c === "\\") {
|
|
||||||
c = s[pos];
|
|
||||||
if (c in escapedChars) {
|
|
||||||
str += escapedChars[c];
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
else if (c === "u") {
|
|
||||||
pos++;
|
|
||||||
let count = 4;
|
|
||||||
let code = 0;
|
|
||||||
while (count--) {
|
|
||||||
code <<= 4;
|
|
||||||
c = s[pos];
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
||||||
if (c === undefined) {
|
|
||||||
errorMessage("unexpected end");
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
c = c.toLowerCase();
|
|
||||||
if (c >= "a" && c <= "f") {
|
|
||||||
code += c.charCodeAt(0) - CODE_A + 10;
|
|
||||||
}
|
|
||||||
else if (c >= "0" && c <= "9") {
|
|
||||||
code += c.charCodeAt(0) - CODE_0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
errorMessage(`unexpected token ${c}`);
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
str += String.fromCharCode(code);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
errorMessage(`unexpected token ${c}`);
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
||||||
}
|
|
||||||
else if (c === undefined) {
|
|
||||||
errorMessage("unexpected end");
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (c.charCodeAt(0) >= 0x20) {
|
|
||||||
str += c;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
errorMessage(`unexpected token ${c}`);
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
parseJsonString.position = pos;
|
|
||||||
return str;
|
|
||||||
function errorMessage(msg) {
|
|
||||||
parseJsonString.position = pos;
|
|
||||||
parseJsonString.message = msg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.parseJsonString = parseJsonString;
|
|
||||||
parseJsonString.message = undefined;
|
|
||||||
parseJsonString.position = 0;
|
|
||||||
parseJsonString.code = 'require("ajv/dist/runtime/parseJson").parseJsonString';
|
|
||||||
//# sourceMappingURL=parseJson.js.map
|
|
||||||
-1
File diff suppressed because one or more lines are too long
-5
@@ -1,5 +0,0 @@
|
|||||||
declare function quote(s: string): string;
|
|
||||||
declare namespace quote {
|
|
||||||
var code: string;
|
|
||||||
}
|
|
||||||
export default quote;
|
|
||||||
-30
@@ -1,30 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const rxEscapable =
|
|
||||||
// eslint-disable-next-line no-control-regex, no-misleading-character-class
|
|
||||||
/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
|
|
||||||
const escaped = {
|
|
||||||
"\b": "\\b",
|
|
||||||
"\t": "\\t",
|
|
||||||
"\n": "\\n",
|
|
||||||
"\f": "\\f",
|
|
||||||
"\r": "\\r",
|
|
||||||
'"': '\\"',
|
|
||||||
"\\": "\\\\",
|
|
||||||
};
|
|
||||||
function quote(s) {
|
|
||||||
rxEscapable.lastIndex = 0;
|
|
||||||
return ('"' +
|
|
||||||
(rxEscapable.test(s)
|
|
||||||
? s.replace(rxEscapable, (a) => {
|
|
||||||
const c = escaped[a];
|
|
||||||
return typeof c === "string"
|
|
||||||
? c
|
|
||||||
: "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
|
|
||||||
})
|
|
||||||
: s) +
|
|
||||||
'"');
|
|
||||||
}
|
|
||||||
exports.default = quote;
|
|
||||||
quote.code = 'require("ajv/dist/runtime/quote").default';
|
|
||||||
//# sourceMappingURL=quote.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"quote.js","sourceRoot":"","sources":["../../lib/runtime/quote.ts"],"names":[],"mappings":";;AAAA,MAAM,WAAW;AACf,2EAA2E;AAC3E,iIAAiI,CAAA;AAEnI,MAAM,OAAO,GAA6B;IACxC,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACb,CAAA;AAED,SAAwB,KAAK,CAAC,CAAS;IACrC,WAAW,CAAC,SAAS,GAAG,CAAC,CAAA;IACzB,OAAO,CACL,GAAG;QACH,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE;gBAC3B,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;gBACpB,OAAO,OAAO,CAAC,KAAK,QAAQ;oBAC1B,CAAC,CAAC,CAAC;oBACH,CAAC,CAAC,KAAK,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;YAC/D,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC,CAAC;QACN,GAAG,CACJ,CAAA;AACH,CAAC;AAdD,wBAcC;AAED,KAAK,CAAC,IAAI,GAAG,2CAA2C,CAAA"}
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
import * as re2 from "re2";
|
|
||||||
type Re2 = typeof re2 & {
|
|
||||||
code: string;
|
|
||||||
};
|
|
||||||
declare const _default: Re2;
|
|
||||||
export default _default;
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const re2 = require("re2");
|
|
||||||
re2.code = 'require("ajv/dist/runtime/re2").default';
|
|
||||||
exports.default = re2;
|
|
||||||
//# sourceMappingURL=re2.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"re2.js","sourceRoot":"","sources":["../../lib/runtime/re2.ts"],"names":[],"mappings":";;AAAA,2BAA0B;AAGxB,GAAW,CAAC,IAAI,GAAG,yCAAyC,CAAA;AAE9D,kBAAe,GAAU,CAAA"}
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
declare function validTimestamp(str: string, allowDate: boolean): boolean;
|
|
||||||
declare namespace validTimestamp {
|
|
||||||
var code: string;
|
|
||||||
}
|
|
||||||
export default validTimestamp;
|
|
||||||
-42
@@ -1,42 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const DT_SEPARATOR = /t|\s/i;
|
|
||||||
const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
||||||
const TIME = /^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:z|([+-]\d\d)(?::?(\d\d))?)$/i;
|
|
||||||
const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
||||||
function validTimestamp(str, allowDate) {
|
|
||||||
// http://tools.ietf.org/html/rfc3339#section-5.6
|
|
||||||
const dt = str.split(DT_SEPARATOR);
|
|
||||||
return ((dt.length === 2 && validDate(dt[0]) && validTime(dt[1])) ||
|
|
||||||
(allowDate && dt.length === 1 && validDate(dt[0])));
|
|
||||||
}
|
|
||||||
exports.default = validTimestamp;
|
|
||||||
function validDate(str) {
|
|
||||||
const matches = DATE.exec(str);
|
|
||||||
if (!matches)
|
|
||||||
return false;
|
|
||||||
const y = +matches[1];
|
|
||||||
const m = +matches[2];
|
|
||||||
const d = +matches[3];
|
|
||||||
return (m >= 1 &&
|
|
||||||
m <= 12 &&
|
|
||||||
d >= 1 &&
|
|
||||||
(d <= DAYS[m] ||
|
|
||||||
// leap year: https://tools.ietf.org/html/rfc3339#appendix-C
|
|
||||||
(m === 2 && d === 29 && (y % 100 === 0 ? y % 400 === 0 : y % 4 === 0))));
|
|
||||||
}
|
|
||||||
function validTime(str) {
|
|
||||||
const matches = TIME.exec(str);
|
|
||||||
if (!matches)
|
|
||||||
return false;
|
|
||||||
const hr = +matches[1];
|
|
||||||
const min = +matches[2];
|
|
||||||
const sec = +matches[3];
|
|
||||||
const tzH = +(matches[4] || 0);
|
|
||||||
const tzM = +(matches[5] || 0);
|
|
||||||
return ((hr <= 23 && min <= 59 && sec <= 59) ||
|
|
||||||
// leap second
|
|
||||||
(hr - tzH === 23 && min - tzM === 59 && sec === 60));
|
|
||||||
}
|
|
||||||
validTimestamp.code = 'require("ajv/dist/runtime/timestamp").default';
|
|
||||||
//# sourceMappingURL=timestamp.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"timestamp.js","sourceRoot":"","sources":["../../lib/runtime/timestamp.ts"],"names":[],"mappings":";;AAAA,MAAM,YAAY,GAAG,OAAO,CAAA;AAC5B,MAAM,IAAI,GAAG,4BAA4B,CAAA;AACzC,MAAM,IAAI,GAAG,gEAAgE,CAAA;AAC7E,MAAM,IAAI,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;AAEhE,SAAwB,cAAc,CAAC,GAAW,EAAE,SAAkB;IACpE,iDAAiD;IACjD,MAAM,EAAE,GAAa,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;IAC5C,OAAO,CACL,CAAC,EAAE,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC,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,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;IACtC,MAAM,GAAG,GAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;IACtC,OAAO,CACL,CAAC,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,CAAC;QACpC,cAAc;QACd,CAAC,EAAE,GAAG,GAAG,KAAK,EAAE,IAAI,GAAG,GAAG,GAAG,KAAK,EAAE,IAAI,GAAG,KAAK,EAAE,CAAC,CACpD,CAAA;AACH,CAAC;AAED,cAAc,CAAC,IAAI,GAAG,+CAA+C,CAAA"}
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
declare function ucs2length(str: string): number;
|
|
||||||
declare namespace ucs2length {
|
|
||||||
var code: string;
|
|
||||||
}
|
|
||||||
export default ucs2length;
|
|
||||||
-24
@@ -1,24 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
// https://mathiasbynens.be/notes/javascript-encoding
|
|
||||||
// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode
|
|
||||||
function ucs2length(str) {
|
|
||||||
const len = str.length;
|
|
||||||
let length = 0;
|
|
||||||
let pos = 0;
|
|
||||||
let value;
|
|
||||||
while (pos < len) {
|
|
||||||
length++;
|
|
||||||
value = str.charCodeAt(pos++);
|
|
||||||
if (value >= 0xd800 && value <= 0xdbff && pos < len) {
|
|
||||||
// high surrogate, and there is a next character
|
|
||||||
value = str.charCodeAt(pos);
|
|
||||||
if ((value & 0xfc00) === 0xdc00)
|
|
||||||
pos++; // low surrogate
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return length;
|
|
||||||
}
|
|
||||||
exports.default = ucs2length;
|
|
||||||
ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default';
|
|
||||||
//# sourceMappingURL=ucs2length.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"ucs2length.js","sourceRoot":"","sources":["../../lib/runtime/ucs2length.ts"],"names":[],"mappings":";;AAAA,qDAAqD;AACrD,iEAAiE;AACjE,SAAwB,UAAU,CAAC,GAAW;IAC5C,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAA;IACtB,IAAI,MAAM,GAAG,CAAC,CAAA;IACd,IAAI,GAAG,GAAG,CAAC,CAAA;IACX,IAAI,KAAa,CAAA;IACjB,OAAO,GAAG,GAAG,GAAG,EAAE,CAAC;QACjB,MAAM,EAAE,CAAA;QACR,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,CAAA;QAC7B,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,MAAM,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC;YACpD,gDAAgD;YAChD,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;YAC3B,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,MAAM;gBAAE,GAAG,EAAE,CAAA,CAAC,gBAAgB;QACzD,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAfD,6BAeC;AAED,UAAU,CAAC,IAAI,GAAG,gDAAgD,CAAA"}
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
import * as uri from "fast-uri";
|
|
||||||
type URI = typeof uri & {
|
|
||||||
code: string;
|
|
||||||
};
|
|
||||||
declare const _default: URI;
|
|
||||||
export default _default;
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const uri = require("fast-uri");
|
|
||||||
uri.code = 'require("ajv/dist/runtime/uri").default';
|
|
||||||
exports.default = uri;
|
|
||||||
//# sourceMappingURL=uri.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"uri.js","sourceRoot":"","sources":["../../lib/runtime/uri.ts"],"names":[],"mappings":";;AAAA,gCAA+B;AAG7B,GAAW,CAAC,IAAI,GAAG,yCAAyC,CAAA;AAE9D,kBAAe,GAAU,CAAA"}
|
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
import type { ErrorObject } from "../types";
|
|
||||||
export default class ValidationError extends Error {
|
|
||||||
readonly errors: Partial<ErrorObject>[];
|
|
||||||
readonly ajv: true;
|
|
||||||
readonly validation: true;
|
|
||||||
constructor(errors: Partial<ErrorObject>[]);
|
|
||||||
}
|
|
||||||
-11
@@ -1,11 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
class ValidationError extends Error {
|
|
||||||
constructor(errors) {
|
|
||||||
super("validation failed");
|
|
||||||
this.errors = errors;
|
|
||||||
this.ajv = this.validation = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.default = ValidationError;
|
|
||||||
//# sourceMappingURL=validation_error.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"validation_error.js","sourceRoot":"","sources":["../../lib/runtime/validation_error.ts"],"names":[],"mappings":";;AAEA,MAAqB,eAAgB,SAAQ,KAAK;IAKhD,YAAY,MAA8B;QACxC,KAAK,CAAC,mBAAmB,CAAC,CAAA;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAA;IACnC,CAAC;CACF;AAVD,kCAUC"}
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
import type AjvCore from "../core";
|
|
||||||
import type { AnyValidateFunction } from "../types";
|
|
||||||
declare function standaloneCode(ajv: AjvCore, refsOrFunc?: {
|
|
||||||
[K in string]?: string;
|
|
||||||
} | AnyValidateFunction): string;
|
|
||||||
export default standaloneCode;
|
|
||||||
-90
@@ -1,90 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const scope_1 = require("../compile/codegen/scope");
|
|
||||||
const code_1 = require("../compile/codegen/code");
|
|
||||||
function standaloneCode(ajv, refsOrFunc) {
|
|
||||||
if (!ajv.opts.code.source) {
|
|
||||||
throw new Error("moduleCode: ajv instance must have code.source option");
|
|
||||||
}
|
|
||||||
const { _n } = ajv.scope.opts;
|
|
||||||
return typeof refsOrFunc == "function"
|
|
||||||
? funcExportCode(refsOrFunc.source)
|
|
||||||
: refsOrFunc !== undefined
|
|
||||||
? multiExportsCode(refsOrFunc, getValidate)
|
|
||||||
: multiExportsCode(ajv.schemas, (sch) => sch.meta ? undefined : ajv.compile(sch.schema));
|
|
||||||
function getValidate(id) {
|
|
||||||
const v = ajv.getSchema(id);
|
|
||||||
if (!v)
|
|
||||||
throw new Error(`moduleCode: no schema with id ${id}`);
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
function funcExportCode(source) {
|
|
||||||
const usedValues = {};
|
|
||||||
const n = source === null || source === void 0 ? void 0 : source.validateName;
|
|
||||||
const vCode = validateCode(usedValues, source);
|
|
||||||
if (ajv.opts.code.esm) {
|
|
||||||
// Always do named export as `validate` rather than the variable `n` which is `validateXX` for known export value
|
|
||||||
return `"use strict";${_n}export const validate = ${n};${_n}export default ${n};${_n}${vCode}`;
|
|
||||||
}
|
|
||||||
return `"use strict";${_n}module.exports = ${n};${_n}module.exports.default = ${n};${_n}${vCode}`;
|
|
||||||
}
|
|
||||||
function multiExportsCode(schemas, getValidateFunc) {
|
|
||||||
var _a;
|
|
||||||
const usedValues = {};
|
|
||||||
let code = (0, code_1._) `"use strict";`;
|
|
||||||
for (const name in schemas) {
|
|
||||||
const v = getValidateFunc(schemas[name]);
|
|
||||||
if (v) {
|
|
||||||
const vCode = validateCode(usedValues, v.source);
|
|
||||||
const exportSyntax = ajv.opts.code.esm
|
|
||||||
? (0, code_1._) `export const ${(0, code_1.getEsmExportName)(name)}`
|
|
||||||
: (0, code_1._) `exports${(0, code_1.getProperty)(name)}`;
|
|
||||||
code = (0, code_1._) `${code}${_n}${exportSyntax} = ${(_a = v.source) === null || _a === void 0 ? void 0 : _a.validateName};${_n}${vCode}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return `${code}`;
|
|
||||||
}
|
|
||||||
function validateCode(usedValues, s) {
|
|
||||||
if (!s)
|
|
||||||
throw new Error('moduleCode: function does not have "source" property');
|
|
||||||
if (usedState(s.validateName) === scope_1.UsedValueState.Completed)
|
|
||||||
return code_1.nil;
|
|
||||||
setUsedState(s.validateName, scope_1.UsedValueState.Started);
|
|
||||||
const scopeCode = ajv.scope.scopeCode(s.scopeValues, usedValues, refValidateCode);
|
|
||||||
const code = new code_1._Code(`${scopeCode}${_n}${s.validateCode}`);
|
|
||||||
return s.evaluated ? (0, code_1._) `${code}${s.validateName}.evaluated = ${s.evaluated};${_n}` : code;
|
|
||||||
function refValidateCode(n) {
|
|
||||||
var _a;
|
|
||||||
const vRef = (_a = n.value) === null || _a === void 0 ? void 0 : _a.ref;
|
|
||||||
if (n.prefix === "validate" && typeof vRef == "function") {
|
|
||||||
const v = vRef;
|
|
||||||
return validateCode(usedValues, v.source);
|
|
||||||
}
|
|
||||||
else if ((n.prefix === "root" || n.prefix === "wrapper") && typeof vRef == "object") {
|
|
||||||
const { validate, validateName } = vRef;
|
|
||||||
if (!validateName)
|
|
||||||
throw new Error("ajv internal error");
|
|
||||||
const def = ajv.opts.code.es5 ? scope_1.varKinds.var : scope_1.varKinds.const;
|
|
||||||
const wrapper = (0, code_1._) `${def} ${n} = {validate: ${validateName}};`;
|
|
||||||
if (usedState(validateName) === scope_1.UsedValueState.Started)
|
|
||||||
return wrapper;
|
|
||||||
const vCode = validateCode(usedValues, validate === null || validate === void 0 ? void 0 : validate.source);
|
|
||||||
return (0, code_1._) `${wrapper}${_n}${vCode}`;
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
function usedState(name) {
|
|
||||||
var _a;
|
|
||||||
return (_a = usedValues[name.prefix]) === null || _a === void 0 ? void 0 : _a.get(name);
|
|
||||||
}
|
|
||||||
function setUsedState(name, state) {
|
|
||||||
const { prefix } = name;
|
|
||||||
const names = (usedValues[prefix] = usedValues[prefix] || new Map());
|
|
||||||
names.set(name, state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
module.exports = exports = standaloneCode;
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.default = standaloneCode;
|
|
||||||
//# sourceMappingURL=index.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/standalone/index.ts"],"names":[],"mappings":";;AAGA,oDAAkG;AAClG,kDAA0F;AAE1F,SAAS,cAAc,CACrB,GAAY,EACZ,UAA2D;IAE3D,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAA;IAC1E,CAAC;IACD,MAAM,EAAC,EAAE,EAAC,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAA;IAC3B,OAAO,OAAO,UAAU,IAAI,UAAU;QACpC,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC;QACnC,CAAC,CAAC,UAAU,KAAK,SAAS;YAC1B,CAAC,CAAC,gBAAgB,CAAS,UAAU,EAAE,WAAW,CAAC;YACnD,CAAC,CAAC,gBAAgB,CAAY,GAAG,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAC/C,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAC/C,CAAA;IAEL,SAAS,WAAW,CAAC,EAAU;QAC7B,MAAM,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAC3B,IAAI,CAAC,CAAC;YAAE,MAAM,IA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AC;IACH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,cAAc,CAAA;AACzC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,cAAc,CAAA"}
|
|
||||||
-12
@@ -1,12 +0,0 @@
|
|||||||
import Ajv, { AnySchema, AnyValidateFunction, ErrorObject } from "../core";
|
|
||||||
export default class AjvPack {
|
|
||||||
readonly ajv: Ajv;
|
|
||||||
errors?: ErrorObject[] | null;
|
|
||||||
constructor(ajv: Ajv);
|
|
||||||
validate(schemaKeyRef: AnySchema | string, data: unknown): boolean | Promise<unknown>;
|
|
||||||
compile<T = unknown>(schema: AnySchema, meta?: boolean): AnyValidateFunction<T>;
|
|
||||||
getSchema<T = unknown>(keyRef: string): AnyValidateFunction<T> | undefined;
|
|
||||||
private getStandalone;
|
|
||||||
addSchema(...args: Parameters<typeof Ajv.prototype.addSchema>): AjvPack;
|
|
||||||
addKeyword(...args: Parameters<typeof Ajv.prototype.addKeyword>): AjvPack;
|
|
||||||
}
|
|
||||||
-35
@@ -1,35 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const core_1 = require("../core");
|
|
||||||
const _1 = require(".");
|
|
||||||
const requireFromString = require("require-from-string");
|
|
||||||
class AjvPack {
|
|
||||||
constructor(ajv) {
|
|
||||||
this.ajv = ajv;
|
|
||||||
}
|
|
||||||
validate(schemaKeyRef, data) {
|
|
||||||
return core_1.default.prototype.validate.call(this, schemaKeyRef, data);
|
|
||||||
}
|
|
||||||
compile(schema, meta) {
|
|
||||||
return this.getStandalone(this.ajv.compile(schema, meta));
|
|
||||||
}
|
|
||||||
getSchema(keyRef) {
|
|
||||||
const v = this.ajv.getSchema(keyRef);
|
|
||||||
if (!v)
|
|
||||||
return undefined;
|
|
||||||
return this.getStandalone(v);
|
|
||||||
}
|
|
||||||
getStandalone(v) {
|
|
||||||
return requireFromString((0, _1.default)(this.ajv, v));
|
|
||||||
}
|
|
||||||
addSchema(...args) {
|
|
||||||
this.ajv.addSchema.call(this.ajv, ...args);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
addKeyword(...args) {
|
|
||||||
this.ajv.addKeyword.call(this.ajv, ...args);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.default = AjvPack;
|
|
||||||
//# sourceMappingURL=instance.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"instance.js","sourceRoot":"","sources":["../../lib/standalone/instance.ts"],"names":[],"mappings":";;AAAA,kCAAwE;AACxE,wBAA8B;AAC9B,yDAAwD;AAExD,MAAqB,OAAO;IAE1B,YAAqB,GAAQ;QAAR,QAAG,GAAH,GAAG,CAAK;IAAG,CAAC;IAEjC,QAAQ,CAAC,YAAgC,EAAE,IAAa;QACtD,OAAO,cAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,CAAA;IAC9D,CAAC;IAED,OAAO,CAAc,MAAiB,EAAE,IAAc;QACpD,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAI,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;IAC9D,CAAC;IAED,SAAS,CAAc,MAAc;QACnC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAI,MAAM,CAAC,CAAA;QACvC,IAAI,CAAC,CAAC;YAAE,OAAO,SAAS,CAAA;QACxB,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAA;IAC9B,CAAC;IAEO,aAAa,CAAc,CAAyB;QAC1D,OAAO,iBAAiB,CAAC,IAAA,UAAc,EAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAA2B,CAAA;IACjF,CAAC;IAED,SAAS,CAAC,GAAG,IAAgD;QAC3D,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;QAC1C,OAAO,IAAI,CAAA;IACb,CAAC;IAED,UAAU,CAAC,GAAG,IAAiD;QAC7D,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;QAC3C,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AA/BD,0BA+BC"}
|
|
||||||
-183
@@ -1,183 +0,0 @@
|
|||||||
import { URIComponent } from "fast-uri";
|
|
||||||
import type { CodeGen, Code, Name, ScopeValueSets, ValueScopeName } from "../compile/codegen";
|
|
||||||
import type { SchemaEnv, SchemaCxt, SchemaObjCxt } from "../compile";
|
|
||||||
import type { JSONType } from "../compile/rules";
|
|
||||||
import type { KeywordCxt } from "../compile/validate";
|
|
||||||
import type Ajv from "../core";
|
|
||||||
interface _SchemaObject {
|
|
||||||
id?: string;
|
|
||||||
$id?: string;
|
|
||||||
$schema?: string;
|
|
||||||
[x: string]: any;
|
|
||||||
}
|
|
||||||
export interface SchemaObject extends _SchemaObject {
|
|
||||||
id?: string;
|
|
||||||
$id?: string;
|
|
||||||
$schema?: string;
|
|
||||||
$async?: false;
|
|
||||||
[x: string]: any;
|
|
||||||
}
|
|
||||||
export interface AsyncSchema extends _SchemaObject {
|
|
||||||
$async: true;
|
|
||||||
}
|
|
||||||
export type AnySchemaObject = SchemaObject | AsyncSchema;
|
|
||||||
export type Schema = SchemaObject | boolean;
|
|
||||||
export type AnySchema = Schema | AsyncSchema;
|
|
||||||
export type SchemaMap = {
|
|
||||||
[Key in string]?: AnySchema;
|
|
||||||
};
|
|
||||||
export interface SourceCode {
|
|
||||||
validateName: ValueScopeName;
|
|
||||||
validateCode: string;
|
|
||||||
scopeValues: ScopeValueSets;
|
|
||||||
evaluated?: Code;
|
|
||||||
}
|
|
||||||
export interface DataValidationCxt<T extends string | number = string | number> {
|
|
||||||
instancePath: string;
|
|
||||||
parentData: {
|
|
||||||
[K in T]: any;
|
|
||||||
};
|
|
||||||
parentDataProperty: T;
|
|
||||||
rootData: Record<string, any> | any[];
|
|
||||||
dynamicAnchors: {
|
|
||||||
[Ref in string]?: ValidateFunction;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
export interface ValidateFunction<T = unknown> {
|
|
||||||
(this: Ajv | any, data: any, dataCxt?: DataValidationCxt): data is T;
|
|
||||||
errors?: null | ErrorObject[];
|
|
||||||
evaluated?: Evaluated;
|
|
||||||
schema: AnySchema;
|
|
||||||
schemaEnv: SchemaEnv;
|
|
||||||
source?: SourceCode;
|
|
||||||
}
|
|
||||||
export interface JTDParser<T = unknown> {
|
|
||||||
(json: string): T | undefined;
|
|
||||||
message?: string;
|
|
||||||
position?: number;
|
|
||||||
}
|
|
||||||
export type EvaluatedProperties = {
|
|
||||||
[K in string]?: true;
|
|
||||||
} | true;
|
|
||||||
export type EvaluatedItems = number | true;
|
|
||||||
export interface Evaluated {
|
|
||||||
props?: EvaluatedProperties;
|
|
||||||
items?: EvaluatedItems;
|
|
||||||
dynamicProps: boolean;
|
|
||||||
dynamicItems: boolean;
|
|
||||||
}
|
|
||||||
export interface AsyncValidateFunction<T = unknown> extends ValidateFunction<T> {
|
|
||||||
(...args: Parameters<ValidateFunction<T>>): Promise<T>;
|
|
||||||
$async: true;
|
|
||||||
}
|
|
||||||
export type AnyValidateFunction<T = any> = ValidateFunction<T> | AsyncValidateFunction<T>;
|
|
||||||
export interface ErrorObject<K extends string = string, P = Record<string, any>, S = unknown> {
|
|
||||||
keyword: K;
|
|
||||||
instancePath: string;
|
|
||||||
schemaPath: string;
|
|
||||||
params: P;
|
|
||||||
propertyName?: string;
|
|
||||||
message?: string;
|
|
||||||
schema?: S;
|
|
||||||
parentSchema?: AnySchemaObject;
|
|
||||||
data?: unknown;
|
|
||||||
}
|
|
||||||
export type ErrorNoParams<K extends string, S = unknown> = ErrorObject<K, Record<string, never>, S>;
|
|
||||||
interface _KeywordDef {
|
|
||||||
keyword: string | string[];
|
|
||||||
type?: JSONType | JSONType[];
|
|
||||||
schemaType?: JSONType | JSONType[];
|
|
||||||
allowUndefined?: boolean;
|
|
||||||
$data?: boolean;
|
|
||||||
implements?: string[];
|
|
||||||
before?: string;
|
|
||||||
post?: boolean;
|
|
||||||
metaSchema?: AnySchemaObject;
|
|
||||||
validateSchema?: AnyValidateFunction;
|
|
||||||
dependencies?: string[];
|
|
||||||
error?: KeywordErrorDefinition;
|
|
||||||
$dataError?: KeywordErrorDefinition;
|
|
||||||
}
|
|
||||||
export interface CodeKeywordDefinition extends _KeywordDef {
|
|
||||||
code: (cxt: KeywordCxt, ruleType?: string) => void;
|
|
||||||
trackErrors?: boolean;
|
|
||||||
}
|
|
||||||
export type MacroKeywordFunc = (schema: any, parentSchema: AnySchemaObject, it: SchemaCxt) => AnySchema;
|
|
||||||
export type CompileKeywordFunc = (schema: any, parentSchema: AnySchemaObject, it: SchemaObjCxt) => DataValidateFunction;
|
|
||||||
export interface DataValidateFunction {
|
|
||||||
(...args: Parameters<ValidateFunction>): boolean | Promise<any>;
|
|
||||||
errors?: Partial<ErrorObject>[];
|
|
||||||
}
|
|
||||||
export interface SchemaValidateFunction {
|
|
||||||
(schema: any, data: any, parentSchema?: AnySchemaObject, dataCxt?: DataValidationCxt): boolean | Promise<any>;
|
|
||||||
errors?: Partial<ErrorObject>[];
|
|
||||||
}
|
|
||||||
export interface FuncKeywordDefinition extends _KeywordDef {
|
|
||||||
validate?: SchemaValidateFunction | DataValidateFunction;
|
|
||||||
compile?: CompileKeywordFunc;
|
|
||||||
schema?: boolean;
|
|
||||||
modifying?: boolean;
|
|
||||||
async?: boolean;
|
|
||||||
valid?: boolean;
|
|
||||||
errors?: boolean | "full";
|
|
||||||
}
|
|
||||||
export interface MacroKeywordDefinition extends FuncKeywordDefinition {
|
|
||||||
macro: MacroKeywordFunc;
|
|
||||||
}
|
|
||||||
export type KeywordDefinition = CodeKeywordDefinition | FuncKeywordDefinition | MacroKeywordDefinition;
|
|
||||||
export type AddedKeywordDefinition = KeywordDefinition & {
|
|
||||||
type: JSONType[];
|
|
||||||
schemaType: JSONType[];
|
|
||||||
};
|
|
||||||
export interface KeywordErrorDefinition {
|
|
||||||
message: string | Code | ((cxt: KeywordErrorCxt) => string | Code);
|
|
||||||
params?: Code | ((cxt: KeywordErrorCxt) => Code);
|
|
||||||
}
|
|
||||||
export type Vocabulary = (KeywordDefinition | string)[];
|
|
||||||
export interface KeywordErrorCxt {
|
|
||||||
gen: CodeGen;
|
|
||||||
keyword: string;
|
|
||||||
data: Name;
|
|
||||||
$data?: string | false;
|
|
||||||
schema: any;
|
|
||||||
parentSchema?: AnySchemaObject;
|
|
||||||
schemaCode: Code | number | boolean;
|
|
||||||
schemaValue: Code | number | boolean;
|
|
||||||
schemaType?: JSONType[];
|
|
||||||
errsCount?: Name;
|
|
||||||
params: KeywordCxtParams;
|
|
||||||
it: SchemaCxt;
|
|
||||||
}
|
|
||||||
export type KeywordCxtParams = {
|
|
||||||
[P in string]?: Code | string | number;
|
|
||||||
};
|
|
||||||
export type FormatValidator<T extends string | number> = (data: T) => boolean;
|
|
||||||
export type FormatCompare<T extends string | number> = (data1: T, data2: T) => number | undefined;
|
|
||||||
export type AsyncFormatValidator<T extends string | number> = (data: T) => Promise<boolean>;
|
|
||||||
export interface FormatDefinition<T extends string | number> {
|
|
||||||
type?: T extends string ? "string" | undefined : "number";
|
|
||||||
validate: FormatValidator<T> | (T extends string ? string | RegExp : never);
|
|
||||||
async?: false | undefined;
|
|
||||||
compare?: FormatCompare<T>;
|
|
||||||
}
|
|
||||||
export interface AsyncFormatDefinition<T extends string | number> {
|
|
||||||
type?: T extends string ? "string" | undefined : "number";
|
|
||||||
validate: AsyncFormatValidator<T>;
|
|
||||||
async: true;
|
|
||||||
compare?: FormatCompare<T>;
|
|
||||||
}
|
|
||||||
export type AddedFormat = true | RegExp | FormatValidator<string> | FormatDefinition<string> | FormatDefinition<number> | AsyncFormatDefinition<string> | AsyncFormatDefinition<number>;
|
|
||||||
export type Format = AddedFormat | string;
|
|
||||||
export interface RegExpEngine {
|
|
||||||
(pattern: string, u: string): RegExpLike;
|
|
||||||
code: string;
|
|
||||||
}
|
|
||||||
export interface RegExpLike {
|
|
||||||
test: (s: string) => boolean;
|
|
||||||
}
|
|
||||||
export interface UriResolver {
|
|
||||||
parse(uri: string): URIComponent;
|
|
||||||
resolve(base: string, path: string): string;
|
|
||||||
serialize(component: URIComponent): string;
|
|
||||||
}
|
|
||||||
export {};
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
//# sourceMappingURL=index.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/types/index.ts"],"names":[],"mappings":""}
|
|
||||||
-125
@@ -1,125 +0,0 @@
|
|||||||
type StrictNullChecksWrapper<Name extends string, Type> = undefined extends null ? `strictNullChecks must be true in tsconfig to use ${Name}` : Type;
|
|
||||||
type UnionToIntersection<U> = (U extends any ? (_: U) => void : never) extends (_: infer I) => void ? I : never;
|
|
||||||
export type SomeJSONSchema = UncheckedJSONSchemaType<Known, true>;
|
|
||||||
type UncheckedPartialSchema<T> = Partial<UncheckedJSONSchemaType<T, true>>;
|
|
||||||
export type PartialSchema<T> = StrictNullChecksWrapper<"PartialSchema", UncheckedPartialSchema<T>>;
|
|
||||||
type JSONType<T extends string, IsPartial extends boolean> = IsPartial extends true ? T | undefined : T;
|
|
||||||
interface NumberKeywords {
|
|
||||||
minimum?: number;
|
|
||||||
maximum?: number;
|
|
||||||
exclusiveMinimum?: number;
|
|
||||||
exclusiveMaximum?: number;
|
|
||||||
multipleOf?: number;
|
|
||||||
format?: string;
|
|
||||||
}
|
|
||||||
interface StringKeywords {
|
|
||||||
minLength?: number;
|
|
||||||
maxLength?: number;
|
|
||||||
pattern?: string;
|
|
||||||
format?: string;
|
|
||||||
}
|
|
||||||
type UncheckedJSONSchemaType<T, IsPartial extends boolean> = (// these two unions allow arbitrary unions of types
|
|
||||||
{
|
|
||||||
anyOf: readonly UncheckedJSONSchemaType<T, IsPartial>[];
|
|
||||||
} | {
|
|
||||||
oneOf: readonly UncheckedJSONSchemaType<T, IsPartial>[];
|
|
||||||
} | ({
|
|
||||||
type: readonly (T extends number ? JSONType<"number" | "integer", IsPartial> : T extends string ? JSONType<"string", IsPartial> : T extends boolean ? JSONType<"boolean", IsPartial> : never)[];
|
|
||||||
} & UnionToIntersection<T extends number ? NumberKeywords : T extends string ? StringKeywords : T extends boolean ? {} : never>) | ((T extends number ? {
|
|
||||||
type: JSONType<"number" | "integer", IsPartial>;
|
|
||||||
} & NumberKeywords : T extends string ? {
|
|
||||||
type: JSONType<"string", IsPartial>;
|
|
||||||
} & StringKeywords : T extends boolean ? {
|
|
||||||
type: JSONType<"boolean", IsPartial>;
|
|
||||||
} : T extends readonly [any, ...any[]] ? {
|
|
||||||
type: JSONType<"array", IsPartial>;
|
|
||||||
items: {
|
|
||||||
readonly [K in keyof T]-?: UncheckedJSONSchemaType<T[K], false> & Nullable<T[K]>;
|
|
||||||
} & {
|
|
||||||
length: T["length"];
|
|
||||||
};
|
|
||||||
minItems: T["length"];
|
|
||||||
} & ({
|
|
||||||
maxItems: T["length"];
|
|
||||||
} | {
|
|
||||||
additionalItems: false;
|
|
||||||
}) : T extends readonly any[] ? {
|
|
||||||
type: JSONType<"array", IsPartial>;
|
|
||||||
items: UncheckedJSONSchemaType<T[0], false>;
|
|
||||||
contains?: UncheckedPartialSchema<T[0]>;
|
|
||||||
minItems?: number;
|
|
||||||
maxItems?: number;
|
|
||||||
minContains?: number;
|
|
||||||
maxContains?: number;
|
|
||||||
uniqueItems?: true;
|
|
||||||
additionalItems?: never;
|
|
||||||
} : T extends Record<string, any> ? {
|
|
||||||
type: JSONType<"object", IsPartial>;
|
|
||||||
additionalProperties?: boolean | UncheckedJSONSchemaType<T[string], false>;
|
|
||||||
unevaluatedProperties?: boolean | UncheckedJSONSchemaType<T[string], false>;
|
|
||||||
properties?: IsPartial extends true ? Partial<UncheckedPropertiesSchema<T>> : UncheckedPropertiesSchema<T>;
|
|
||||||
patternProperties?: Record<string, UncheckedJSONSchemaType<T[string], false>>;
|
|
||||||
propertyNames?: Omit<UncheckedJSONSchemaType<string, false>, "type"> & {
|
|
||||||
type?: "string";
|
|
||||||
};
|
|
||||||
dependencies?: {
|
|
||||||
[K in keyof T]?: readonly (keyof T)[] | UncheckedPartialSchema<T>;
|
|
||||||
};
|
|
||||||
dependentRequired?: {
|
|
||||||
[K in keyof T]?: readonly (keyof T)[];
|
|
||||||
};
|
|
||||||
dependentSchemas?: {
|
|
||||||
[K in keyof T]?: UncheckedPartialSchema<T>;
|
|
||||||
};
|
|
||||||
minProperties?: number;
|
|
||||||
maxProperties?: number;
|
|
||||||
} & (IsPartial extends true ? {
|
|
||||||
required: readonly (keyof T)[];
|
|
||||||
} : [UncheckedRequiredMembers<T>] extends [never] ? {
|
|
||||||
required?: readonly UncheckedRequiredMembers<T>[];
|
|
||||||
} : {
|
|
||||||
required: readonly UncheckedRequiredMembers<T>[];
|
|
||||||
}) : T extends null ? {
|
|
||||||
type: JSONType<"null", IsPartial>;
|
|
||||||
nullable: true;
|
|
||||||
} : never) & {
|
|
||||||
allOf?: readonly UncheckedPartialSchema<T>[];
|
|
||||||
anyOf?: readonly UncheckedPartialSchema<T>[];
|
|
||||||
oneOf?: readonly UncheckedPartialSchema<T>[];
|
|
||||||
if?: UncheckedPartialSchema<T>;
|
|
||||||
then?: UncheckedPartialSchema<T>;
|
|
||||||
else?: UncheckedPartialSchema<T>;
|
|
||||||
not?: UncheckedPartialSchema<T>;
|
|
||||||
})) & {
|
|
||||||
[keyword: string]: any;
|
|
||||||
$id?: string;
|
|
||||||
$ref?: string;
|
|
||||||
$defs?: Record<string, UncheckedJSONSchemaType<Known, true>>;
|
|
||||||
definitions?: Record<string, UncheckedJSONSchemaType<Known, true>>;
|
|
||||||
};
|
|
||||||
export type JSONSchemaType<T> = StrictNullChecksWrapper<"JSONSchemaType", UncheckedJSONSchemaType<T, false>>;
|
|
||||||
type Known = {
|
|
||||||
[key: string]: Known;
|
|
||||||
} | [Known, ...Known[]] | Known[] | number | string | boolean | null;
|
|
||||||
type UncheckedPropertiesSchema<T> = {
|
|
||||||
[K in keyof T]-?: (UncheckedJSONSchemaType<T[K], false> & Nullable<T[K]>) | {
|
|
||||||
$ref: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
export type PropertiesSchema<T> = StrictNullChecksWrapper<"PropertiesSchema", UncheckedPropertiesSchema<T>>;
|
|
||||||
type UncheckedRequiredMembers<T> = {
|
|
||||||
[K in keyof T]-?: undefined extends T[K] ? never : K;
|
|
||||||
}[keyof T];
|
|
||||||
export type RequiredMembers<T> = StrictNullChecksWrapper<"RequiredMembers", UncheckedRequiredMembers<T>>;
|
|
||||||
type Nullable<T> = undefined extends T ? {
|
|
||||||
nullable: true;
|
|
||||||
const?: null;
|
|
||||||
enum?: readonly (T | null)[];
|
|
||||||
default?: T | null;
|
|
||||||
} : {
|
|
||||||
nullable?: false;
|
|
||||||
const?: T;
|
|
||||||
enum?: readonly T[];
|
|
||||||
default?: T;
|
|
||||||
};
|
|
||||||
export {};
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
//# sourceMappingURL=json-schema.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"json-schema.js","sourceRoot":"","sources":["../../lib/types/json-schema.ts"],"names":[],"mappings":""}
|
|
||||||
-174
@@ -1,174 +0,0 @@
|
|||||||
/** numeric strings */
|
|
||||||
type NumberType = "float32" | "float64" | "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32";
|
|
||||||
/** string strings */
|
|
||||||
type StringType = "string" | "timestamp";
|
|
||||||
/** Generic JTD Schema without inference of the represented type */
|
|
||||||
export type SomeJTDSchemaType = (// ref
|
|
||||||
{
|
|
||||||
ref: string;
|
|
||||||
} | {
|
|
||||||
type: NumberType | StringType | "boolean";
|
|
||||||
} | {
|
|
||||||
enum: string[];
|
|
||||||
} | {
|
|
||||||
elements: SomeJTDSchemaType;
|
|
||||||
} | {
|
|
||||||
values: SomeJTDSchemaType;
|
|
||||||
} | {
|
|
||||||
properties: Record<string, SomeJTDSchemaType>;
|
|
||||||
optionalProperties?: Record<string, SomeJTDSchemaType>;
|
|
||||||
additionalProperties?: boolean;
|
|
||||||
} | {
|
|
||||||
properties?: Record<string, SomeJTDSchemaType>;
|
|
||||||
optionalProperties: Record<string, SomeJTDSchemaType>;
|
|
||||||
additionalProperties?: boolean;
|
|
||||||
} | {
|
|
||||||
discriminator: string;
|
|
||||||
mapping: Record<string, SomeJTDSchemaType>;
|
|
||||||
} | {}) & {
|
|
||||||
nullable?: boolean;
|
|
||||||
metadata?: Record<string, unknown>;
|
|
||||||
definitions?: Record<string, SomeJTDSchemaType>;
|
|
||||||
};
|
|
||||||
/** required keys of an object, not undefined */
|
|
||||||
type RequiredKeys<T> = {
|
|
||||||
[K in keyof T]-?: undefined extends T[K] ? never : K;
|
|
||||||
}[keyof T];
|
|
||||||
/** optional or undifined-able keys of an object */
|
|
||||||
type OptionalKeys<T> = {
|
|
||||||
[K in keyof T]-?: undefined extends T[K] ? K : never;
|
|
||||||
}[keyof T];
|
|
||||||
/** type is true if T is a union type */
|
|
||||||
type IsUnion_<T, U extends T = T> = false extends (T extends unknown ? ([U] extends [T] ? false : true) : never) ? false : true;
|
|
||||||
type IsUnion<T> = IsUnion_<T>;
|
|
||||||
/** type is true if T is identically E */
|
|
||||||
type TypeEquality<T, E> = [T] extends [E] ? ([E] extends [T] ? true : false) : false;
|
|
||||||
/** type is true if T or null is identically E or null*/
|
|
||||||
type NullTypeEquality<T, E> = TypeEquality<T | null, E | null>;
|
|
||||||
/** gets only the string literals of a type or null if a type isn't a string literal */
|
|
||||||
type EnumString<T> = [T] extends [never] ? null : T extends string ? string extends T ? null : T : null;
|
|
||||||
/** true if type is a union of string literals */
|
|
||||||
type IsEnum<T> = null extends EnumString<T> ? false : true;
|
|
||||||
/** true only if all types are array types (not tuples) */
|
|
||||||
type IsElements<T> = false extends IsUnion<T> ? [T] extends [readonly unknown[]] ? undefined extends T[0.5] ? false : true : false : false;
|
|
||||||
/** true if the the type is a values type */
|
|
||||||
type IsValues<T> = false extends IsUnion<T> ? TypeEquality<keyof T, string> : false;
|
|
||||||
/** true if type is a properties type and Union is false, or type is a discriminator type and Union is true */
|
|
||||||
type IsRecord<T, Union extends boolean> = Union extends IsUnion<T> ? null extends EnumString<keyof T> ? false : true : false;
|
|
||||||
/** true if type represents an empty record */
|
|
||||||
type IsEmptyRecord<T> = [T] extends [Record<string, never>] ? [T] extends [never] ? false : true : false;
|
|
||||||
/** actual schema */
|
|
||||||
export type JTDSchemaType<T, D extends Record<string, unknown> = Record<string, never>> = (// refs - where null wasn't specified, must match exactly
|
|
||||||
(null extends EnumString<keyof D> ? never : ({
|
|
||||||
[K in keyof D]: [T] extends [D[K]] ? {
|
|
||||||
ref: K;
|
|
||||||
} : never;
|
|
||||||
}[keyof D] & {
|
|
||||||
nullable?: false;
|
|
||||||
}) | (null extends T ? {
|
|
||||||
[K in keyof D]: [Exclude<T, null>] extends [Exclude<D[K], null>] ? {
|
|
||||||
ref: K;
|
|
||||||
} : never;
|
|
||||||
}[keyof D] & {
|
|
||||||
nullable: true;
|
|
||||||
} : never)) | (unknown extends T ? {
|
|
||||||
nullable?: boolean;
|
|
||||||
} : never) | ((true extends NullTypeEquality<T, number> ? {
|
|
||||||
type: NumberType;
|
|
||||||
} : true extends NullTypeEquality<T, boolean> ? {
|
|
||||||
type: "boolean";
|
|
||||||
} : true extends NullTypeEquality<T, string> ? {
|
|
||||||
type: StringType;
|
|
||||||
} : true extends NullTypeEquality<T, Date> ? {
|
|
||||||
type: "timestamp";
|
|
||||||
} : true extends IsEnum<Exclude<T, null>> ? {
|
|
||||||
enum: EnumString<Exclude<T, null>>[];
|
|
||||||
} : true extends IsElements<Exclude<T, null>> ? T extends readonly (infer E)[] ? {
|
|
||||||
elements: JTDSchemaType<E, D>;
|
|
||||||
} : never : true extends IsEmptyRecord<Exclude<T, null>> ? {
|
|
||||||
properties: Record<string, never>;
|
|
||||||
optionalProperties?: Record<string, never>;
|
|
||||||
} | {
|
|
||||||
optionalProperties: Record<string, never>;
|
|
||||||
} : true extends IsValues<Exclude<T, null>> ? T extends Record<string, infer V> ? {
|
|
||||||
values: JTDSchemaType<V, D>;
|
|
||||||
} : never : true extends IsRecord<Exclude<T, null>, false> ? ([RequiredKeys<Exclude<T, null>>] extends [never] ? {
|
|
||||||
properties?: Record<string, never>;
|
|
||||||
} : {
|
|
||||||
properties: {
|
|
||||||
[K in RequiredKeys<T>]: JTDSchemaType<T[K], D>;
|
|
||||||
};
|
|
||||||
}) & ([OptionalKeys<Exclude<T, null>>] extends [never] ? {
|
|
||||||
optionalProperties?: Record<string, never>;
|
|
||||||
} : {
|
|
||||||
optionalProperties: {
|
|
||||||
[K in OptionalKeys<T>]: JTDSchemaType<Exclude<T[K], undefined>, D>;
|
|
||||||
};
|
|
||||||
}) & {
|
|
||||||
additionalProperties?: boolean;
|
|
||||||
} : true extends IsRecord<Exclude<T, null>, true> ? {
|
|
||||||
[K in keyof Exclude<T, null>]-?: Exclude<T, null>[K] extends string ? {
|
|
||||||
discriminator: K;
|
|
||||||
mapping: {
|
|
||||||
[M in Exclude<T, null>[K]]: JTDSchemaType<Omit<T extends Record<K, M> ? T : never, K>, D>;
|
|
||||||
};
|
|
||||||
} : never;
|
|
||||||
}[keyof Exclude<T, null>] : never) & (null extends T ? {
|
|
||||||
nullable: true;
|
|
||||||
} : {
|
|
||||||
nullable?: false;
|
|
||||||
}))) & {
|
|
||||||
metadata?: Record<string, unknown>;
|
|
||||||
definitions?: {
|
|
||||||
[K in keyof D]: JTDSchemaType<D[K], D>;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
type JTDDataDef<S, D extends Record<string, unknown>> = // ref
|
|
||||||
(S extends {
|
|
||||||
ref: string;
|
|
||||||
} ? D extends {
|
|
||||||
[K in S["ref"]]: infer V;
|
|
||||||
} ? JTDDataDef<V, D> : never : S extends {
|
|
||||||
type: NumberType;
|
|
||||||
} ? number : S extends {
|
|
||||||
type: "boolean";
|
|
||||||
} ? boolean : S extends {
|
|
||||||
type: "string";
|
|
||||||
} ? string : S extends {
|
|
||||||
type: "timestamp";
|
|
||||||
} ? string | Date : S extends {
|
|
||||||
enum: readonly (infer E)[];
|
|
||||||
} ? string extends E ? never : [E] extends [string] ? E : never : S extends {
|
|
||||||
elements: infer E;
|
|
||||||
} ? JTDDataDef<E, D>[] : S extends {
|
|
||||||
properties: Record<string, unknown>;
|
|
||||||
optionalProperties?: Record<string, unknown>;
|
|
||||||
additionalProperties?: boolean;
|
|
||||||
} ? {
|
|
||||||
-readonly [K in keyof S["properties"]]-?: JTDDataDef<S["properties"][K], D>;
|
|
||||||
} & {
|
|
||||||
-readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef<S["optionalProperties"][K], D>;
|
|
||||||
} & ([S["additionalProperties"]] extends [true] ? Record<string, unknown> : unknown) : S extends {
|
|
||||||
properties?: Record<string, unknown>;
|
|
||||||
optionalProperties: Record<string, unknown>;
|
|
||||||
additionalProperties?: boolean;
|
|
||||||
} ? {
|
|
||||||
-readonly [K in keyof S["properties"]]-?: JTDDataDef<S["properties"][K], D>;
|
|
||||||
} & {
|
|
||||||
-readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef<S["optionalProperties"][K], D>;
|
|
||||||
} & ([S["additionalProperties"]] extends [true] ? Record<string, unknown> : unknown) : S extends {
|
|
||||||
values: infer V;
|
|
||||||
} ? Record<string, JTDDataDef<V, D>> : S extends {
|
|
||||||
discriminator: infer M;
|
|
||||||
mapping: Record<string, unknown>;
|
|
||||||
} ? [M] extends [string] ? {
|
|
||||||
[K in keyof S["mapping"]]: JTDDataDef<S["mapping"][K], D> & {
|
|
||||||
[KM in M]: K;
|
|
||||||
};
|
|
||||||
}[keyof S["mapping"]] : never : unknown) | (S extends {
|
|
||||||
nullable: true;
|
|
||||||
} ? null : never);
|
|
||||||
export type JTDDataType<S> = S extends {
|
|
||||||
definitions: Record<string, unknown>;
|
|
||||||
} ? JTDDataDef<S, S["definitions"]> : JTDDataDef<S, Record<string, never>>;
|
|
||||||
export {};
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
//# sourceMappingURL=jtd-schema.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"jtd-schema.js","sourceRoot":"","sources":["../../lib/types/jtd-schema.ts"],"names":[],"mappings":""}
|
|
||||||
-8
@@ -1,8 +0,0 @@
|
|||||||
import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types";
|
|
||||||
import type { KeywordCxt } from "../../compile/validate";
|
|
||||||
export type AdditionalItemsError = ErrorObject<"additionalItems", {
|
|
||||||
limit: number;
|
|
||||||
}, AnySchema>;
|
|
||||||
declare const def: CodeKeywordDefinition;
|
|
||||||
export declare function validateAdditionalItems(cxt: KeywordCxt, items: AnySchema[]): void;
|
|
||||||
export default def;
|
|
||||||
-49
@@ -1,49 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.validateAdditionalItems = void 0;
|
|
||||||
const codegen_1 = require("../../compile/codegen");
|
|
||||||
const util_1 = require("../../compile/util");
|
|
||||||
const error = {
|
|
||||||
message: ({ params: { len } }) => (0, codegen_1.str) `must NOT have more than ${len} items`,
|
|
||||||
params: ({ params: { len } }) => (0, codegen_1._) `{limit: ${len}}`,
|
|
||||||
};
|
|
||||||
const def = {
|
|
||||||
keyword: "additionalItems",
|
|
||||||
type: "array",
|
|
||||||
schemaType: ["boolean", "object"],
|
|
||||||
before: "uniqueItems",
|
|
||||||
error,
|
|
||||||
code(cxt) {
|
|
||||||
const { parentSchema, it } = cxt;
|
|
||||||
const { items } = parentSchema;
|
|
||||||
if (!Array.isArray(items)) {
|
|
||||||
(0, util_1.checkStrictMode)(it, '"additionalItems" is ignored when "items" is not an array of schemas');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
validateAdditionalItems(cxt, items);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
function validateAdditionalItems(cxt, items) {
|
|
||||||
const { gen, schema, data, keyword, it } = cxt;
|
|
||||||
it.items = true;
|
|
||||||
const len = gen.const("len", (0, codegen_1._) `${data}.length`);
|
|
||||||
if (schema === false) {
|
|
||||||
cxt.setParams({ len: items.length });
|
|
||||||
cxt.pass((0, codegen_1._) `${len} <= ${items.length}`);
|
|
||||||
}
|
|
||||||
else if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) {
|
|
||||||
const valid = gen.var("valid", (0, codegen_1._) `${len} <= ${items.length}`); // TODO var
|
|
||||||
gen.if((0, codegen_1.not)(valid), () => validateItems(valid));
|
|
||||||
cxt.ok(valid);
|
|
||||||
}
|
|
||||||
function validateItems(valid) {
|
|
||||||
gen.forRange("i", items.length, len, (i) => {
|
|
||||||
cxt.subschema({ keyword, dataProp: i, dataPropType: util_1.Type.Num }, valid);
|
|
||||||
if (!it.allErrors)
|
|
||||||
gen.if((0, codegen_1.not)(valid), () => gen.break());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.validateAdditionalItems = validateAdditionalItems;
|
|
||||||
exports.default = def;
|
|
||||||
//# sourceMappingURL=additionalItems.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"additionalItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/additionalItems.ts"],"names":[],"mappings":";;;AAOA,mDAAuD;AACvD,6CAA2E;AAI3E,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,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA;IACxC,CAAC;SAAM,IAAI,OAAO,MAAM,IAAI,QAAQ,IAAI,CAAC,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC;QACvE,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,GAAG,GAAG,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA,CAAC,WAAW;QACxE,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAA;QAC9C,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;IAED,SAAS,aAAa,CAAC,KAAW;QAChC,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE;YACzC,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,YAAY,EAAE,WAAI,CAAC,GAAG,EAAC,EAAE,KAAK,CAAC,CAAA;YACpE,IAAI,CAAC,EAAE,CAAC,SAAS;gBAAE,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;QAC1D,CAAC,CAAC,CAAA;IACJ,CAAC;AACH,CAAC;AAnBD,0DAmBC;AAED,kBAAe,GAAG,CAAA"}
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
import type { CodeKeywordDefinition, AddedKeywordDefinition, ErrorObject, AnySchema } from "../../types";
|
|
||||||
export type AdditionalPropertiesError = ErrorObject<"additionalProperties", {
|
|
||||||
additionalProperty: string;
|
|
||||||
}, AnySchema>;
|
|
||||||
declare const def: CodeKeywordDefinition & AddedKeywordDefinition;
|
|
||||||
export default def;
|
|
||||||
-106
@@ -1,106 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const code_1 = require("../code");
|
|
||||||
const codegen_1 = require("../../compile/codegen");
|
|
||||||
const names_1 = require("../../compile/names");
|
|
||||||
const util_1 = require("../../compile/util");
|
|
||||||
const error = {
|
|
||||||
message: "must NOT have additional properties",
|
|
||||||
params: ({ params }) => (0, codegen_1._) `{additionalProperty: ${params.additionalProperty}}`,
|
|
||||||
};
|
|
||||||
const def = {
|
|
||||||
keyword: "additionalProperties",
|
|
||||||
type: ["object"],
|
|
||||||
schemaType: ["boolean", "object"],
|
|
||||||
allowUndefined: true,
|
|
||||||
trackErrors: true,
|
|
||||||
error,
|
|
||||||
code(cxt) {
|
|
||||||
const { gen, schema, parentSchema, data, errsCount, it } = cxt;
|
|
||||||
/* istanbul ignore if */
|
|
||||||
if (!errsCount)
|
|
||||||
throw new Error("ajv implementation error");
|
|
||||||
const { allErrors, opts } = it;
|
|
||||||
it.props = true;
|
|
||||||
if (opts.removeAdditional !== "all" && (0, util_1.alwaysValidSchema)(it, schema))
|
|
||||||
return;
|
|
||||||
const props = (0, code_1.allSchemaProperties)(parentSchema.properties);
|
|
||||||
const patProps = (0, code_1.allSchemaProperties)(parentSchema.patternProperties);
|
|
||||||
checkAdditionalProperties();
|
|
||||||
cxt.ok((0, codegen_1._) `${errsCount} === ${names_1.default.errors}`);
|
|
||||||
function checkAdditionalProperties() {
|
|
||||||
gen.forIn("key", data, (key) => {
|
|
||||||
if (!props.length && !patProps.length)
|
|
||||||
additionalPropertyCode(key);
|
|
||||||
else
|
|
||||||
gen.if(isAdditional(key), () => additionalPropertyCode(key));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function isAdditional(key) {
|
|
||||||
let definedProp;
|
|
||||||
if (props.length > 8) {
|
|
||||||
// TODO maybe an option instead of hard-coded 8?
|
|
||||||
const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema.properties, "properties");
|
|
||||||
definedProp = (0, code_1.isOwnProperty)(gen, propsSchema, key);
|
|
||||||
}
|
|
||||||
else if (props.length) {
|
|
||||||
definedProp = (0, codegen_1.or)(...props.map((p) => (0, codegen_1._) `${key} === ${p}`));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
definedProp = codegen_1.nil;
|
|
||||||
}
|
|
||||||
if (patProps.length) {
|
|
||||||
definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p) => (0, codegen_1._) `${(0, code_1.usePattern)(cxt, p)}.test(${key})`));
|
|
||||||
}
|
|
||||||
return (0, codegen_1.not)(definedProp);
|
|
||||||
}
|
|
||||||
function deleteAdditional(key) {
|
|
||||||
gen.code((0, codegen_1._) `delete ${data}[${key}]`);
|
|
||||||
}
|
|
||||||
function additionalPropertyCode(key) {
|
|
||||||
if (opts.removeAdditional === "all" || (opts.removeAdditional && schema === false)) {
|
|
||||||
deleteAdditional(key);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (schema === false) {
|
|
||||||
cxt.setParams({ additionalProperty: key });
|
|
||||||
cxt.error();
|
|
||||||
if (!allErrors)
|
|
||||||
gen.break();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) {
|
|
||||||
const valid = gen.name("valid");
|
|
||||||
if (opts.removeAdditional === "failing") {
|
|
||||||
applyAdditionalSchema(key, valid, false);
|
|
||||||
gen.if((0, codegen_1.not)(valid), () => {
|
|
||||||
cxt.reset();
|
|
||||||
deleteAdditional(key);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
applyAdditionalSchema(key, valid);
|
|
||||||
if (!allErrors)
|
|
||||||
gen.if((0, codegen_1.not)(valid), () => gen.break());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function applyAdditionalSchema(key, valid, errors) {
|
|
||||||
const subschema = {
|
|
||||||
keyword: "additionalProperties",
|
|
||||||
dataProp: key,
|
|
||||||
dataPropType: util_1.Type.Str,
|
|
||||||
};
|
|
||||||
if (errors === false) {
|
|
||||||
Object.assign(subschema, {
|
|
||||||
compositeRule: true,
|
|
||||||
createErrors: false,
|
|
||||||
allErrors: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
cxt.subschema(subschema, valid);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
exports.default = def;
|
|
||||||
//# sourceMappingURL=additionalProperties.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"additionalProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/additionalProperties.ts"],"names":[],"mappings":";;AAOA,kCAAsE;AACtE,mDAAiE;AACjE,+CAAmC;AAEnC,6CAA0E;AAQ1E,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,qCAAqC;IAC9C,MAAM,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,wBAAwB,MAAM,CAAC,kBAAkB,GAAG;CAC5E,CAAA;AAED,MAAM,GAAG,GAAmD;IAC1D,OAAO,EAAE,sBAAsB;IAC/B,IAAI,EAAE,CAAC,QAAQ,CAAC;IAChB,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;IACjC,cAAc,EAAE,IAAI;IACpB,WAAW,EAAE,IAAI;IACjB,KAAK;IACL,IAAI,CAAC,GAAG;QACN,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC5D,wBAAwB;QACxB,IAAI,CAAC,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC3D,MAAM,EAAC,SAAS,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;QAC5B,EAAE,CAAC,KAAK,GAAG,IAAI,CAAA;QACf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,gBAAgB,KAAK,SAAS,EAAE,CAAC;oBACxC,qBAAqB,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;oBACxC,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE;wBACtB,GAAG,CAAC,KAAK,EAAE,CAAA;wBACX,gBAAgB,CAAC,GAAG,CAAC,CAAA;oBACvB,CAAC,CAAC,CAAA;gBACJ,CAAC;qBAAM,CAAC;oBACN,qBAAqB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;oBACjC,IAAI,CAAC,SAAS;wBAAE,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;gBACvD,CAAC;YACH,CAAC;QACH,CAAC;QAED,SAAS,qBAAqB,CAAC,GAAS,EAAE,KAAW,EAAE,MAAc;YACnE,MAAM,SAAS,GAAkB;gBAC/B,OAAO,EAAE,sBAAsB;gBAC/B,QAAQ,EAAE,GAAG;gBACb,YAAY,EAAE,WAAI,CAAC,GAAG;aACvB,CAAA;YACD,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;gBACrB,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE;oBACvB,aAAa,EAAE,IAAI;oBACnB,YAAY,EAAE,KAAK;oBACnB,SAAS,EAAE,KAAK;iBACjB,CAAC,CAAA;YACJ,CAAC;YACD,GAAG,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;QACjC,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"}
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
import type { CodeKeywordDefinition } from "../../types";
|
|
||||||
declare const def: CodeKeywordDefinition;
|
|
||||||
export default def;
|
|
||||||
-23
@@ -1,23 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const util_1 = require("../../compile/util");
|
|
||||||
const def = {
|
|
||||||
keyword: "allOf",
|
|
||||||
schemaType: "array",
|
|
||||||
code(cxt) {
|
|
||||||
const { gen, schema, it } = cxt;
|
|
||||||
/* istanbul ignore if */
|
|
||||||
if (!Array.isArray(schema))
|
|
||||||
throw new Error("ajv implementation error");
|
|
||||||
const valid = gen.name("valid");
|
|
||||||
schema.forEach((sch, i) => {
|
|
||||||
if ((0, util_1.alwaysValidSchema)(it, sch))
|
|
||||||
return;
|
|
||||||
const schCxt = cxt.subschema({ keyword: "allOf", schemaProp: i }, valid);
|
|
||||||
cxt.ok(valid);
|
|
||||||
cxt.mergeEvaluated(schCxt);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
|
||||||
exports.default = def;
|
|
||||||
//# sourceMappingURL=allOf.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"allOf.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/allOf.ts"],"names":[],"mappings":";;AAEA,6CAAoD;AAEpD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,OAAO;IACnB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC7B,wBAAwB;QACxB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QACvE,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,MAAM,CAAC,OAAO,CAAC,CAAC,GAAc,EAAE,CAAS,EAAE,EAAE;YAC3C,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,GAAG,CAAC;gBAAE,OAAM;YACtC,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,EAAC,EAAE,KAAK,CAAC,CAAA;YACtE,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;YACb,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;QAC5B,CAAC,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"}
|
|
||||||
-4
@@ -1,4 +0,0 @@
|
|||||||
import type { CodeKeywordDefinition, ErrorNoParams, AnySchema } from "../../types";
|
|
||||||
export type AnyOfError = ErrorNoParams<"anyOf", AnySchema[]>;
|
|
||||||
declare const def: CodeKeywordDefinition;
|
|
||||||
export default def;
|
|
||||||
-12
@@ -1,12 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const code_1 = require("../code");
|
|
||||||
const def = {
|
|
||||||
keyword: "anyOf",
|
|
||||||
schemaType: "array",
|
|
||||||
trackErrors: true,
|
|
||||||
code: code_1.validateUnion,
|
|
||||||
error: { message: "must match a schema in anyOf" },
|
|
||||||
};
|
|
||||||
exports.default = def;
|
|
||||||
//# sourceMappingURL=anyOf.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"anyOf.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/anyOf.ts"],"names":[],"mappings":";;AACA,kCAAqC;AAIrC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,IAAI;IACjB,IAAI,EAAE,oBAAa;IACnB,KAAK,EAAE,EAAC,OAAO,EAAE,8BAA8B,EAAC;CACjD,CAAA;AAED,kBAAe,GAAG,CAAA"}
|
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types";
|
|
||||||
export type ContainsError = ErrorObject<"contains", {
|
|
||||||
minContains: number;
|
|
||||||
maxContains?: number;
|
|
||||||
}, AnySchema>;
|
|
||||||
declare const def: CodeKeywordDefinition;
|
|
||||||
export default def;
|
|
||||||
-95
@@ -1,95 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const codegen_1 = require("../../compile/codegen");
|
|
||||||
const util_1 = require("../../compile/util");
|
|
||||||
const error = {
|
|
||||||
message: ({ params: { min, max } }) => max === undefined
|
|
||||||
? (0, codegen_1.str) `must contain at least ${min} valid item(s)`
|
|
||||||
: (0, codegen_1.str) `must contain at least ${min} and no more than ${max} valid item(s)`,
|
|
||||||
params: ({ params: { min, max } }) => max === undefined ? (0, codegen_1._) `{minContains: ${min}}` : (0, codegen_1._) `{minContains: ${min}, maxContains: ${max}}`,
|
|
||||||
};
|
|
||||||
const def = {
|
|
||||||
keyword: "contains",
|
|
||||||
type: "array",
|
|
||||||
schemaType: ["object", "boolean"],
|
|
||||||
before: "uniqueItems",
|
|
||||||
trackErrors: true,
|
|
||||||
error,
|
|
||||||
code(cxt) {
|
|
||||||
const { gen, schema, parentSchema, data, it } = cxt;
|
|
||||||
let min;
|
|
||||||
let max;
|
|
||||||
const { minContains, maxContains } = parentSchema;
|
|
||||||
if (it.opts.next) {
|
|
||||||
min = minContains === undefined ? 1 : minContains;
|
|
||||||
max = maxContains;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
min = 1;
|
|
||||||
}
|
|
||||||
const len = gen.const("len", (0, codegen_1._) `${data}.length`);
|
|
||||||
cxt.setParams({ min, max });
|
|
||||||
if (max === undefined && min === 0) {
|
|
||||||
(0, util_1.checkStrictMode)(it, `"minContains" == 0 without "maxContains": "contains" keyword ignored`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (max !== undefined && min > max) {
|
|
||||||
(0, util_1.checkStrictMode)(it, `"minContains" > "maxContains" is always invalid`);
|
|
||||||
cxt.fail();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ((0, util_1.alwaysValidSchema)(it, schema)) {
|
|
||||||
let cond = (0, codegen_1._) `${len} >= ${min}`;
|
|
||||||
if (max !== undefined)
|
|
||||||
cond = (0, codegen_1._) `${cond} && ${len} <= ${max}`;
|
|
||||||
cxt.pass(cond);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
it.items = true;
|
|
||||||
const valid = gen.name("valid");
|
|
||||||
if (max === undefined && min === 1) {
|
|
||||||
validateItems(valid, () => gen.if(valid, () => gen.break()));
|
|
||||||
}
|
|
||||||
else if (min === 0) {
|
|
||||||
gen.let(valid, true);
|
|
||||||
if (max !== undefined)
|
|
||||||
gen.if((0, codegen_1._) `${data}.length > 0`, validateItemsWithCount);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
gen.let(valid, false);
|
|
||||||
validateItemsWithCount();
|
|
||||||
}
|
|
||||||
cxt.result(valid, () => cxt.reset());
|
|
||||||
function validateItemsWithCount() {
|
|
||||||
const schValid = gen.name("_valid");
|
|
||||||
const count = gen.let("count", 0);
|
|
||||||
validateItems(schValid, () => gen.if(schValid, () => checkLimits(count)));
|
|
||||||
}
|
|
||||||
function validateItems(_valid, block) {
|
|
||||||
gen.forRange("i", 0, len, (i) => {
|
|
||||||
cxt.subschema({
|
|
||||||
keyword: "contains",
|
|
||||||
dataProp: i,
|
|
||||||
dataPropType: util_1.Type.Num,
|
|
||||||
compositeRule: true,
|
|
||||||
}, _valid);
|
|
||||||
block();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function checkLimits(count) {
|
|
||||||
gen.code((0, codegen_1._) `${count}++`);
|
|
||||||
if (max === undefined) {
|
|
||||||
gen.if((0, codegen_1._) `${count} >= ${min}`, () => gen.assign(valid, true).break());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
gen.if((0, codegen_1._) `${count} > ${max}`, () => gen.assign(valid, false).break());
|
|
||||||
if (min === 1)
|
|
||||||
gen.assign(valid, true);
|
|
||||||
else
|
|
||||||
gen.if((0, codegen_1._) `${count} >= ${min}`, () => gen.assign(valid, true));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
exports.default = def;
|
|
||||||
//# sourceMappingURL=contains.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"contains.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/contains.ts"],"names":[],"mappings":";;AAOA,mDAAkD;AAClD,6CAA2E;AAQ3E,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAE,GAAG,EAAC,EAAC,EAAE,EAAE,CAChC,GAAG,KAAK,SAAS;QACf,CAAC,CAAC,IAAA,aAAG,EAAA,yBAAyB,GAAG,gBAAgB;QACjD,CAAC,CAAC,IAAA,aAAG,EAAA,yBAAyB,GAAG,qBAAqB,GAAG,gBAAgB;IAC7E,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAE,GAAG,EAAC,EAAC,EAAE,EAAE,CAC/B,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,iBAAiB,GAAG,GAAG,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,iBAAiB,GAAG,kBAAkB,GAAG,GAAG;CAC/F,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,MAAM,EAAE,aAAa;IACrB,WAAW,EAAE,IAAI;IACjB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACjD,IAAI,GAAW,CAAA;QACf,IAAI,GAAuB,CAAA;QAC3B,MAAM,EAAC,WAAW,EAAE,WAAW,EAAC,GAAG,YAAY,CAAA;QAC/C,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACjB,GAAG,GAAG,WAAW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J,CAAC;QAED,SAAS,WAAW,CAAC,KAAW;YAC9B,GAAG,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,IAAI,CAAC,CAAA;YACvB,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;gBACtB,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,OAAO,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;YACtE,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,MAAM,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;gBACpE,IAAI,GAAG,KAAK,CAAC;oBAAE,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;;oBACjC,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,OAAO,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;YACnE,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"}
|
|
||||||
-21
@@ -1,21 +0,0 @@
|
|||||||
import type { CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition, SchemaMap, AnySchema } from "../../types";
|
|
||||||
import type { KeywordCxt } from "../../compile/validate";
|
|
||||||
export type PropertyDependencies = {
|
|
||||||
[K in string]?: string[];
|
|
||||||
};
|
|
||||||
export interface DependenciesErrorParams {
|
|
||||||
property: string;
|
|
||||||
missingProperty: string;
|
|
||||||
depsCount: number;
|
|
||||||
deps: string;
|
|
||||||
}
|
|
||||||
export type DependenciesError = ErrorObject<"dependencies", DependenciesErrorParams, {
|
|
||||||
[K in string]?: string[] | AnySchema;
|
|
||||||
}>;
|
|
||||||
export declare const error: KeywordErrorDefinition;
|
|
||||||
declare const def: CodeKeywordDefinition;
|
|
||||||
export declare function validatePropertyDeps(cxt: KeywordCxt, propertyDeps?: {
|
|
||||||
[K in string]?: string[];
|
|
||||||
}): void;
|
|
||||||
export declare function validateSchemaDeps(cxt: KeywordCxt, schemaDeps?: SchemaMap): void;
|
|
||||||
export default def;
|
|
||||||
-85
@@ -1,85 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = void 0;
|
|
||||||
const codegen_1 = require("../../compile/codegen");
|
|
||||||
const util_1 = require("../../compile/util");
|
|
||||||
const code_1 = require("../code");
|
|
||||||
exports.error = {
|
|
||||||
message: ({ params: { property, depsCount, deps } }) => {
|
|
||||||
const property_ies = depsCount === 1 ? "property" : "properties";
|
|
||||||
return (0, codegen_1.str) `must have ${property_ies} ${deps} when property ${property} is present`;
|
|
||||||
},
|
|
||||||
params: ({ params: { property, depsCount, deps, missingProperty } }) => (0, codegen_1._) `{property: ${property},
|
|
||||||
missingProperty: ${missingProperty},
|
|
||||||
depsCount: ${depsCount},
|
|
||||||
deps: ${deps}}`, // TODO change to reference
|
|
||||||
};
|
|
||||||
const def = {
|
|
||||||
keyword: "dependencies",
|
|
||||||
type: "object",
|
|
||||||
schemaType: "object",
|
|
||||||
error: exports.error,
|
|
||||||
code(cxt) {
|
|
||||||
const [propDeps, schDeps] = splitDependencies(cxt);
|
|
||||||
validatePropertyDeps(cxt, propDeps);
|
|
||||||
validateSchemaDeps(cxt, schDeps);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
function splitDependencies({ schema }) {
|
|
||||||
const propertyDeps = {};
|
|
||||||
const schemaDeps = {};
|
|
||||||
for (const key in schema) {
|
|
||||||
if (key === "__proto__")
|
|
||||||
continue;
|
|
||||||
const deps = Array.isArray(schema[key]) ? propertyDeps : schemaDeps;
|
|
||||||
deps[key] = schema[key];
|
|
||||||
}
|
|
||||||
return [propertyDeps, schemaDeps];
|
|
||||||
}
|
|
||||||
function validatePropertyDeps(cxt, propertyDeps = cxt.schema) {
|
|
||||||
const { gen, data, it } = cxt;
|
|
||||||
if (Object.keys(propertyDeps).length === 0)
|
|
||||||
return;
|
|
||||||
const missing = gen.let("missing");
|
|
||||||
for (const prop in propertyDeps) {
|
|
||||||
const deps = propertyDeps[prop];
|
|
||||||
if (deps.length === 0)
|
|
||||||
continue;
|
|
||||||
const hasProperty = (0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties);
|
|
||||||
cxt.setParams({
|
|
||||||
property: prop,
|
|
||||||
depsCount: deps.length,
|
|
||||||
deps: deps.join(", "),
|
|
||||||
});
|
|
||||||
if (it.allErrors) {
|
|
||||||
gen.if(hasProperty, () => {
|
|
||||||
for (const depProp of deps) {
|
|
||||||
(0, code_1.checkReportMissingProp)(cxt, depProp);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
gen.if((0, codegen_1._) `${hasProperty} && (${(0, code_1.checkMissingProp)(cxt, deps, missing)})`);
|
|
||||||
(0, code_1.reportMissingProp)(cxt, missing);
|
|
||||||
gen.else();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.validatePropertyDeps = validatePropertyDeps;
|
|
||||||
function validateSchemaDeps(cxt, schemaDeps = cxt.schema) {
|
|
||||||
const { gen, data, keyword, it } = cxt;
|
|
||||||
const valid = gen.name("valid");
|
|
||||||
for (const prop in schemaDeps) {
|
|
||||||
if ((0, util_1.alwaysValidSchema)(it, schemaDeps[prop]))
|
|
||||||
continue;
|
|
||||||
gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties), () => {
|
|
||||||
const schCxt = cxt.subschema({ keyword, schemaProp: prop }, valid);
|
|
||||||
cxt.mergeValidEvaluated(schCxt, valid);
|
|
||||||
}, () => gen.var(valid, true) // TODO var
|
|
||||||
);
|
|
||||||
cxt.ok(valid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.validateSchemaDeps = validateSchemaDeps;
|
|
||||||
exports.default = def;
|
|
||||||
//# sourceMappingURL=dependencies.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/dependencies.ts"],"names":[],"mappings":";;;AAQA,mDAA4C;AAC5C,6CAAoD;AACpD,kCAAmG;AAmBtF,QAAA,KAAK,GAA2B;IAC3C,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAC,EAAC,EAAE,EAAE;QACjD,MAAM,YAAY,GAAG,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAA;QAChE,OAAO,IAAA,aAAG,EAAA,aAAa,YAAY,IAAI,IAAI,kBAAkB,QAAQ,aAAa,CAAA;IACpF,CAAC;IACD,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAC,EAAC,EAAE,EAAE,CACjE,IAAA,WAAC,EAAA,cAAc,QAAQ;uBACJ,eAAe;iBACrB,SAAS;YACd,IAAI,GAAG,EAAE,2BAA2B;CAC/C,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,cAAc;IACvB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAL,aAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAA;QAClD,oBAAoB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;QACnC,kBAAkB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IAClC,CAAC;CAC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,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,WAAW;SACvC,CAAA;QACD,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;AACH,CAAC;AAfD,gDAeC;AAED,kBAAe,GAAG,CAAA"}
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
import type { CodeKeywordDefinition } from "../../types";
|
|
||||||
declare const def: CodeKeywordDefinition;
|
|
||||||
export default def;
|
|
||||||
-11
@@ -1,11 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const dependencies_1 = require("./dependencies");
|
|
||||||
const def = {
|
|
||||||
keyword: "dependentSchemas",
|
|
||||||
type: "object",
|
|
||||||
schemaType: "object",
|
|
||||||
code: (cxt) => (0, dependencies_1.validateSchemaDeps)(cxt),
|
|
||||||
};
|
|
||||||
exports.default = def;
|
|
||||||
//# sourceMappingURL=dependentSchemas.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"dependentSchemas.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/dependentSchemas.ts"],"names":[],"mappings":";;AACA,iDAAiD;AAEjD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,kBAAkB;IAC3B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,iCAAkB,EAAC,GAAG,CAAC;CACvC,CAAA;AAED,kBAAe,GAAG,CAAA"}
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types";
|
|
||||||
export type IfKeywordError = ErrorObject<"if", {
|
|
||||||
failingKeyword: string;
|
|
||||||
}, AnySchema>;
|
|
||||||
declare const def: CodeKeywordDefinition;
|
|
||||||
export default def;
|
|
||||||
-66
@@ -1,66 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const codegen_1 = require("../../compile/codegen");
|
|
||||||
const util_1 = require("../../compile/util");
|
|
||||||
const error = {
|
|
||||||
message: ({ params }) => (0, codegen_1.str) `must match "${params.ifClause}" schema`,
|
|
||||||
params: ({ params }) => (0, codegen_1._) `{failingKeyword: ${params.ifClause}}`,
|
|
||||||
};
|
|
||||||
const def = {
|
|
||||||
keyword: "if",
|
|
||||||
schemaType: ["object", "boolean"],
|
|
||||||
trackErrors: true,
|
|
||||||
error,
|
|
||||||
code(cxt) {
|
|
||||||
const { gen, parentSchema, it } = cxt;
|
|
||||||
if (parentSchema.then === undefined && parentSchema.else === undefined) {
|
|
||||||
(0, util_1.checkStrictMode)(it, '"if" without "then" and "else" is ignored');
|
|
||||||
}
|
|
||||||
const hasThen = hasSchema(it, "then");
|
|
||||||
const hasElse = hasSchema(it, "else");
|
|
||||||
if (!hasThen && !hasElse)
|
|
||||||
return;
|
|
||||||
const valid = gen.let("valid", true);
|
|
||||||
const schValid = gen.name("_valid");
|
|
||||||
validateIf();
|
|
||||||
cxt.reset();
|
|
||||||
if (hasThen && hasElse) {
|
|
||||||
const ifClause = gen.let("ifClause");
|
|
||||||
cxt.setParams({ ifClause });
|
|
||||||
gen.if(schValid, validateClause("then", ifClause), validateClause("else", ifClause));
|
|
||||||
}
|
|
||||||
else if (hasThen) {
|
|
||||||
gen.if(schValid, validateClause("then"));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
gen.if((0, codegen_1.not)(schValid), validateClause("else"));
|
|
||||||
}
|
|
||||||
cxt.pass(valid, () => cxt.error(true));
|
|
||||||
function validateIf() {
|
|
||||||
const schCxt = cxt.subschema({
|
|
||||||
keyword: "if",
|
|
||||||
compositeRule: true,
|
|
||||||
createErrors: false,
|
|
||||||
allErrors: false,
|
|
||||||
}, schValid);
|
|
||||||
cxt.mergeEvaluated(schCxt);
|
|
||||||
}
|
|
||||||
function validateClause(keyword, ifClause) {
|
|
||||||
return () => {
|
|
||||||
const schCxt = cxt.subschema({ keyword }, schValid);
|
|
||||||
gen.assign(valid, schValid);
|
|
||||||
cxt.mergeValidEvaluated(schCxt, valid);
|
|
||||||
if (ifClause)
|
|
||||||
gen.assign(ifClause, (0, codegen_1._) `${keyword}`);
|
|
||||||
else
|
|
||||||
cxt.setParams({ ifClause: keyword });
|
|
||||||
};
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
function hasSchema(it, keyword) {
|
|
||||||
const schema = it.schema[keyword];
|
|
||||||
return schema !== undefined && !(0, util_1.alwaysValidSchema)(it, schema);
|
|
||||||
}
|
|
||||||
exports.default = def;
|
|
||||||
//# sourceMappingURL=if.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"if.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/if.ts"],"names":[],"mappings":";;AAQA,mDAAuD;AACvD,6CAAqE;AAIrE,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,eAAe,MAAM,CAAC,QAAQ,UAAU;IAClE,MAAM,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,oBAAoB,MAAM,CAAC,QAAQ,GAAG;CAC9D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,WAAW,EAAE,IAAI;IACjB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,IAAI,YAAY,CAAC,IAAI,KAAK,SAAS,IAAI,YAAY,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACvE,IAAA,sBAAe,EAAC,EAAE,EAAE,2CAA2C,CAAC,CAAA;QAClE,C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AE,KAAK;aACjB,EACD,QAAQ,CACT,CAAA;YACD,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;QAC5B,CAAC;QAED,SAAS,cAAc,CAAC,OAAe,EAAE,QAAe;YACtD,OAAO,GAAG,EAAE;gBACV,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAC,EAAE,QAAQ,CAAC,CAAA;gBACjD,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;gBAC3B,GAAG,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;gBACtC,IAAI,QAAQ;oBAAE,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAA,WAAC,EAAA,GAAG,OAAO,EAAE,CAAC,CAAA;;oBAC5C,GAAG,CAAC,SAAS,CAAC,EAAC,QAAQ,EAAE,OAAO,EAAC,CAAC,CAAA;YACzC,CAAC,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,SAAS,SAAS,CAAC,EAAgB,EAAE,OAAe;IAClD,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACjC,OAAO,MAAM,KAAK,SAAS,IAAI,CAAC,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,CAAA;AAC/D,CAAC;AAED,kBAAe,GAAG,CAAA"}
|
|
||||||
-13
@@ -1,13 +0,0 @@
|
|||||||
import type { ErrorNoParams, Vocabulary } from "../../types";
|
|
||||||
import { AdditionalItemsError } from "./additionalItems";
|
|
||||||
import { ItemsError } from "./items2020";
|
|
||||||
import { ContainsError } from "./contains";
|
|
||||||
import { DependenciesError } from "./dependencies";
|
|
||||||
import { PropertyNamesError } from "./propertyNames";
|
|
||||||
import { AdditionalPropertiesError } from "./additionalProperties";
|
|
||||||
import { NotKeywordError } from "./not";
|
|
||||||
import { AnyOfError } from "./anyOf";
|
|
||||||
import { OneOfError } from "./oneOf";
|
|
||||||
import { IfKeywordError } from "./if";
|
|
||||||
export default function getApplicator(draft2020?: boolean): Vocabulary;
|
|
||||||
export type ApplicatorKeywordError = ErrorNoParams<"false schema"> | AdditionalItemsError | ItemsError | ContainsError | AdditionalPropertiesError | DependenciesError | IfKeywordError | AnyOfError | OneOfError | NotKeywordError | PropertyNamesError;
|
|
||||||
-44
@@ -1,44 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const additionalItems_1 = require("./additionalItems");
|
|
||||||
const prefixItems_1 = require("./prefixItems");
|
|
||||||
const items_1 = require("./items");
|
|
||||||
const items2020_1 = require("./items2020");
|
|
||||||
const contains_1 = require("./contains");
|
|
||||||
const dependencies_1 = require("./dependencies");
|
|
||||||
const propertyNames_1 = require("./propertyNames");
|
|
||||||
const additionalProperties_1 = require("./additionalProperties");
|
|
||||||
const properties_1 = require("./properties");
|
|
||||||
const patternProperties_1 = require("./patternProperties");
|
|
||||||
const not_1 = require("./not");
|
|
||||||
const anyOf_1 = require("./anyOf");
|
|
||||||
const oneOf_1 = require("./oneOf");
|
|
||||||
const allOf_1 = require("./allOf");
|
|
||||||
const if_1 = require("./if");
|
|
||||||
const thenElse_1 = require("./thenElse");
|
|
||||||
function getApplicator(draft2020 = false) {
|
|
||||||
const applicator = [
|
|
||||||
// any
|
|
||||||
not_1.default,
|
|
||||||
anyOf_1.default,
|
|
||||||
oneOf_1.default,
|
|
||||||
allOf_1.default,
|
|
||||||
if_1.default,
|
|
||||||
thenElse_1.default,
|
|
||||||
// object
|
|
||||||
propertyNames_1.default,
|
|
||||||
additionalProperties_1.default,
|
|
||||||
dependencies_1.default,
|
|
||||||
properties_1.default,
|
|
||||||
patternProperties_1.default,
|
|
||||||
];
|
|
||||||
// array
|
|
||||||
if (draft2020)
|
|
||||||
applicator.push(prefixItems_1.default, items2020_1.default);
|
|
||||||
else
|
|
||||||
applicator.push(additionalItems_1.default, items_1.default);
|
|
||||||
applicator.push(contains_1.default);
|
|
||||||
return applicator;
|
|
||||||
}
|
|
||||||
exports.default = getApplicator;
|
|
||||||
//# sourceMappingURL=index.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/index.ts"],"names":[],"mappings":";;AACA,uDAAuE;AACvE,+CAAuC;AACvC,mCAA2B;AAC3B,2CAAiD;AACjD,yCAAkD;AAClD,iDAA8D;AAC9D,mDAAiE;AACjE,iEAAsF;AACtF,6CAAqC;AACrC,2DAAmD;AACnD,+BAAiD;AACjD,mCAAyC;AACzC,mCAAyC;AACzC,mCAA2B;AAC3B,6BAA8C;AAC9C,yCAAiC;AAEjC,SAAwB,aAAa,CAAC,SAAS,GAAG,KAAK;IACrD,MAAM,UAAU,GAAG;QACjB,MAAM;QACN,aAAU;QACV,eAAK;QACL,eAAK;QACL,eAAK;QACL,YAAS;QACT,kBAAQ;QACR,SAAS;QACT,uBAAa;QACb,8BAAoB;QACpB,sBAAY;QACZ,oBAAU;QACV,2BAAiB;KAClB,CAAA;IACD,QAAQ;IACR,IAAI,SAAS;QAAE,UAAU,CAAC,IAAI,CAAC,qBAAW,EAAE,mBAAS,CAAC,CAAA;;QACjD,UAAU,CAAC,IAAI,CAAC,yBAAe,EAAE,eAAK,CAAC,CAAA;IAC5C,UAAU,CAAC,IAAI,CAAC,kBAAQ,CAAC,CAAA;IACzB,OAAO,UAAU,CAAA;AACnB,CAAC;AArBD,gCAqBC"}
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
import type { CodeKeywordDefinition, AnySchema } from "../../types";
|
|
||||||
import type { KeywordCxt } from "../../compile/validate";
|
|
||||||
declare const def: CodeKeywordDefinition;
|
|
||||||
export declare function validateTuple(cxt: KeywordCxt, extraItems: string, schArr?: AnySchema[]): void;
|
|
||||||
export default def;
|
|
||||||
-52
@@ -1,52 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.validateTuple = void 0;
|
|
||||||
const codegen_1 = require("../../compile/codegen");
|
|
||||||
const util_1 = require("../../compile/util");
|
|
||||||
const code_1 = require("../code");
|
|
||||||
const def = {
|
|
||||||
keyword: "items",
|
|
||||||
type: "array",
|
|
||||||
schemaType: ["object", "array", "boolean"],
|
|
||||||
before: "uniqueItems",
|
|
||||||
code(cxt) {
|
|
||||||
const { schema, it } = cxt;
|
|
||||||
if (Array.isArray(schema))
|
|
||||||
return validateTuple(cxt, "additionalItems", schema);
|
|
||||||
it.items = true;
|
|
||||||
if ((0, util_1.alwaysValidSchema)(it, schema))
|
|
||||||
return;
|
|
||||||
cxt.ok((0, code_1.validateArray)(cxt));
|
|
||||||
},
|
|
||||||
};
|
|
||||||
function validateTuple(cxt, extraItems, schArr = cxt.schema) {
|
|
||||||
const { gen, parentSchema, data, keyword, it } = cxt;
|
|
||||||
checkStrictTuple(parentSchema);
|
|
||||||
if (it.opts.unevaluated && schArr.length && it.items !== true) {
|
|
||||||
it.items = util_1.mergeEvaluated.items(gen, schArr.length, it.items);
|
|
||||||
}
|
|
||||||
const valid = gen.name("valid");
|
|
||||||
const len = gen.const("len", (0, codegen_1._) `${data}.length`);
|
|
||||||
schArr.forEach((sch, i) => {
|
|
||||||
if ((0, util_1.alwaysValidSchema)(it, sch))
|
|
||||||
return;
|
|
||||||
gen.if((0, codegen_1._) `${len} > ${i}`, () => cxt.subschema({
|
|
||||||
keyword,
|
|
||||||
schemaProp: i,
|
|
||||||
dataProp: i,
|
|
||||||
}, valid));
|
|
||||||
cxt.ok(valid);
|
|
||||||
});
|
|
||||||
function checkStrictTuple(sch) {
|
|
||||||
const { opts, errSchemaPath } = it;
|
|
||||||
const l = schArr.length;
|
|
||||||
const fullTuple = l === sch.minItems && (l === sch.maxItems || sch[extraItems] === false);
|
|
||||||
if (opts.strictTuples && !fullTuple) {
|
|
||||||
const msg = `"${keyword}" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different at path "${errSchemaPath}"`;
|
|
||||||
(0, util_1.checkStrictMode)(it, msg, opts.strictTuples);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.validateTuple = validateTuple;
|
|
||||||
exports.default = def;
|
|
||||||
//# sourceMappingURL=items.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"items.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/items.ts"],"names":[],"mappings":";;;AAEA,mDAAuC;AACvC,6CAAqF;AACrF,kCAAqC;AAErC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC;IAC1C,MAAM,EAAE,aAAa;IACrB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACxB,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,OAAO,aAAa,CAAC,GAAG,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAA;QAC/E,EAAE,CAAC,KAAK,GAAG,IAAI,CAAA;QACf,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QACzC,GAAG,CAAC,EAAE,CAAC,IAAA,oBAAa,EAAC,GAAG,CAAC,CAAC,CAAA;IAC5B,CAAC;CACF,CAAA;AAED,SAAgB,aAAa,CAC3B,GAAe,EACf,UAAkB,EAClB,SAAsB,GAAG,CAAC,MAAM;IAEhC,MAAM,EAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IAClD,gBAAgB,CAAC,YAAY,CAAC,CAAA;IAC9B,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,IAAI,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;QAC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,CAAC,YAAY,CAAC,CAAA;QAC7C,CAAC;IACH,CAAC;AACH,CAAC;AApCD,sCAoCC;AAED,kBAAe,GAAG,CAAA"}
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types";
|
|
||||||
export type ItemsError = ErrorObject<"items", {
|
|
||||||
limit: number;
|
|
||||||
}, AnySchema>;
|
|
||||||
declare const def: CodeKeywordDefinition;
|
|
||||||
export default def;
|
|
||||||
-30
@@ -1,30 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const codegen_1 = require("../../compile/codegen");
|
|
||||||
const util_1 = require("../../compile/util");
|
|
||||||
const code_1 = require("../code");
|
|
||||||
const additionalItems_1 = require("./additionalItems");
|
|
||||||
const error = {
|
|
||||||
message: ({ params: { len } }) => (0, codegen_1.str) `must NOT have more than ${len} items`,
|
|
||||||
params: ({ params: { len } }) => (0, codegen_1._) `{limit: ${len}}`,
|
|
||||||
};
|
|
||||||
const def = {
|
|
||||||
keyword: "items",
|
|
||||||
type: "array",
|
|
||||||
schemaType: ["object", "boolean"],
|
|
||||||
before: "uniqueItems",
|
|
||||||
error,
|
|
||||||
code(cxt) {
|
|
||||||
const { schema, parentSchema, it } = cxt;
|
|
||||||
const { prefixItems } = parentSchema;
|
|
||||||
it.items = true;
|
|
||||||
if ((0, util_1.alwaysValidSchema)(it, schema))
|
|
||||||
return;
|
|
||||||
if (prefixItems)
|
|
||||||
(0, additionalItems_1.validateAdditionalItems)(cxt, prefixItems);
|
|
||||||
else
|
|
||||||
cxt.ok((0, code_1.validateArray)(cxt));
|
|
||||||
},
|
|
||||||
};
|
|
||||||
exports.default = def;
|
|
||||||
//# sourceMappingURL=items2020.js.map
|
|
||||||
Reference in New Issue
Block a user