@speclynx/apidom-ns-json-schema-draft-7 1.12.2 → 2.1.0
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 +25 -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
|
@@ -3,14 +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
|
-
* JSON Schema Draft 7 specification elements.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
11
|
/**
|
|
15
12
|
* This plugin is specific to YAML 1.2 format, which allows defining key-value pairs
|
|
16
13
|
* with empty key, empty value, or both. If the value is not provided in YAML format,
|
|
@@ -45,7 +42,7 @@ var _visitor = require("../../traversal/visitor.cjs");
|
|
|
45
42
|
* (JSONSchemaElement))
|
|
46
43
|
*/
|
|
47
44
|
|
|
48
|
-
const isEmptyElement = element => (0,
|
|
45
|
+
const isEmptyElement = element => (0, _apidomDatamodel.isStringElement)(element) && (0, _apidomDatamodel.includesClasses)(element, ['yaml-e-node', 'yaml-e-scalar']);
|
|
49
46
|
const schema = {
|
|
50
47
|
JSONSchemaDraft7Element: {
|
|
51
48
|
additionalItems(...args) {
|
|
@@ -58,12 +55,12 @@ const schema = {
|
|
|
58
55
|
return new _JSONSchema.default(...args);
|
|
59
56
|
},
|
|
60
57
|
required(...args) {
|
|
61
|
-
const element = new
|
|
58
|
+
const element = new _apidomDatamodel.ArrayElement(...args);
|
|
62
59
|
element.classes.push('json-schema-required');
|
|
63
60
|
return element;
|
|
64
61
|
},
|
|
65
62
|
properties(...args) {
|
|
66
|
-
const element = new
|
|
63
|
+
const element = new _apidomDatamodel.ObjectElement(...args);
|
|
67
64
|
element.classes.push('json-schema-properties');
|
|
68
65
|
return element;
|
|
69
66
|
},
|
|
@@ -71,12 +68,12 @@ const schema = {
|
|
|
71
68
|
return new _JSONSchema.default(...args);
|
|
72
69
|
},
|
|
73
70
|
patternProperties(...args) {
|
|
74
|
-
const element = new
|
|
71
|
+
const element = new _apidomDatamodel.ObjectElement(...args);
|
|
75
72
|
element.classes.push('json-schema-patternProperties');
|
|
76
73
|
return element;
|
|
77
74
|
},
|
|
78
75
|
dependencies(...args) {
|
|
79
|
-
const element = new
|
|
76
|
+
const element = new _apidomDatamodel.ObjectElement(...args);
|
|
80
77
|
element.classes.push('json-schema-dependencies');
|
|
81
78
|
return element;
|
|
82
79
|
},
|
|
@@ -84,22 +81,22 @@ const schema = {
|
|
|
84
81
|
return new _JSONSchema.default(...args);
|
|
85
82
|
},
|
|
86
83
|
enum(...args) {
|
|
87
|
-
const element = new
|
|
84
|
+
const element = new _apidomDatamodel.ArrayElement(...args);
|
|
88
85
|
element.classes.push('json-schema-enum');
|
|
89
86
|
return element;
|
|
90
87
|
},
|
|
91
88
|
allOf(...args) {
|
|
92
|
-
const element = new
|
|
89
|
+
const element = new _apidomDatamodel.ArrayElement(...args);
|
|
93
90
|
element.classes.push('json-schema-allOf');
|
|
94
91
|
return element;
|
|
95
92
|
},
|
|
96
93
|
anyOf(...args) {
|
|
97
|
-
const element = new
|
|
94
|
+
const element = new _apidomDatamodel.ArrayElement(...args);
|
|
98
95
|
element.classes.push('json-schema-anyOf');
|
|
99
96
|
return element;
|
|
100
97
|
},
|
|
101
98
|
oneOf(...args) {
|
|
102
|
-
const element = new
|
|
99
|
+
const element = new _apidomDatamodel.ArrayElement(...args);
|
|
103
100
|
element.classes.push('json-schema-oneOf');
|
|
104
101
|
return element;
|
|
105
102
|
},
|
|
@@ -116,17 +113,17 @@ const schema = {
|
|
|
116
113
|
return new _JSONSchema.default(...args);
|
|
117
114
|
},
|
|
118
115
|
definitions(...args) {
|
|
119
|
-
const element = new
|
|
116
|
+
const element = new _apidomDatamodel.ObjectElement(...args);
|
|
120
117
|
element.classes.push('json-schema-definitions');
|
|
121
118
|
return element;
|
|
122
119
|
},
|
|
123
120
|
examples(...args) {
|
|
124
|
-
const element = new
|
|
121
|
+
const element = new _apidomDatamodel.ArrayElement(...args);
|
|
125
122
|
element.classes.push('json-schema-examples');
|
|
126
123
|
return element;
|
|
127
124
|
},
|
|
128
125
|
links(...args) {
|
|
129
|
-
const element = new
|
|
126
|
+
const element = new _apidomDatamodel.ArrayElement(...args);
|
|
130
127
|
element.classes.push('json-schema-links');
|
|
131
128
|
return element;
|
|
132
129
|
}
|
|
@@ -142,13 +139,13 @@ const schema = {
|
|
|
142
139
|
return new _JSONSchema.default(...args);
|
|
143
140
|
},
|
|
144
141
|
templatePointers(...args) {
|
|
145
|
-
return new
|
|
142
|
+
return new _apidomDatamodel.ObjectElement(...args);
|
|
146
143
|
},
|
|
147
144
|
templateRequired(...args) {
|
|
148
|
-
return new
|
|
145
|
+
return new _apidomDatamodel.ArrayElement(...args);
|
|
149
146
|
},
|
|
150
147
|
targetHints(...args) {
|
|
151
|
-
return new
|
|
148
|
+
return new _apidomDatamodel.ObjectElement(...args);
|
|
152
149
|
},
|
|
153
150
|
headerSchema(...args) {
|
|
154
151
|
return new _JSONSchema.default(...args);
|
|
@@ -196,7 +193,7 @@ const schema = {
|
|
|
196
193
|
}
|
|
197
194
|
};
|
|
198
195
|
const findElementFactory = (ancestor, keyName) => {
|
|
199
|
-
const elementType = (0,
|
|
196
|
+
const elementType = (0, _apidomTraverse.getNodeType)(ancestor); // @ts-ignore
|
|
200
197
|
const keyMapping = schema[elementType] || schema[(0, _apidomCore.toValue)(ancestor.classes.first)];
|
|
201
198
|
return typeof keyMapping === 'undefined' ? undefined : Object.hasOwn(keyMapping, '[key: *]') ? keyMapping['[key: *]'] : keyMapping[keyName];
|
|
202
199
|
};
|
|
@@ -204,30 +201,33 @@ const findElementFactory = (ancestor, keyName) => {
|
|
|
204
201
|
/**
|
|
205
202
|
* @public
|
|
206
203
|
*/
|
|
207
|
-
const plugin = () => () => {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
const lineage = [...ancestors, parent].filter(_apidomCore.isElement);
|
|
213
|
-
const parentElement = lineage.at(-1);
|
|
214
|
-
let elementFactory;
|
|
215
|
-
let context;
|
|
216
|
-
if ((0, _apidomCore.isArrayElement)(parentElement)) {
|
|
217
|
-
context = element;
|
|
218
|
-
elementFactory = findElementFactory(parentElement, '<*>');
|
|
219
|
-
} else if ((0, _apidomCore.isMemberElement)(parentElement)) {
|
|
220
|
-
context = lineage.at(-2);
|
|
221
|
-
elementFactory = findElementFactory(context, (0, _apidomCore.toValue)(parentElement.key));
|
|
222
|
-
}
|
|
204
|
+
const plugin = () => () => ({
|
|
205
|
+
visitor: {
|
|
206
|
+
StringElement(path) {
|
|
207
|
+
const element = path.node;
|
|
208
|
+
if (!isEmptyElement(element)) return;
|
|
223
209
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
210
|
+
// getAncestorNodes() returns [parent, grandparent, ..., root], so reverse to get [root, ..., parent]
|
|
211
|
+
const lineage = path.getAncestorNodes().reverse().filter(_apidomDatamodel.isElement);
|
|
212
|
+
const parentElement = lineage.at(-1);
|
|
213
|
+
let elementFactory;
|
|
214
|
+
let context;
|
|
215
|
+
if ((0, _apidomDatamodel.isArrayElement)(parentElement)) {
|
|
216
|
+
context = element;
|
|
217
|
+
elementFactory = findElementFactory(parentElement, '<*>');
|
|
218
|
+
} else if ((0, _apidomDatamodel.isMemberElement)(parentElement)) {
|
|
219
|
+
context = lineage.at(-2);
|
|
220
|
+
elementFactory = findElementFactory(context, (0, _apidomCore.toValue)(parentElement.key));
|
|
229
221
|
}
|
|
222
|
+
|
|
223
|
+
// no element factory found
|
|
224
|
+
if (typeof elementFactory !== 'function') return;
|
|
225
|
+
const replacement = elementFactory.call({
|
|
226
|
+
context
|
|
227
|
+
}, undefined, (0, _apidomDatamodel.cloneDeep)(element.meta), (0, _apidomDatamodel.cloneDeep)(element.attributes));
|
|
228
|
+
_apidomDatamodel.SourceMapElement.transfer(element, replacement);
|
|
229
|
+
path.replaceWith(replacement);
|
|
230
230
|
}
|
|
231
|
-
}
|
|
232
|
-
};
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
233
|
var _default = exports.default = plugin;
|
|
@@ -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
|