@speclynx/apidom-ns-json-schema-draft-7 1.12.2 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/NOTICE +16 -7
- package/README.md +24 -24
- package/dist/apidom-ns-json-schema-draft-7.browser.js +1 -1
- package/package.json +10 -9
- package/src/elements/JSONSchema.cjs +4 -3
- package/src/elements/JSONSchema.mjs +4 -3
- package/src/index.cjs +7 -20
- package/src/index.mjs +2 -5
- package/src/predicates.cjs +6 -16
- package/src/predicates.mjs +3 -16
- package/src/refractor/index.cjs +38 -18
- package/src/refractor/index.mjs +33 -16
- package/src/refractor/inspect.cjs +46 -0
- package/src/refractor/inspect.mjs +39 -0
- package/src/refractor/plugins/replace-empty-element.cjs +44 -44
- package/src/refractor/plugins/replace-empty-element.mjs +30 -29
- package/src/refractor/specification.cjs +1 -1
- package/src/refractor/specification.mjs +1 -1
- package/src/refractor/toolbox.cjs +8 -3
- package/src/refractor/toolbox.mjs +6 -2
- package/types/apidom-ns-json-schema-draft-7.d.ts +70 -245
- package/src/refractor/registration.cjs +0 -13
- package/src/refractor/registration.mjs +0 -6
- package/src/traversal/visitor.cjs +0 -16
- package/src/traversal/visitor.mjs +0 -12
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { ArrayElement, ObjectElement,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
1
|
+
import { ArrayElement, ObjectElement, isArrayElement, isElement, isMemberElement, isStringElement, includesClasses, cloneDeep, SourceMapElement } from '@speclynx/apidom-datamodel';
|
|
2
|
+
import { toValue } from '@speclynx/apidom-core';
|
|
3
|
+
import { getNodeType } from '@speclynx/apidom-traverse';
|
|
5
4
|
import JSONSchemaElement from "../../elements/JSONSchema.mjs";
|
|
6
5
|
import LinkDescriptionElement from "../../elements/LinkDescription.mjs";
|
|
7
|
-
import { getNodeType } from "../../traversal/visitor.mjs";
|
|
8
6
|
/**
|
|
9
7
|
* This plugin is specific to YAML 1.2 format, which allows defining key-value pairs
|
|
10
8
|
* with empty key, empty value, or both. If the value is not provided in YAML format,
|
|
@@ -38,7 +36,7 @@ import { getNodeType } from "../../traversal/visitor.mjs";
|
|
|
38
36
|
* (StringElement)
|
|
39
37
|
* (JSONSchemaElement))
|
|
40
38
|
*/
|
|
41
|
-
const isEmptyElement = element => isStringElement(element) && includesClasses(['yaml-e-node', 'yaml-e-scalar']
|
|
39
|
+
const isEmptyElement = element => isStringElement(element) && includesClasses(element, ['yaml-e-node', 'yaml-e-scalar']);
|
|
42
40
|
const schema = {
|
|
43
41
|
JSONSchemaDraft7Element: {
|
|
44
42
|
additionalItems(...args) {
|
|
@@ -197,30 +195,33 @@ const findElementFactory = (ancestor, keyName) => {
|
|
|
197
195
|
/**
|
|
198
196
|
* @public
|
|
199
197
|
*/
|
|
200
|
-
const plugin = () => () => {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
const lineage = [...ancestors, parent].filter(isElement);
|
|
206
|
-
const parentElement = lineage.at(-1);
|
|
207
|
-
let elementFactory;
|
|
208
|
-
let context;
|
|
209
|
-
if (isArrayElement(parentElement)) {
|
|
210
|
-
context = element;
|
|
211
|
-
elementFactory = findElementFactory(parentElement, '<*>');
|
|
212
|
-
} else if (isMemberElement(parentElement)) {
|
|
213
|
-
context = lineage.at(-2);
|
|
214
|
-
elementFactory = findElementFactory(context, toValue(parentElement.key));
|
|
215
|
-
}
|
|
198
|
+
const plugin = () => () => ({
|
|
199
|
+
visitor: {
|
|
200
|
+
StringElement(path) {
|
|
201
|
+
const element = path.node;
|
|
202
|
+
if (!isEmptyElement(element)) return;
|
|
216
203
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
204
|
+
// getAncestorNodes() returns [parent, grandparent, ..., root], so reverse to get [root, ..., parent]
|
|
205
|
+
const lineage = path.getAncestorNodes().reverse().filter(isElement);
|
|
206
|
+
const parentElement = lineage.at(-1);
|
|
207
|
+
let elementFactory;
|
|
208
|
+
let context;
|
|
209
|
+
if (isArrayElement(parentElement)) {
|
|
210
|
+
context = element;
|
|
211
|
+
elementFactory = findElementFactory(parentElement, '<*>');
|
|
212
|
+
} else if (isMemberElement(parentElement)) {
|
|
213
|
+
context = lineage.at(-2);
|
|
214
|
+
elementFactory = findElementFactory(context, toValue(parentElement.key));
|
|
222
215
|
}
|
|
216
|
+
|
|
217
|
+
// no element factory found
|
|
218
|
+
if (typeof elementFactory !== 'function') return;
|
|
219
|
+
const replacement = elementFactory.call({
|
|
220
|
+
context
|
|
221
|
+
}, undefined, cloneDeep(element.meta), cloneDeep(element.attributes));
|
|
222
|
+
SourceMapElement.transfer(element, replacement);
|
|
223
|
+
path.replaceWith(replacement);
|
|
223
224
|
}
|
|
224
|
-
}
|
|
225
|
-
};
|
|
225
|
+
}
|
|
226
|
+
});
|
|
226
227
|
export default plugin;
|
|
@@ -9,7 +9,7 @@ var _index = _interopRequireDefault(require("./visitors/json-schema/index.cjs"))
|
|
|
9
9
|
var _index2 = _interopRequireDefault(require("./visitors/json-schema/link-description/index.cjs"));
|
|
10
10
|
const specification = (0, _ramda.pipe)(
|
|
11
11
|
// JSON Schema object modifications
|
|
12
|
-
(0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', '$visitor'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$comment'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'if'], _apidomNsJsonSchemaDraft.specificationObj.visitors.JSONSchemaOrJSONReferenceVisitor), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'then'], _apidomNsJsonSchemaDraft.specificationObj.visitors.JSONSchemaOrJSONReferenceVisitor), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'else'], _apidomNsJsonSchemaDraft.specificationObj.visitors.JSONSchemaOrJSONReferenceVisitor), (0, _ramda.dissocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'media']), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'contentEncoding'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'contentMediaType'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'writeOnly'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value),
|
|
12
|
+
(0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'element'], 'jSONSchemaDraft7'), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', '$visitor'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$comment'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'if'], _apidomNsJsonSchemaDraft.specificationObj.visitors.JSONSchemaOrJSONReferenceVisitor), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'then'], _apidomNsJsonSchemaDraft.specificationObj.visitors.JSONSchemaOrJSONReferenceVisitor), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'else'], _apidomNsJsonSchemaDraft.specificationObj.visitors.JSONSchemaOrJSONReferenceVisitor), (0, _ramda.dissocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'media']), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'contentEncoding'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'contentMediaType'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'writeOnly'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value),
|
|
13
13
|
// Link Description object modifications
|
|
14
14
|
(0, _ramda.assocPath)(['visitors', 'document', 'objects', 'LinkDescription', '$visitor'], _index2.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'anchor'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'anchorPointer'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value), (0, _ramda.dissocPath)(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'mediaType']), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'targetMediaType'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'targetHints'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'description'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', '$comment'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'headerSchema'], _apidomNsJsonSchemaDraft.specificationObj.visitors.JSONSchemaOrJSONReferenceVisitor), (0, _ramda.dissocPath)(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'submissionEncType']), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'submissionMediaType'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value))(_apidomNsJsonSchemaDraft.specificationObj);
|
|
15
15
|
var _default = exports.default = specification;
|
|
@@ -4,7 +4,7 @@ import JSONSchemaVisitor from "./visitors/json-schema/index.mjs";
|
|
|
4
4
|
import LinkDescriptionVisitor from "./visitors/json-schema/link-description/index.mjs";
|
|
5
5
|
const specification = pipe(
|
|
6
6
|
// JSON Schema object modifications
|
|
7
|
-
assocPath(['visitors', 'document', 'objects', 'JSONSchema', '$visitor'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$comment'], specificationObj.visitors.value), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'if'], specificationObj.visitors.JSONSchemaOrJSONReferenceVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'then'], specificationObj.visitors.JSONSchemaOrJSONReferenceVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'else'], specificationObj.visitors.JSONSchemaOrJSONReferenceVisitor), dissocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'media']), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'contentEncoding'], specificationObj.visitors.value), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'contentMediaType'], specificationObj.visitors.value), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'writeOnly'], specificationObj.visitors.value),
|
|
7
|
+
assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'element'], 'jSONSchemaDraft7'), assocPath(['visitors', 'document', 'objects', 'JSONSchema', '$visitor'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$comment'], specificationObj.visitors.value), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'if'], specificationObj.visitors.JSONSchemaOrJSONReferenceVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'then'], specificationObj.visitors.JSONSchemaOrJSONReferenceVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'else'], specificationObj.visitors.JSONSchemaOrJSONReferenceVisitor), dissocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'media']), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'contentEncoding'], specificationObj.visitors.value), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'contentMediaType'], specificationObj.visitors.value), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'writeOnly'], specificationObj.visitors.value),
|
|
8
8
|
// Link Description object modifications
|
|
9
9
|
assocPath(['visitors', 'document', 'objects', 'LinkDescription', '$visitor'], LinkDescriptionVisitor), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'anchor'], specificationObj.visitors.value), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'anchorPointer'], specificationObj.visitors.value), dissocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'mediaType']), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'targetMediaType'], specificationObj.visitors.value), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'targetHints'], specificationObj.visitors.value), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'description'], specificationObj.visitors.value), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', '$comment'], specificationObj.visitors.value), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'headerSchema'], specificationObj.visitors.JSONSchemaOrJSONReferenceVisitor), dissocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'submissionEncType']), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'submissionMediaType'], specificationObj.visitors.value))(specificationObj);
|
|
10
10
|
export default specification;
|
|
@@ -4,15 +4,20 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
4
4
|
var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard").default;
|
|
5
5
|
exports.__esModule = true;
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _apidomDatamodel = require("@speclynx/apidom-datamodel");
|
|
8
8
|
var jsonSchemaDraft7Predicates = _interopRequireWildcard(require("../predicates.cjs"));
|
|
9
9
|
var _namespace = _interopRequireDefault(require("../namespace.cjs"));
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
|
|
10
14
|
const createToolbox = () => {
|
|
11
|
-
const namespace =
|
|
15
|
+
const namespace = new _apidomDatamodel.Namespace();
|
|
12
16
|
const predicates = {
|
|
13
17
|
...jsonSchemaDraft7Predicates,
|
|
14
|
-
isStringElement:
|
|
18
|
+
isStringElement: _apidomDatamodel.isStringElement
|
|
15
19
|
};
|
|
20
|
+
namespace.use(_namespace.default);
|
|
16
21
|
return {
|
|
17
22
|
predicates,
|
|
18
23
|
namespace
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isStringElement, Namespace } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import * as jsonSchemaDraft7Predicates from "../predicates.mjs";
|
|
3
3
|
import jsonSchemaDraft7Namespace from "../namespace.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
4
7
|
const createToolbox = () => {
|
|
5
|
-
const namespace =
|
|
8
|
+
const namespace = new Namespace();
|
|
6
9
|
const predicates = {
|
|
7
10
|
...jsonSchemaDraft7Predicates,
|
|
8
11
|
isStringElement
|
|
9
12
|
};
|
|
13
|
+
namespace.use(jsonSchemaDraft7Namespace);
|
|
10
14
|
return {
|
|
11
15
|
predicates,
|
|
12
16
|
namespace
|
|
@@ -1,88 +1,58 @@
|
|
|
1
1
|
import { AllOfVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
2
|
-
import { AllOfVisitor as AllOfVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
3
2
|
import { AllOfVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
4
3
|
import { AlternatingVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
5
4
|
import { AlternatingVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
6
5
|
import { AnyOfVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
7
|
-
import { AnyOfVisitor as AnyOfVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
8
6
|
import { AnyOfVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
9
|
-
import { ArrayElement } from '@speclynx/apidom-
|
|
10
|
-
import { Attributes } from '@speclynx/apidom-
|
|
11
|
-
import { BooleanElement } from '@speclynx/apidom-
|
|
7
|
+
import { ArrayElement } from '@speclynx/apidom-datamodel';
|
|
8
|
+
import { Attributes } from '@speclynx/apidom-datamodel';
|
|
9
|
+
import { BooleanElement } from '@speclynx/apidom-datamodel';
|
|
12
10
|
import { DefinitionsVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
13
|
-
import { DefinitionsVisitor as DefinitionsVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
14
11
|
import { DefinitionsVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
15
12
|
import { DependenciesVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
16
|
-
import { DependenciesVisitor as DependenciesVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
17
13
|
import { DependenciesVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
18
|
-
import { Element as Element_2 } from '@speclynx/apidom-
|
|
19
|
-
import { ElementPredicate } from '@speclynx/apidom-core';
|
|
20
|
-
import { EnumVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
14
|
+
import { Element as Element_2 } from '@speclynx/apidom-datamodel';
|
|
21
15
|
import { FallbackVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
22
|
-
import { FallbackVisitor as FallbackVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
23
16
|
import { FallbackVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
24
17
|
import { FixedFieldsVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
25
18
|
import { FixedFieldsVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
26
|
-
import { getNodeType } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
27
|
-
import { isArrayElement } from '@speclynx/apidom-core';
|
|
28
|
-
import { isBooleanElement } from '@speclynx/apidom-core';
|
|
29
|
-
import { isElement } from '@speclynx/apidom-core';
|
|
30
19
|
import { isJSONReferenceElement } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
31
20
|
import { isJSONReferenceLikeElement } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
32
|
-
import { isLinkElement } from '@speclynx/apidom-core';
|
|
33
|
-
import { isMemberElement } from '@speclynx/apidom-core';
|
|
34
|
-
import { isNullElement } from '@speclynx/apidom-core';
|
|
35
|
-
import { isNumberElement } from '@speclynx/apidom-core';
|
|
36
|
-
import { isObjectElement } from '@speclynx/apidom-core';
|
|
37
|
-
import { isRefElement } from '@speclynx/apidom-core';
|
|
38
|
-
import { isStringElement } from '@speclynx/apidom-core';
|
|
39
|
-
import { ItemsVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
40
21
|
import { ItemsVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
41
|
-
import { JSONReference$RefVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
42
22
|
import { JSONReferenceElement } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
43
|
-
import { JSONReferenceVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
44
23
|
import { JSONSchemaDraft4ItemsVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
45
24
|
import { JSONSchemaElement as JSONSchemaElement_2 } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
46
|
-
import { JSONSchemaVisitor as JSONSchemaVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-
|
|
47
|
-
import { JSONSchemaVisitor as JSONSchemaVisitor_3 } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
25
|
+
import { JSONSchemaVisitor as JSONSchemaVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
48
26
|
import { JSONSchemaVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
49
27
|
import { LinkDescriptionElement as LinkDescriptionElement_2 } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
50
|
-
import { LinkDescriptionVisitor as LinkDescriptionVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-
|
|
51
|
-
import { LinkDescriptionVisitor as LinkDescriptionVisitor_3 } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
28
|
+
import { LinkDescriptionVisitor as LinkDescriptionVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
52
29
|
import { LinkDescriptionVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
53
|
-
import { LinksVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
54
30
|
import { MapVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
55
31
|
import { MapVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
56
32
|
import { MediaElement } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
57
33
|
import { MediaTypes } from '@speclynx/apidom-core';
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import { ObjectElement } from '@speclynx/apidom-core';
|
|
34
|
+
import { Meta } from '@speclynx/apidom-datamodel';
|
|
35
|
+
import { Namespace } from '@speclynx/apidom-datamodel';
|
|
36
|
+
import { NamespacePlugin } from '@speclynx/apidom-datamodel';
|
|
37
|
+
import { ObjectElement } from '@speclynx/apidom-datamodel';
|
|
63
38
|
import { OneOfVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
64
|
-
import { OneOfVisitor as OneOfVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
65
39
|
import { OneOfVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
66
40
|
import { ParentSchemaAwareVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
67
41
|
import { ParentSchemaAwareVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
42
|
+
import { Path } from '@speclynx/apidom-traverse';
|
|
68
43
|
import { PatternedFieldsVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
69
44
|
import { PatternedFieldsVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
70
45
|
import { PatternPropertiesVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
71
|
-
import { PatternPropertiesVisitor as PatternPropertiesVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
72
46
|
import { PatternPropertiesVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
73
47
|
import { PropertiesVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
74
|
-
import { PropertiesVisitor as PropertiesVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
75
48
|
import { PropertiesVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
76
|
-
import { RequiredVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
77
49
|
import { SchemaOrReferenceVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
78
|
-
import { SchemaOrReferenceVisitor as SchemaOrReferenceVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
79
50
|
import { SchemaOrReferenceVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
80
51
|
import { specificationObj as specificationObj_2 } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
81
52
|
import { SpecificationVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
82
53
|
import { SpecificationVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
83
54
|
import { SpecPath } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
84
|
-
import { StringElement } from '@speclynx/apidom-
|
|
85
|
-
import { TypeVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
55
|
+
import { StringElement } from '@speclynx/apidom-datamodel';
|
|
86
56
|
import { Visitor } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
87
57
|
import { VisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
88
58
|
|
|
@@ -98,11 +68,6 @@ export { AnyOfVisitor }
|
|
|
98
68
|
|
|
99
69
|
export { AnyOfVisitorOptions }
|
|
100
70
|
|
|
101
|
-
/**
|
|
102
|
-
* @public
|
|
103
|
-
*/
|
|
104
|
-
export declare const createRefractor: (specPath: string[]) => (value: unknown, options?: {}) => Element_2;
|
|
105
|
-
|
|
106
71
|
export { DefinitionsVisitor }
|
|
107
72
|
|
|
108
73
|
export { DefinitionsVisitorOptions }
|
|
@@ -115,6 +80,15 @@ export { FallbackVisitor }
|
|
|
115
80
|
|
|
116
81
|
export { FallbackVisitorOptions }
|
|
117
82
|
|
|
83
|
+
/**
|
|
84
|
+
* @public
|
|
85
|
+
*/
|
|
86
|
+
export declare interface FixedField {
|
|
87
|
+
name: string;
|
|
88
|
+
alias?: string;
|
|
89
|
+
$visitor: unknown;
|
|
90
|
+
}
|
|
91
|
+
|
|
118
92
|
export { FixedFieldsVisitor }
|
|
119
93
|
|
|
120
94
|
export { FixedFieldsVisitorOptions }
|
|
@@ -124,14 +98,6 @@ export { FixedFieldsVisitorOptions }
|
|
|
124
98
|
*/
|
|
125
99
|
export declare type Format = 'generic' | 'json' | 'yaml';
|
|
126
100
|
|
|
127
|
-
export { getNodeType }
|
|
128
|
-
|
|
129
|
-
export { isArrayElement }
|
|
130
|
-
|
|
131
|
-
export { isBooleanElement }
|
|
132
|
-
|
|
133
|
-
export { isElement }
|
|
134
|
-
|
|
135
101
|
export { isJSONReferenceElement }
|
|
136
102
|
|
|
137
103
|
export { isJSONReferenceLikeElement }
|
|
@@ -139,26 +105,12 @@ export { isJSONReferenceLikeElement }
|
|
|
139
105
|
/**
|
|
140
106
|
* @public
|
|
141
107
|
*/
|
|
142
|
-
export declare const isJSONSchemaElement:
|
|
108
|
+
export declare const isJSONSchemaElement: (element: unknown) => element is JSONSchemaElement;
|
|
143
109
|
|
|
144
110
|
/**
|
|
145
111
|
* @public
|
|
146
112
|
*/
|
|
147
|
-
export declare const isLinkDescriptionElement:
|
|
148
|
-
|
|
149
|
-
export { isLinkElement }
|
|
150
|
-
|
|
151
|
-
export { isMemberElement }
|
|
152
|
-
|
|
153
|
-
export { isNullElement }
|
|
154
|
-
|
|
155
|
-
export { isNumberElement }
|
|
156
|
-
|
|
157
|
-
export { isObjectElement }
|
|
158
|
-
|
|
159
|
-
export { isRefElement }
|
|
160
|
-
|
|
161
|
-
export { isStringElement }
|
|
113
|
+
export declare const isLinkDescriptionElement: (element: unknown) => element is LinkDescriptionElement;
|
|
162
114
|
|
|
163
115
|
export { ItemsVisitorOptions }
|
|
164
116
|
|
|
@@ -169,9 +121,7 @@ export { JSONSchemaDraft4ItemsVisitor }
|
|
|
169
121
|
/**
|
|
170
122
|
* @public
|
|
171
123
|
*/
|
|
172
|
-
declare const jsonSchemaDraft7:
|
|
173
|
-
namespace: (options: NamespacePluginOptions) => Namespace;
|
|
174
|
-
};
|
|
124
|
+
declare const jsonSchemaDraft7: NamespacePlugin;
|
|
175
125
|
export default jsonSchemaDraft7;
|
|
176
126
|
|
|
177
127
|
/**
|
|
@@ -203,8 +153,8 @@ export declare class JSONSchemaElement extends JSONSchemaElement_2 {
|
|
|
203
153
|
/**
|
|
204
154
|
* Validation keywords for arrays
|
|
205
155
|
*/
|
|
206
|
-
get
|
|
207
|
-
set
|
|
156
|
+
get itemsField(): this | BooleanElement | JSONReferenceElement | ArrayElement<this | BooleanElement | JSONReferenceElement> | undefined;
|
|
157
|
+
set itemsField(items: this | BooleanElement | JSONReferenceElement | ArrayElement<this | BooleanElement | JSONReferenceElement> | undefined);
|
|
208
158
|
/**
|
|
209
159
|
* Keywords for Applying Subschemas Conditionally
|
|
210
160
|
*
|
|
@@ -233,7 +183,7 @@ export declare class JSONSchemaElement extends JSONSchemaElement_2 {
|
|
|
233
183
|
get contentMediaType(): StringElement | undefined;
|
|
234
184
|
set contentMediaType(contentMediaType: StringElement | undefined);
|
|
235
185
|
get media(): MediaElement | undefined;
|
|
236
|
-
set media(
|
|
186
|
+
set media(_media: MediaElement | undefined);
|
|
237
187
|
/**
|
|
238
188
|
* Schema annotations
|
|
239
189
|
*
|
|
@@ -246,36 +196,14 @@ export declare class JSONSchemaElement extends JSONSchemaElement_2 {
|
|
|
246
196
|
/**
|
|
247
197
|
* @public
|
|
248
198
|
*/
|
|
249
|
-
export declare class JSONSchemaVisitor extends
|
|
250
|
-
element: JSONSchemaElement;
|
|
199
|
+
export declare class JSONSchemaVisitor extends JSONSchemaVisitor_2 {
|
|
200
|
+
element: JSONSchemaElement | BooleanElement;
|
|
251
201
|
constructor(options: JSONSchemaVisitorOptions);
|
|
252
202
|
get defaultDialectIdentifier(): string;
|
|
253
203
|
}
|
|
254
204
|
|
|
255
205
|
export { JSONSchemaVisitorOptions }
|
|
256
206
|
|
|
257
|
-
/**
|
|
258
|
-
* @public
|
|
259
|
-
*/
|
|
260
|
-
export declare const keyMap: {
|
|
261
|
-
ObjectElement: string[];
|
|
262
|
-
ArrayElement: string[];
|
|
263
|
-
MemberElement: string[];
|
|
264
|
-
StringElement: never[];
|
|
265
|
-
BooleanElement: never[];
|
|
266
|
-
NumberElement: never[];
|
|
267
|
-
NullElement: never[];
|
|
268
|
-
RefElement: never[];
|
|
269
|
-
LinkElement: never[];
|
|
270
|
-
Annotation: never[];
|
|
271
|
-
Comment: never[];
|
|
272
|
-
ParseResultElement: string[];
|
|
273
|
-
SourceMap: string[];
|
|
274
|
-
JSONSchemaDraft7Element: string[];
|
|
275
|
-
JSONReferenceElement: string[];
|
|
276
|
-
LinkDescriptionElement: string[];
|
|
277
|
-
};
|
|
278
|
-
|
|
279
207
|
/**
|
|
280
208
|
* URI: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-hyperschema-01#section-6
|
|
281
209
|
* @public
|
|
@@ -341,7 +269,7 @@ export declare class LinkDescriptionElement extends LinkDescriptionElement_2 {
|
|
|
341
269
|
/**
|
|
342
270
|
* @public
|
|
343
271
|
*/
|
|
344
|
-
export declare class LinkDescriptionVisitor extends
|
|
272
|
+
export declare class LinkDescriptionVisitor extends LinkDescriptionVisitor_2 {
|
|
345
273
|
readonly element: LinkDescriptionElement;
|
|
346
274
|
constructor(options: LinkDescriptionVisitorOptions);
|
|
347
275
|
}
|
|
@@ -380,155 +308,44 @@ export { PropertiesVisitorOptions }
|
|
|
380
308
|
/**
|
|
381
309
|
* @public
|
|
382
310
|
*/
|
|
383
|
-
export declare const refract: <T extends Element_2>(value: unknown, {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
$ref: string;
|
|
415
|
-
};
|
|
416
|
-
maxLength: {
|
|
417
|
-
$ref: string;
|
|
418
|
-
};
|
|
419
|
-
minLength: {
|
|
420
|
-
$ref: string;
|
|
421
|
-
};
|
|
422
|
-
pattern: {
|
|
423
|
-
$ref: string;
|
|
424
|
-
};
|
|
425
|
-
additionalItems: SchemaOrReferenceVisitor_2;
|
|
426
|
-
items: ItemsVisitor;
|
|
427
|
-
maxItems: {
|
|
428
|
-
$ref: string;
|
|
429
|
-
};
|
|
430
|
-
minItems: {
|
|
431
|
-
$ref: string;
|
|
432
|
-
};
|
|
433
|
-
uniqueItems: {
|
|
434
|
-
$ref: string;
|
|
435
|
-
};
|
|
436
|
-
maxProperties: {
|
|
437
|
-
$ref: string;
|
|
438
|
-
};
|
|
439
|
-
minProperties: {
|
|
440
|
-
$ref: string;
|
|
441
|
-
};
|
|
442
|
-
required: RequiredVisitor;
|
|
443
|
-
properties: PropertiesVisitor_2;
|
|
444
|
-
additionalProperties: SchemaOrReferenceVisitor_2;
|
|
445
|
-
patternProperties: PatternPropertiesVisitor_2;
|
|
446
|
-
dependencies: DependenciesVisitor_2;
|
|
447
|
-
enum: EnumVisitor;
|
|
448
|
-
type: TypeVisitor;
|
|
449
|
-
allOf: AllOfVisitor_2;
|
|
450
|
-
anyOf: AnyOfVisitor_2;
|
|
451
|
-
oneOf: OneOfVisitor_2;
|
|
452
|
-
not: SchemaOrReferenceVisitor_2;
|
|
453
|
-
definitions: DefinitionsVisitor_2;
|
|
454
|
-
title: {
|
|
455
|
-
$ref: string;
|
|
456
|
-
};
|
|
457
|
-
description: {
|
|
458
|
-
$ref: string;
|
|
459
|
-
};
|
|
460
|
-
default: {
|
|
461
|
-
$ref: string;
|
|
462
|
-
};
|
|
463
|
-
format: {
|
|
464
|
-
$ref: string;
|
|
465
|
-
};
|
|
466
|
-
base: {
|
|
467
|
-
$ref: string;
|
|
468
|
-
};
|
|
469
|
-
links: LinksVisitor;
|
|
470
|
-
media: {
|
|
471
|
-
$ref: string;
|
|
472
|
-
};
|
|
473
|
-
readOnly: {
|
|
474
|
-
$ref: string;
|
|
475
|
-
};
|
|
476
|
-
};
|
|
477
|
-
};
|
|
478
|
-
JSONReference: {
|
|
479
|
-
$visitor: JSONReferenceVisitor;
|
|
480
|
-
fixedFields: {
|
|
481
|
-
$ref: JSONReference$RefVisitor;
|
|
482
|
-
};
|
|
483
|
-
};
|
|
484
|
-
Media: {
|
|
485
|
-
$visitor: MediaVisitor;
|
|
486
|
-
fixedFields: {
|
|
487
|
-
binaryEncoding: {
|
|
488
|
-
$ref: string;
|
|
489
|
-
};
|
|
490
|
-
type: {
|
|
491
|
-
$ref: string;
|
|
492
|
-
};
|
|
493
|
-
};
|
|
494
|
-
};
|
|
495
|
-
LinkDescription: {
|
|
496
|
-
$visitor: LinkDescriptionVisitor_2;
|
|
497
|
-
fixedFields: {
|
|
498
|
-
href: {
|
|
499
|
-
$ref: string;
|
|
500
|
-
};
|
|
501
|
-
rel: {
|
|
502
|
-
$ref: string;
|
|
503
|
-
};
|
|
504
|
-
title: {
|
|
505
|
-
$ref: string;
|
|
506
|
-
};
|
|
507
|
-
targetSchema: SchemaOrReferenceVisitor_2;
|
|
508
|
-
mediaType: {
|
|
509
|
-
$ref: string;
|
|
510
|
-
};
|
|
511
|
-
method: {
|
|
512
|
-
$ref: string;
|
|
513
|
-
};
|
|
514
|
-
encType: {
|
|
515
|
-
$ref: string;
|
|
516
|
-
};
|
|
517
|
-
schema: SchemaOrReferenceVisitor_2;
|
|
518
|
-
};
|
|
519
|
-
};
|
|
520
|
-
};
|
|
521
|
-
};
|
|
522
|
-
};
|
|
523
|
-
} | undefined;
|
|
524
|
-
}) => T;
|
|
311
|
+
export declare const refract: <T extends Element_2>(value: unknown, { element, plugins, specificationObj, }?: RefractorOptions) => T;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Refracts a value into a JSONSchemaElement.
|
|
315
|
+
* @public
|
|
316
|
+
*/
|
|
317
|
+
export declare const refractJSONSchema: <T extends Element_2 = JSONSchemaElement>(value: unknown, options?: Omit<RefractorOptions, "element">) => T;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Refracts a value into a LinkDescriptionElement.
|
|
321
|
+
* @public
|
|
322
|
+
*/
|
|
323
|
+
export declare const refractLinkDescription: <T extends Element_2 = LinkDescriptionElement>(value: unknown, options?: Omit<RefractorOptions, "element">) => T;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* @public
|
|
327
|
+
*/
|
|
328
|
+
export declare interface RefractorOptions {
|
|
329
|
+
readonly element?: string;
|
|
330
|
+
readonly plugins?: RefractorPlugin[];
|
|
331
|
+
readonly specificationObj?: typeof specificationObj;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* @public
|
|
336
|
+
*/
|
|
337
|
+
export declare type RefractorPlugin = (toolbox: Toolbox) => {
|
|
338
|
+
visitor?: object;
|
|
339
|
+
pre?: () => void;
|
|
340
|
+
post?: () => void;
|
|
341
|
+
};
|
|
525
342
|
|
|
526
343
|
/**
|
|
527
344
|
* @public
|
|
528
345
|
*/
|
|
529
346
|
export declare const refractorPluginReplaceEmptyElement: () => () => {
|
|
530
347
|
visitor: {
|
|
531
|
-
StringElement(
|
|
348
|
+
StringElement(path: Path<StringElement>): void;
|
|
532
349
|
};
|
|
533
350
|
};
|
|
534
351
|
|
|
@@ -544,6 +361,14 @@ export { SpecificationVisitorOptions }
|
|
|
544
361
|
|
|
545
362
|
export { SpecPath }
|
|
546
363
|
|
|
364
|
+
/**
|
|
365
|
+
* @public
|
|
366
|
+
*/
|
|
367
|
+
export declare interface Toolbox {
|
|
368
|
+
predicates: Record<string, (...args: any[]) => boolean>;
|
|
369
|
+
namespace: Namespace;
|
|
370
|
+
}
|
|
371
|
+
|
|
547
372
|
export { Visitor }
|
|
548
373
|
|
|
549
374
|
export { VisitorOptions }
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
|
-
exports.__esModule = true;
|
|
5
|
-
var _JSONSchema = _interopRequireDefault(require("../elements/JSONSchema.cjs"));
|
|
6
|
-
exports.JSONSchemaElement = _JSONSchema.default;
|
|
7
|
-
var _LinkDescription = _interopRequireDefault(require("../elements/LinkDescription.cjs"));
|
|
8
|
-
exports.LinkDescriptionElement = _LinkDescription.default;
|
|
9
|
-
var _index = require("./index.cjs");
|
|
10
|
-
// register refractors specific to element types
|
|
11
|
-
|
|
12
|
-
_JSONSchema.default.refract = (0, _index.createRefractor)(['visitors', 'document', 'objects', 'JSONSchema', '$visitor']);
|
|
13
|
-
_LinkDescription.default.refract = (0, _index.createRefractor)(['visitors', 'document', 'objects', 'LinkDescription', '$visitor']);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import JSONSchemaElement from "../elements/JSONSchema.mjs";
|
|
2
|
-
import LinkDescriptionElement from "../elements/LinkDescription.mjs";
|
|
3
|
-
import { createRefractor } from "./index.mjs"; // register refractors specific to element types
|
|
4
|
-
JSONSchemaElement.refract = createRefractor(['visitors', 'document', 'objects', 'JSONSchema', '$visitor']);
|
|
5
|
-
LinkDescriptionElement.refract = createRefractor(['visitors', 'document', 'objects', 'LinkDescription', '$visitor']);
|
|
6
|
-
export { JSONSchemaElement, LinkDescriptionElement };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.keyMap = exports.getNodeType = void 0;
|
|
5
|
-
var _apidomCore = require("@speclynx/apidom-core");
|
|
6
|
-
var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-6");
|
|
7
|
-
exports.getNodeType = _apidomNsJsonSchemaDraft.getNodeType;
|
|
8
|
-
/**
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
const keyMap = exports.keyMap = {
|
|
12
|
-
JSONSchemaDraft7Element: ['content'],
|
|
13
|
-
JSONReferenceElement: ['content'],
|
|
14
|
-
LinkDescriptionElement: ['content'],
|
|
15
|
-
..._apidomCore.keyMap
|
|
16
|
-
};
|