@speclynx/apidom-ns-json-schema-2019-09 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 +25 -26
- package/dist/apidom-ns-json-schema-2019-09.browser.js +1 -1
- package/package.json +11 -9
- package/src/elements/JSONSchema.cjs +7 -7
- package/src/elements/JSONSchema.mjs +7 -8
- package/src/elements/LinkDescription.cjs +5 -0
- package/src/elements/LinkDescription.mjs +5 -0
- package/src/index.cjs +11 -19
- package/src/index.mjs +4 -5
- package/src/predicates.cjs +9 -16
- package/src/predicates.mjs +5 -15
- package/src/refractor/index.cjs +38 -18
- package/src/refractor/index.mjs +33 -16
- package/src/refractor/inspect.cjs +43 -0
- package/src/refractor/inspect.mjs +37 -0
- package/src/refractor/plugins/replace-empty-element.cjs +34 -28
- package/src/refractor/plugins/replace-empty-element.mjs +14 -8
- package/src/refractor/specification.cjs +5 -2
- package/src/refractor/specification.mjs +5 -2
- package/src/refractor/toolbox.cjs +8 -3
- package/src/refractor/toolbox.mjs +6 -2
- package/src/refractor/visitors/json-schema/$defsVisitor.cjs +4 -5
- package/src/refractor/visitors/json-schema/$defsVisitor.mjs +3 -6
- package/src/refractor/visitors/json-schema/$refVisitor.cjs +2 -3
- package/src/refractor/visitors/json-schema/$refVisitor.mjs +2 -3
- package/src/refractor/visitors/json-schema/$vocabularyVisitor.cjs +2 -3
- package/src/refractor/visitors/json-schema/$vocabularyVisitor.mjs +2 -3
- package/src/refractor/visitors/json-schema/AllOfVisitor.cjs +7 -7
- package/src/refractor/visitors/json-schema/AllOfVisitor.mjs +6 -8
- package/src/refractor/visitors/json-schema/AnyOfVisitor.cjs +7 -7
- package/src/refractor/visitors/json-schema/AnyOfVisitor.mjs +6 -8
- package/src/refractor/visitors/json-schema/DependentRequiredVisitor.cjs +2 -3
- package/src/refractor/visitors/json-schema/DependentRequiredVisitor.mjs +2 -3
- package/src/refractor/visitors/json-schema/DependentSchemasVisitor.cjs +4 -5
- package/src/refractor/visitors/json-schema/DependentSchemasVisitor.mjs +3 -6
- package/src/refractor/visitors/json-schema/ItemsVisitor.cjs +13 -13
- package/src/refractor/visitors/json-schema/ItemsVisitor.mjs +12 -14
- package/src/refractor/visitors/json-schema/OneOfVisitor.cjs +7 -7
- package/src/refractor/visitors/json-schema/OneOfVisitor.mjs +6 -8
- package/src/refractor/visitors/json-schema/PatternPropertiesVisitor.cjs +4 -5
- package/src/refractor/visitors/json-schema/PatternPropertiesVisitor.mjs +3 -6
- package/src/refractor/visitors/json-schema/PropertiesVisitor.cjs +4 -5
- package/src/refractor/visitors/json-schema/PropertiesVisitor.mjs +3 -6
- package/src/refractor/visitors/json-schema/bases.cjs +23 -0
- package/src/refractor/visitors/json-schema/bases.mjs +20 -0
- package/src/refractor/visitors/json-schema/index.cjs +6 -6
- package/src/refractor/visitors/json-schema/index.mjs +5 -5
- package/types/apidom-ns-json-schema-2019-09.d.ts +141 -307
- package/src/refractor/registration.cjs +0 -13
- package/src/refractor/registration.mjs +0 -6
- package/src/traversal/visitor.cjs +0 -15
- package/src/traversal/visitor.mjs +0 -11
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = void 0;
|
|
6
|
+
var _apidomDatamodel = require("@speclynx/apidom-datamodel");
|
|
6
7
|
var _apidomCore = require("@speclynx/apidom-core");
|
|
8
|
+
var _apidomTraverse = require("@speclynx/apidom-traverse");
|
|
7
9
|
var _JSONSchema = _interopRequireDefault(require("../../elements/JSONSchema.cjs"));
|
|
8
10
|
var _LinkDescription = _interopRequireDefault(require("../../elements/LinkDescription.cjs"));
|
|
9
|
-
var _visitor = require("../../traversal/visitor.cjs");
|
|
10
11
|
/**
|
|
11
12
|
* JSON Schema 2019-09 specification elements.
|
|
12
13
|
*/
|
|
@@ -45,7 +46,7 @@ var _visitor = require("../../traversal/visitor.cjs");
|
|
|
45
46
|
* (JSONSchemaElement))
|
|
46
47
|
*/
|
|
47
48
|
|
|
48
|
-
const isEmptyElement = element => (0,
|
|
49
|
+
const isEmptyElement = element => (0, _apidomDatamodel.isStringElement)(element) && (0, _apidomDatamodel.includesClasses)(element, ['yaml-e-node', 'yaml-e-scalar']);
|
|
49
50
|
const schema = {
|
|
50
51
|
JSONSchema201909Element: {
|
|
51
52
|
additionalItems(...args) {
|
|
@@ -58,12 +59,12 @@ const schema = {
|
|
|
58
59
|
return new _JSONSchema.default(...args);
|
|
59
60
|
},
|
|
60
61
|
required(...args) {
|
|
61
|
-
const element = new
|
|
62
|
+
const element = new _apidomDatamodel.ArrayElement(...args);
|
|
62
63
|
element.classes.push('json-schema-required');
|
|
63
64
|
return element;
|
|
64
65
|
},
|
|
65
66
|
properties(...args) {
|
|
66
|
-
const element = new
|
|
67
|
+
const element = new _apidomDatamodel.ObjectElement(...args);
|
|
67
68
|
element.classes.push('json-schema-properties');
|
|
68
69
|
return element;
|
|
69
70
|
},
|
|
@@ -71,12 +72,12 @@ const schema = {
|
|
|
71
72
|
return new _JSONSchema.default(...args);
|
|
72
73
|
},
|
|
73
74
|
patternProperties(...args) {
|
|
74
|
-
const element = new
|
|
75
|
+
const element = new _apidomDatamodel.ObjectElement(...args);
|
|
75
76
|
element.classes.push('json-schema-patternProperties');
|
|
76
77
|
return element;
|
|
77
78
|
},
|
|
78
79
|
dependentSchemas(...args) {
|
|
79
|
-
const element = new
|
|
80
|
+
const element = new _apidomDatamodel.ObjectElement(...args);
|
|
80
81
|
element.classes.push('json-schema-dependentSchemas');
|
|
81
82
|
return element;
|
|
82
83
|
},
|
|
@@ -84,22 +85,22 @@ const schema = {
|
|
|
84
85
|
return new _JSONSchema.default(...args);
|
|
85
86
|
},
|
|
86
87
|
enum(...args) {
|
|
87
|
-
const element = new
|
|
88
|
+
const element = new _apidomDatamodel.ArrayElement(...args);
|
|
88
89
|
element.classes.push('json-schema-enum');
|
|
89
90
|
return element;
|
|
90
91
|
},
|
|
91
92
|
allOf(...args) {
|
|
92
|
-
const element = new
|
|
93
|
+
const element = new _apidomDatamodel.ArrayElement(...args);
|
|
93
94
|
element.classes.push('json-schema-allOf');
|
|
94
95
|
return element;
|
|
95
96
|
},
|
|
96
97
|
anyOf(...args) {
|
|
97
|
-
const element = new
|
|
98
|
+
const element = new _apidomDatamodel.ArrayElement(...args);
|
|
98
99
|
element.classes.push('json-schema-anyOf');
|
|
99
100
|
return element;
|
|
100
101
|
},
|
|
101
102
|
oneOf(...args) {
|
|
102
|
-
const element = new
|
|
103
|
+
const element = new _apidomDatamodel.ArrayElement(...args);
|
|
103
104
|
element.classes.push('json-schema-oneOf');
|
|
104
105
|
return element;
|
|
105
106
|
},
|
|
@@ -116,22 +117,22 @@ const schema = {
|
|
|
116
117
|
return new _JSONSchema.default(...args);
|
|
117
118
|
},
|
|
118
119
|
$defs(...args) {
|
|
119
|
-
const element = new
|
|
120
|
+
const element = new _apidomDatamodel.ObjectElement(...args);
|
|
120
121
|
element.classes.push('json-schema-$defs');
|
|
121
122
|
return element;
|
|
122
123
|
},
|
|
123
124
|
examples(...args) {
|
|
124
|
-
const element = new
|
|
125
|
+
const element = new _apidomDatamodel.ArrayElement(...args);
|
|
125
126
|
element.classes.push('json-schema-examples');
|
|
126
127
|
return element;
|
|
127
128
|
},
|
|
128
129
|
links(...args) {
|
|
129
|
-
const element = new
|
|
130
|
+
const element = new _apidomDatamodel.ArrayElement(...args);
|
|
130
131
|
element.classes.push('json-schema-links');
|
|
131
132
|
return element;
|
|
132
133
|
},
|
|
133
134
|
$vocabulary(...args) {
|
|
134
|
-
const element = new
|
|
135
|
+
const element = new _apidomDatamodel.ObjectElement(...args);
|
|
135
136
|
element.classes.push('json-schema-$vocabulary');
|
|
136
137
|
return element;
|
|
137
138
|
},
|
|
@@ -142,7 +143,7 @@ const schema = {
|
|
|
142
143
|
return new _JSONSchema.default(...args);
|
|
143
144
|
},
|
|
144
145
|
$dependentRequired(...args) {
|
|
145
|
-
const element = new
|
|
146
|
+
const element = new _apidomDatamodel.ObjectElement(...args);
|
|
146
147
|
element.classes.push('json-schema-$dependentRequired');
|
|
147
148
|
return element;
|
|
148
149
|
},
|
|
@@ -150,7 +151,7 @@ const schema = {
|
|
|
150
151
|
return new _JSONSchema.default(...args);
|
|
151
152
|
},
|
|
152
153
|
type(...args) {
|
|
153
|
-
const element = new
|
|
154
|
+
const element = new _apidomDatamodel.ArrayElement(...args);
|
|
154
155
|
element.classes.push('json-schema-type');
|
|
155
156
|
return element;
|
|
156
157
|
}
|
|
@@ -166,13 +167,13 @@ const schema = {
|
|
|
166
167
|
return new _JSONSchema.default(...args);
|
|
167
168
|
},
|
|
168
169
|
templatePointers(...args) {
|
|
169
|
-
return new
|
|
170
|
+
return new _apidomDatamodel.ObjectElement(...args);
|
|
170
171
|
},
|
|
171
172
|
templateRequired(...args) {
|
|
172
|
-
return new
|
|
173
|
+
return new _apidomDatamodel.ArrayElement(...args);
|
|
173
174
|
},
|
|
174
175
|
targetHints(...args) {
|
|
175
|
-
return new
|
|
176
|
+
return new _apidomDatamodel.ObjectElement(...args);
|
|
176
177
|
},
|
|
177
178
|
headerSchema(...args) {
|
|
178
179
|
return new _JSONSchema.default(...args);
|
|
@@ -220,7 +221,7 @@ const schema = {
|
|
|
220
221
|
}
|
|
221
222
|
};
|
|
222
223
|
const findElementFactory = (ancestor, keyName) => {
|
|
223
|
-
const elementType = (0,
|
|
224
|
+
const elementType = (0, _apidomTraverse.getNodeType)(ancestor); // @ts-ignore
|
|
224
225
|
const keyMapping = schema[elementType] || schema[(0, _apidomCore.toValue)(ancestor.classes.first)];
|
|
225
226
|
return typeof keyMapping === 'undefined' ? undefined : Object.hasOwn(keyMapping, '[key: *]') ? keyMapping['[key: *]'] : keyMapping[keyName];
|
|
226
227
|
};
|
|
@@ -231,25 +232,30 @@ const findElementFactory = (ancestor, keyName) => {
|
|
|
231
232
|
const plugin = () => () => {
|
|
232
233
|
return {
|
|
233
234
|
visitor: {
|
|
234
|
-
StringElement(
|
|
235
|
-
|
|
236
|
-
|
|
235
|
+
StringElement(path) {
|
|
236
|
+
const element = path.node;
|
|
237
|
+
if (!isEmptyElement(element)) return;
|
|
238
|
+
|
|
239
|
+
// getAncestorNodes() returns [parent, grandparent, ..., root], so reverse to get [root, ..., parent]
|
|
240
|
+
const lineage = path.getAncestorNodes().reverse().filter(_apidomDatamodel.isElement);
|
|
237
241
|
const parentElement = lineage.at(-1);
|
|
238
242
|
let elementFactory;
|
|
239
243
|
let context;
|
|
240
|
-
if ((0,
|
|
244
|
+
if ((0, _apidomDatamodel.isArrayElement)(parentElement)) {
|
|
241
245
|
context = element;
|
|
242
246
|
elementFactory = findElementFactory(parentElement, '<*>');
|
|
243
|
-
} else if ((0,
|
|
247
|
+
} else if ((0, _apidomDatamodel.isMemberElement)(parentElement)) {
|
|
244
248
|
context = lineage.at(-2);
|
|
245
249
|
elementFactory = findElementFactory(context, (0, _apidomCore.toValue)(parentElement.key));
|
|
246
250
|
}
|
|
247
251
|
|
|
248
252
|
// no element factory found
|
|
249
|
-
if (typeof elementFactory !== 'function') return
|
|
250
|
-
|
|
253
|
+
if (typeof elementFactory !== 'function') return;
|
|
254
|
+
const replacement = elementFactory.call({
|
|
251
255
|
context
|
|
252
|
-
}, undefined, (0,
|
|
256
|
+
}, undefined, (0, _apidomDatamodel.cloneDeep)(element.meta), (0, _apidomDatamodel.cloneDeep)(element.attributes));
|
|
257
|
+
_apidomDatamodel.SourceMapElement.transfer(element, replacement);
|
|
258
|
+
path.replaceWith(replacement);
|
|
253
259
|
}
|
|
254
260
|
}
|
|
255
261
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { ArrayElement, ObjectElement,
|
|
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';
|
|
2
4
|
/**
|
|
3
5
|
* JSON Schema 2019-09 specification elements.
|
|
4
6
|
*/
|
|
5
7
|
import JSONSchemaElement from "../../elements/JSONSchema.mjs";
|
|
6
8
|
import LinkDescriptionElement from "../../elements/LinkDescription.mjs";
|
|
7
|
-
import { getNodeType } from "../../traversal/visitor.mjs";
|
|
8
9
|
/**
|
|
9
10
|
* This plugin is specific to YAML 1.2 format, which allows defining key-value pairs
|
|
10
11
|
* with empty key, empty value, or both. If the value is not provided in YAML format,
|
|
@@ -38,7 +39,7 @@ import { getNodeType } from "../../traversal/visitor.mjs";
|
|
|
38
39
|
* (StringElement)
|
|
39
40
|
* (JSONSchemaElement))
|
|
40
41
|
*/
|
|
41
|
-
const isEmptyElement = element => isStringElement(element) && includesClasses(['yaml-e-node', 'yaml-e-scalar']
|
|
42
|
+
const isEmptyElement = element => isStringElement(element) && includesClasses(element, ['yaml-e-node', 'yaml-e-scalar']);
|
|
42
43
|
const schema = {
|
|
43
44
|
JSONSchema201909Element: {
|
|
44
45
|
additionalItems(...args) {
|
|
@@ -224,9 +225,12 @@ const findElementFactory = (ancestor, keyName) => {
|
|
|
224
225
|
const plugin = () => () => {
|
|
225
226
|
return {
|
|
226
227
|
visitor: {
|
|
227
|
-
StringElement(
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
StringElement(path) {
|
|
229
|
+
const element = path.node;
|
|
230
|
+
if (!isEmptyElement(element)) return;
|
|
231
|
+
|
|
232
|
+
// getAncestorNodes() returns [parent, grandparent, ..., root], so reverse to get [root, ..., parent]
|
|
233
|
+
const lineage = path.getAncestorNodes().reverse().filter(isElement);
|
|
230
234
|
const parentElement = lineage.at(-1);
|
|
231
235
|
let elementFactory;
|
|
232
236
|
let context;
|
|
@@ -239,10 +243,12 @@ const plugin = () => () => {
|
|
|
239
243
|
}
|
|
240
244
|
|
|
241
245
|
// no element factory found
|
|
242
|
-
if (typeof elementFactory !== 'function') return
|
|
243
|
-
|
|
246
|
+
if (typeof elementFactory !== 'function') return;
|
|
247
|
+
const replacement = elementFactory.call({
|
|
244
248
|
context
|
|
245
249
|
}, undefined, cloneDeep(element.meta), cloneDeep(element.attributes));
|
|
250
|
+
SourceMapElement.transfer(element, replacement);
|
|
251
|
+
path.replaceWith(replacement);
|
|
246
252
|
}
|
|
247
253
|
}
|
|
248
254
|
};
|
|
@@ -20,7 +20,10 @@ var _DependentRequiredVisitor = _interopRequireDefault(require("./visitors/json-
|
|
|
20
20
|
var _index2 = _interopRequireDefault(require("./visitors/json-schema/link-description/index.cjs"));
|
|
21
21
|
const specification = (0, _ramda.pipe)(
|
|
22
22
|
// JSON Schema object modifications
|
|
23
|
-
(0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', '$visitor'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$vocabulary'], _$vocabularyVisitor.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$anchor'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$recursiveAnchor'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$recursiveRef'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value), (0, _ramda.dissocPath)(['visitors', 'document', 'objects', 'JSONReference', '$visitor']), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$ref'], _$refVisitor.default), (0, _ramda.dissocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'definitions']), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$defs'], _$defsVisitor.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'allOf'], _AllOfVisitor.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'anyOf'], _AnyOfVisitor.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'oneOf'], _OneOfVisitor.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'not'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'if'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'then'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'else'], _index.default), (0, _ramda.dissocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'dependencies']), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'dependentSchemas'], _DependentSchemasVisitor.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'items'],
|
|
23
|
+
(0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'element'], 'jSONSchema201909'), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', '$visitor'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$vocabulary'], _$vocabularyVisitor.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$anchor'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$recursiveAnchor'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$recursiveRef'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value), (0, _ramda.dissocPath)(['visitors', 'document', 'objects', 'JSONReference', '$visitor']), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$ref'], _$refVisitor.default), (0, _ramda.dissocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'definitions']), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$defs'], _$defsVisitor.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'allOf'], _AllOfVisitor.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'anyOf'], _AnyOfVisitor.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'oneOf'], _OneOfVisitor.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'not'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'if'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'then'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'else'], _index.default), (0, _ramda.dissocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'dependencies']), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'dependentSchemas'], _DependentSchemasVisitor.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'items'], {
|
|
24
|
+
$visitor: _ItemsVisitor.default,
|
|
25
|
+
alias: 'itemsField'
|
|
26
|
+
}), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'contains'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'properties'], _PropertiesVisitor.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'patternProperties'], _PatternPropertiesVisitor.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'additionalProperties'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'additionalItems'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'propertyNames'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'unevaluatedItems'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'unevaluatedProperties'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'maxContains'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'minContains'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'dependentRequired'], _DependentRequiredVisitor.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'deprecated'], _apidomNsJsonSchemaDraft.specificationObj.visitors.value), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'contentSchema'], _index.default),
|
|
24
27
|
// Link Description object modifications
|
|
25
|
-
(0, _ramda.assocPath)(['visitors', 'document', 'objects', 'LinkDescription', '$visitor'], _index2.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'targetSchema'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'hrefSchema'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'headerSchema'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'submissionSchema'], _index.default))(_apidomNsJsonSchemaDraft.specificationObj);
|
|
28
|
+
(0, _ramda.assocPath)(['visitors', 'document', 'objects', 'LinkDescription', 'element'], 'linkDescription'), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'LinkDescription', '$visitor'], _index2.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'targetSchema'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'hrefSchema'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'headerSchema'], _index.default), (0, _ramda.assocPath)(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'submissionSchema'], _index.default))(_apidomNsJsonSchemaDraft.specificationObj);
|
|
26
29
|
var _default = exports.default = specification;
|
|
@@ -15,7 +15,10 @@ import JSONSchemaDependentRequiredVisitor from "./visitors/json-schema/Dependent
|
|
|
15
15
|
import JSONSchemaLinkDescriptionVisitor from "./visitors/json-schema/link-description/index.mjs";
|
|
16
16
|
const specification = pipe(
|
|
17
17
|
// JSON Schema object modifications
|
|
18
|
-
assocPath(['visitors', 'document', 'objects', 'JSONSchema', '$visitor'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$vocabulary'], JSONSchema$vocabularyVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$anchor'], specificationObj.visitors.value), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$recursiveAnchor'], specificationObj.visitors.value), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$recursiveRef'], specificationObj.visitors.value), dissocPath(['visitors', 'document', 'objects', 'JSONReference', '$visitor']), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$ref'], JSONSchema$refVisitor), dissocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'definitions']), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$defs'], JSONSchema$defsVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'allOf'], JSONSchemaAllOfVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'anyOf'], JSONSchemaAnyOfVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'oneOf'], JSONSchemaOneOfVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'not'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'if'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'then'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'else'], JSONSchemaVisitor), dissocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'dependencies']), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'dependentSchemas'], JSONSchemaDependentSchemasVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'items'],
|
|
18
|
+
assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'element'], 'jSONSchema201909'), assocPath(['visitors', 'document', 'objects', 'JSONSchema', '$visitor'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$vocabulary'], JSONSchema$vocabularyVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$anchor'], specificationObj.visitors.value), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$recursiveAnchor'], specificationObj.visitors.value), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$recursiveRef'], specificationObj.visitors.value), dissocPath(['visitors', 'document', 'objects', 'JSONReference', '$visitor']), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$ref'], JSONSchema$refVisitor), dissocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'definitions']), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$defs'], JSONSchema$defsVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'allOf'], JSONSchemaAllOfVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'anyOf'], JSONSchemaAnyOfVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'oneOf'], JSONSchemaOneOfVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'not'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'if'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'then'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'else'], JSONSchemaVisitor), dissocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'dependencies']), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'dependentSchemas'], JSONSchemaDependentSchemasVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'items'], {
|
|
19
|
+
$visitor: JSONSchemaItemsVisitor,
|
|
20
|
+
alias: 'itemsField'
|
|
21
|
+
}), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'contains'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'properties'], JSONSchemaPropertiesVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'patternProperties'], JSONSchemaPatternPropertiesVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'additionalProperties'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'additionalItems'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'propertyNames'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'unevaluatedItems'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'unevaluatedProperties'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'maxContains'], specificationObj.visitors.value), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'minContains'], specificationObj.visitors.value), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'dependentRequired'], JSONSchemaDependentRequiredVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'deprecated'], specificationObj.visitors.value), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'contentSchema'], JSONSchemaVisitor),
|
|
19
22
|
// Link Description object modifications
|
|
20
|
-
assocPath(['visitors', 'document', 'objects', 'LinkDescription', '$visitor'], JSONSchemaLinkDescriptionVisitor), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'targetSchema'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'hrefSchema'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'headerSchema'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'submissionSchema'], JSONSchemaVisitor))(specificationObj);
|
|
23
|
+
assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'element'], 'linkDescription'), assocPath(['visitors', 'document', 'objects', 'LinkDescription', '$visitor'], JSONSchemaLinkDescriptionVisitor), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'targetSchema'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'hrefSchema'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'headerSchema'], JSONSchemaVisitor), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'submissionSchema'], JSONSchemaVisitor))(specificationObj);
|
|
21
24
|
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 jsonSchema201909Predicates = _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
|
...jsonSchema201909Predicates,
|
|
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 jsonSchema201909Predicates from "../predicates.mjs";
|
|
3
3
|
import jsonSchema201909Namespace 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
|
...jsonSchema201909Predicates,
|
|
8
11
|
isStringElement
|
|
9
12
|
};
|
|
13
|
+
namespace.use(jsonSchema201909Namespace);
|
|
10
14
|
return {
|
|
11
15
|
predicates,
|
|
12
16
|
namespace
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = void 0;
|
|
5
|
-
var _tsMixer = require("ts-mixer");
|
|
6
5
|
var _ramda = require("ramda");
|
|
7
|
-
var
|
|
8
|
-
var
|
|
6
|
+
var _apidomDatamodel = require("@speclynx/apidom-datamodel");
|
|
7
|
+
var _bases = require("./bases.cjs");
|
|
9
8
|
/**
|
|
10
9
|
* @public
|
|
11
10
|
*/
|
|
@@ -13,10 +12,10 @@ var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-7"
|
|
|
13
12
|
/**
|
|
14
13
|
* @public
|
|
15
14
|
*/
|
|
16
|
-
class $defsVisitor extends
|
|
15
|
+
class $defsVisitor extends _bases.BaseSchemaMapVisitor {
|
|
17
16
|
constructor(options) {
|
|
18
17
|
super(options);
|
|
19
|
-
this.element = new
|
|
18
|
+
this.element = new _apidomDatamodel.ObjectElement();
|
|
20
19
|
this.element.classes.push('json-schema-$defs');
|
|
21
20
|
this.specPath = (0, _ramda.always)(['document', 'objects', 'JSONSchema']);
|
|
22
21
|
}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import { Mixin } from 'ts-mixer';
|
|
2
1
|
import { always } from 'ramda';
|
|
3
|
-
import { ObjectElement } from '@speclynx/apidom-
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import { ObjectElement } from '@speclynx/apidom-datamodel';
|
|
3
|
+
import { BaseSchemaMapVisitor } from "./bases.mjs";
|
|
6
4
|
/**
|
|
7
5
|
* @public
|
|
8
6
|
*/
|
|
9
|
-
|
|
10
7
|
/**
|
|
11
8
|
* @public
|
|
12
9
|
*/
|
|
13
|
-
class $defsVisitor extends
|
|
10
|
+
class $defsVisitor extends BaseSchemaMapVisitor {
|
|
14
11
|
constructor(options) {
|
|
15
12
|
super(options);
|
|
16
13
|
this.element = new ObjectElement();
|
|
@@ -7,10 +7,9 @@ var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-7"
|
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
9
|
class $refVisitor extends _apidomNsJsonSchemaDraft.FallbackVisitor {
|
|
10
|
-
StringElement(
|
|
11
|
-
|
|
10
|
+
StringElement(path) {
|
|
11
|
+
this.enter(path);
|
|
12
12
|
this.element.classes.push('reference-value');
|
|
13
|
-
return result;
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
15
|
var _default = exports.default = $refVisitor;
|
|
@@ -3,10 +3,9 @@ import { FallbackVisitor } from '@speclynx/apidom-ns-json-schema-draft-7';
|
|
|
3
3
|
* @public
|
|
4
4
|
*/
|
|
5
5
|
class $refVisitor extends FallbackVisitor {
|
|
6
|
-
StringElement(
|
|
7
|
-
|
|
6
|
+
StringElement(path) {
|
|
7
|
+
this.enter(path);
|
|
8
8
|
this.element.classes.push('reference-value');
|
|
9
|
-
return result;
|
|
10
9
|
}
|
|
11
10
|
}
|
|
12
11
|
export default $refVisitor;
|
|
@@ -7,10 +7,9 @@ var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-7"
|
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
9
|
class $vocabularyVisitor extends _apidomNsJsonSchemaDraft.FallbackVisitor {
|
|
10
|
-
ObjectElement(
|
|
11
|
-
|
|
10
|
+
ObjectElement(path) {
|
|
11
|
+
this.enter(path);
|
|
12
12
|
this.element.classes.push('json-schema-$vocabulary');
|
|
13
|
-
return result;
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
15
|
var _default = exports.default = $vocabularyVisitor;
|
|
@@ -3,10 +3,9 @@ import { FallbackVisitor } from '@speclynx/apidom-ns-json-schema-draft-7';
|
|
|
3
3
|
* @public
|
|
4
4
|
*/
|
|
5
5
|
class $vocabularyVisitor extends FallbackVisitor {
|
|
6
|
-
ObjectElement(
|
|
7
|
-
|
|
6
|
+
ObjectElement(path) {
|
|
7
|
+
this.enter(path);
|
|
8
8
|
this.element.classes.push('json-schema-$vocabulary');
|
|
9
|
-
return result;
|
|
10
9
|
}
|
|
11
10
|
}
|
|
12
11
|
export default $vocabularyVisitor;
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = void 0;
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-7");
|
|
5
|
+
var _apidomDatamodel = require("@speclynx/apidom-datamodel");
|
|
6
|
+
var _bases = require("./bases.cjs");
|
|
8
7
|
/**
|
|
9
8
|
* @public
|
|
10
9
|
*/
|
|
@@ -12,19 +11,20 @@ var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-7"
|
|
|
12
11
|
/**
|
|
13
12
|
* @public
|
|
14
13
|
*/
|
|
15
|
-
class AllOfVisitor extends
|
|
14
|
+
class AllOfVisitor extends _bases.BaseSchemaArrayVisitor {
|
|
16
15
|
constructor(options) {
|
|
17
16
|
super(options);
|
|
18
|
-
this.element = new
|
|
17
|
+
this.element = new _apidomDatamodel.ArrayElement();
|
|
19
18
|
this.element.classes.push('json-schema-allOf');
|
|
20
19
|
}
|
|
21
|
-
ArrayElement(
|
|
20
|
+
ArrayElement(path) {
|
|
21
|
+
const arrayElement = path.node;
|
|
22
22
|
arrayElement.forEach(item => {
|
|
23
23
|
const element = this.toRefractedElement(['document', 'objects', 'JSONSchema'], item);
|
|
24
24
|
this.element.push(element);
|
|
25
25
|
});
|
|
26
26
|
this.copyMetaAndAttributes(arrayElement, this.element);
|
|
27
|
-
|
|
27
|
+
path.stop();
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
var _default = exports.default = AllOfVisitor;
|
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { FallbackVisitor, SpecificationVisitor, ParentSchemaAwareVisitor } from '@speclynx/apidom-ns-json-schema-draft-7';
|
|
4
|
-
|
|
1
|
+
import { ArrayElement } from '@speclynx/apidom-datamodel';
|
|
2
|
+
import { BaseSchemaArrayVisitor } from "./bases.mjs";
|
|
5
3
|
/**
|
|
6
4
|
* @public
|
|
7
5
|
*/
|
|
8
|
-
|
|
9
6
|
/**
|
|
10
7
|
* @public
|
|
11
8
|
*/
|
|
12
|
-
class AllOfVisitor extends
|
|
9
|
+
class AllOfVisitor extends BaseSchemaArrayVisitor {
|
|
13
10
|
constructor(options) {
|
|
14
11
|
super(options);
|
|
15
12
|
this.element = new ArrayElement();
|
|
16
13
|
this.element.classes.push('json-schema-allOf');
|
|
17
14
|
}
|
|
18
|
-
ArrayElement(
|
|
15
|
+
ArrayElement(path) {
|
|
16
|
+
const arrayElement = path.node;
|
|
19
17
|
arrayElement.forEach(item => {
|
|
20
18
|
const element = this.toRefractedElement(['document', 'objects', 'JSONSchema'], item);
|
|
21
19
|
this.element.push(element);
|
|
22
20
|
});
|
|
23
21
|
this.copyMetaAndAttributes(arrayElement, this.element);
|
|
24
|
-
|
|
22
|
+
path.stop();
|
|
25
23
|
}
|
|
26
24
|
}
|
|
27
25
|
export default AllOfVisitor;
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = void 0;
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-7");
|
|
5
|
+
var _apidomDatamodel = require("@speclynx/apidom-datamodel");
|
|
6
|
+
var _bases = require("./bases.cjs");
|
|
8
7
|
/**
|
|
9
8
|
* @public
|
|
10
9
|
*/
|
|
@@ -12,19 +11,20 @@ var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-7"
|
|
|
12
11
|
/**
|
|
13
12
|
* @public
|
|
14
13
|
*/
|
|
15
|
-
class AnyOfVisitor extends
|
|
14
|
+
class AnyOfVisitor extends _bases.BaseSchemaArrayVisitor {
|
|
16
15
|
constructor(options) {
|
|
17
16
|
super(options);
|
|
18
|
-
this.element = new
|
|
17
|
+
this.element = new _apidomDatamodel.ArrayElement();
|
|
19
18
|
this.element.classes.push('json-schema-anyOf');
|
|
20
19
|
}
|
|
21
|
-
ArrayElement(
|
|
20
|
+
ArrayElement(path) {
|
|
21
|
+
const arrayElement = path.node;
|
|
22
22
|
arrayElement.forEach(item => {
|
|
23
23
|
const element = this.toRefractedElement(['document', 'objects', 'JSONSchema'], item);
|
|
24
24
|
this.element.push(element);
|
|
25
25
|
});
|
|
26
26
|
this.copyMetaAndAttributes(arrayElement, this.element);
|
|
27
|
-
|
|
27
|
+
path.stop();
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
var _default = exports.default = AnyOfVisitor;
|
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { FallbackVisitor, SpecificationVisitor, ParentSchemaAwareVisitor } from '@speclynx/apidom-ns-json-schema-draft-7';
|
|
4
|
-
|
|
1
|
+
import { ArrayElement } from '@speclynx/apidom-datamodel';
|
|
2
|
+
import { BaseSchemaArrayVisitor } from "./bases.mjs";
|
|
5
3
|
/**
|
|
6
4
|
* @public
|
|
7
5
|
*/
|
|
8
|
-
|
|
9
6
|
/**
|
|
10
7
|
* @public
|
|
11
8
|
*/
|
|
12
|
-
class AnyOfVisitor extends
|
|
9
|
+
class AnyOfVisitor extends BaseSchemaArrayVisitor {
|
|
13
10
|
constructor(options) {
|
|
14
11
|
super(options);
|
|
15
12
|
this.element = new ArrayElement();
|
|
16
13
|
this.element.classes.push('json-schema-anyOf');
|
|
17
14
|
}
|
|
18
|
-
ArrayElement(
|
|
15
|
+
ArrayElement(path) {
|
|
16
|
+
const arrayElement = path.node;
|
|
19
17
|
arrayElement.forEach(item => {
|
|
20
18
|
const element = this.toRefractedElement(['document', 'objects', 'JSONSchema'], item);
|
|
21
19
|
this.element.push(element);
|
|
22
20
|
});
|
|
23
21
|
this.copyMetaAndAttributes(arrayElement, this.element);
|
|
24
|
-
|
|
22
|
+
path.stop();
|
|
25
23
|
}
|
|
26
24
|
}
|
|
27
25
|
export default AnyOfVisitor;
|
|
@@ -7,10 +7,9 @@ var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-7"
|
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
9
|
class DependentRequiredVisitor extends _apidomNsJsonSchemaDraft.FallbackVisitor {
|
|
10
|
-
ObjectElement(
|
|
11
|
-
|
|
10
|
+
ObjectElement(path) {
|
|
11
|
+
this.enter(path);
|
|
12
12
|
this.element.classes.push('json-schema-dependentRequired');
|
|
13
|
-
return result;
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
15
|
var _default = exports.default = DependentRequiredVisitor;
|
|
@@ -3,10 +3,9 @@ import { FallbackVisitor } from '@speclynx/apidom-ns-json-schema-draft-7';
|
|
|
3
3
|
* @public
|
|
4
4
|
*/
|
|
5
5
|
class DependentRequiredVisitor extends FallbackVisitor {
|
|
6
|
-
ObjectElement(
|
|
7
|
-
|
|
6
|
+
ObjectElement(path) {
|
|
7
|
+
this.enter(path);
|
|
8
8
|
this.element.classes.push('json-schema-dependentRequired');
|
|
9
|
-
return result;
|
|
10
9
|
}
|
|
11
10
|
}
|
|
12
11
|
export default DependentRequiredVisitor;
|