@speclynx/apidom-ns-openapi-2 6.1.0 → 6.1.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 +8 -0
- package/dist/apidom-ns-openapi-2.browser.js +26 -33
- package/dist/apidom-ns-openapi-2.browser.min.js +1 -1
- package/package.json +9 -9
- package/src/refractor/plugins/replace-empty-element.cjs +6 -6
- package/src/refractor/plugins/replace-empty-element.mjs +7 -7
- package/types/apidom-ns-openapi-2.d.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@speclynx/apidom-ns-openapi-2",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"description": "OpenAPI 2.0 namespace for ApiDOM.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"apidom",
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
"author": "Vladimir Gorej",
|
|
57
57
|
"license": "Apache-2.0",
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@babel/runtime-corejs3": "^8.0.
|
|
60
|
-
"@speclynx/apidom-core": "6.1.
|
|
61
|
-
"@speclynx/apidom-datamodel": "6.1.
|
|
62
|
-
"@speclynx/apidom-error": "6.1.
|
|
63
|
-
"@speclynx/apidom-json-pointer": "6.1.
|
|
64
|
-
"@speclynx/apidom-ns-json-schema-draft-4": "6.1.
|
|
65
|
-
"@speclynx/apidom-traverse": "6.1.
|
|
59
|
+
"@babel/runtime-corejs3": "^8.0.8",
|
|
60
|
+
"@speclynx/apidom-core": "6.1.1",
|
|
61
|
+
"@speclynx/apidom-datamodel": "6.1.1",
|
|
62
|
+
"@speclynx/apidom-error": "6.1.1",
|
|
63
|
+
"@speclynx/apidom-json-pointer": "6.1.1",
|
|
64
|
+
"@speclynx/apidom-ns-json-schema-draft-4": "6.1.1",
|
|
65
|
+
"@speclynx/apidom-traverse": "6.1.1",
|
|
66
66
|
"ramda": "~0.32.0",
|
|
67
67
|
"ramda-adjunct": "^6.1.0",
|
|
68
68
|
"ts-mixer": "^6.0.4"
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"README.md",
|
|
78
78
|
"CHANGELOG.md"
|
|
79
79
|
],
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "c25778097fd33bf5f0d61de6843a6240571f94b3"
|
|
81
81
|
}
|
|
@@ -71,7 +71,7 @@ var _SwaggerTags = _interopRequireDefault(require("../../elements/nces/SwaggerTa
|
|
|
71
71
|
* (SwaggerVersionElement))
|
|
72
72
|
* (MemberElement
|
|
73
73
|
* (StringElement)
|
|
74
|
-
* (
|
|
74
|
+
* (NullElement))
|
|
75
75
|
*
|
|
76
76
|
* Refracting result with this plugin:
|
|
77
77
|
*
|
|
@@ -84,7 +84,6 @@ var _SwaggerTags = _interopRequireDefault(require("../../elements/nces/SwaggerTa
|
|
|
84
84
|
* (InfoElement))
|
|
85
85
|
*/
|
|
86
86
|
|
|
87
|
-
const isEmptyElement = element => (0, _apidomDatamodel.isStringElement)(element) && (0, _apidomDatamodel.includesClasses)(element, ['yaml-e-node', 'yaml-e-scalar']);
|
|
88
87
|
const schema = {
|
|
89
88
|
// concrete types handling (CTs)
|
|
90
89
|
SwaggerElement: {
|
|
@@ -337,9 +336,9 @@ const findElementFactory = (ancestor, keyName) => {
|
|
|
337
336
|
*/
|
|
338
337
|
const plugin = () => () => ({
|
|
339
338
|
visitor: {
|
|
340
|
-
|
|
339
|
+
NullElement(path) {
|
|
341
340
|
const element = path.node;
|
|
342
|
-
if (!
|
|
341
|
+
if (!(0, _apidomDatamodel.includesClasses)(element, ['yaml-e-node', 'yaml-e-scalar'])) return;
|
|
343
342
|
|
|
344
343
|
// getAncestorNodes() returns [parent, grandparent, ..., root], so reverse to get [root, ..., parent]
|
|
345
344
|
const lineage = path.getAncestorNodes().reverse().filter(_apidomDatamodel.isElement);
|
|
@@ -349,7 +348,8 @@ const plugin = () => () => ({
|
|
|
349
348
|
if ((0, _apidomDatamodel.isArrayElement)(parentElement)) {
|
|
350
349
|
context = element;
|
|
351
350
|
elementFactory = findElementFactory(parentElement, '<*>');
|
|
352
|
-
} else if ((0, _apidomDatamodel.isMemberElement)(parentElement)) {
|
|
351
|
+
} else if ((0, _apidomDatamodel.isMemberElement)(parentElement) && parentElement.value === element) {
|
|
352
|
+
// an empty key is the name of its member; only an empty value stands for a missing element
|
|
353
353
|
context = lineage.at(-2);
|
|
354
354
|
elementFactory = findElementFactory(context, (0, _apidomCore.toValue)(parentElement.key));
|
|
355
355
|
}
|
|
@@ -358,7 +358,7 @@ const plugin = () => () => ({
|
|
|
358
358
|
if (typeof elementFactory !== 'function') return;
|
|
359
359
|
const replacement = elementFactory.call({
|
|
360
360
|
context
|
|
361
|
-
},
|
|
361
|
+
}, null, element.isMetaEmpty ? undefined : (0, _apidomDatamodel.cloneDeep)(element.meta), element.isAttributesEmpty ? undefined : (0, _apidomDatamodel.cloneDeep)(element.attributes));
|
|
362
362
|
_apidomDatamodel.SourceMapElement.transfer(element, replacement);
|
|
363
363
|
_apidomDatamodel.StyleElement.transfer(element, replacement);
|
|
364
364
|
path.replaceWith(replacement);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrayElement, ObjectElement,
|
|
1
|
+
import { ArrayElement, ObjectElement, isElement, isMemberElement, isArrayElement, includesClasses, cloneDeep, SourceMapElement, StyleElement } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import { toValue } from '@speclynx/apidom-core';
|
|
3
3
|
import { getNodeType } from '@speclynx/apidom-traverse';
|
|
4
4
|
|
|
@@ -62,7 +62,7 @@ import SwaggerTagsElement from "../../elements/nces/SwaggerTags.mjs";
|
|
|
62
62
|
* (SwaggerVersionElement))
|
|
63
63
|
* (MemberElement
|
|
64
64
|
* (StringElement)
|
|
65
|
-
* (
|
|
65
|
+
* (NullElement))
|
|
66
66
|
*
|
|
67
67
|
* Refracting result with this plugin:
|
|
68
68
|
*
|
|
@@ -74,7 +74,6 @@ import SwaggerTagsElement from "../../elements/nces/SwaggerTags.mjs";
|
|
|
74
74
|
* (StringElement)
|
|
75
75
|
* (InfoElement))
|
|
76
76
|
*/
|
|
77
|
-
const isEmptyElement = element => isStringElement(element) && includesClasses(element, ['yaml-e-node', 'yaml-e-scalar']);
|
|
78
77
|
const schema = {
|
|
79
78
|
// concrete types handling (CTs)
|
|
80
79
|
SwaggerElement: {
|
|
@@ -327,9 +326,9 @@ const findElementFactory = (ancestor, keyName) => {
|
|
|
327
326
|
*/
|
|
328
327
|
const plugin = () => () => ({
|
|
329
328
|
visitor: {
|
|
330
|
-
|
|
329
|
+
NullElement(path) {
|
|
331
330
|
const element = path.node;
|
|
332
|
-
if (!
|
|
331
|
+
if (!includesClasses(element, ['yaml-e-node', 'yaml-e-scalar'])) return;
|
|
333
332
|
|
|
334
333
|
// getAncestorNodes() returns [parent, grandparent, ..., root], so reverse to get [root, ..., parent]
|
|
335
334
|
const lineage = path.getAncestorNodes().reverse().filter(isElement);
|
|
@@ -339,7 +338,8 @@ const plugin = () => () => ({
|
|
|
339
338
|
if (isArrayElement(parentElement)) {
|
|
340
339
|
context = element;
|
|
341
340
|
elementFactory = findElementFactory(parentElement, '<*>');
|
|
342
|
-
} else if (isMemberElement(parentElement)) {
|
|
341
|
+
} else if (isMemberElement(parentElement) && parentElement.value === element) {
|
|
342
|
+
// an empty key is the name of its member; only an empty value stands for a missing element
|
|
343
343
|
context = lineage.at(-2);
|
|
344
344
|
elementFactory = findElementFactory(context, toValue(parentElement.key));
|
|
345
345
|
}
|
|
@@ -348,7 +348,7 @@ const plugin = () => () => ({
|
|
|
348
348
|
if (typeof elementFactory !== 'function') return;
|
|
349
349
|
const replacement = elementFactory.call({
|
|
350
350
|
context
|
|
351
|
-
},
|
|
351
|
+
}, null, element.isMetaEmpty ? undefined : cloneDeep(element.meta), element.isAttributesEmpty ? undefined : cloneDeep(element.attributes));
|
|
352
352
|
SourceMapElement.transfer(element, replacement);
|
|
353
353
|
StyleElement.transfer(element, replacement);
|
|
354
354
|
path.replaceWith(replacement);
|
|
@@ -19,6 +19,7 @@ import { MemberElement } from '@speclynx/apidom-datamodel';
|
|
|
19
19
|
import { Meta } from '@speclynx/apidom-datamodel';
|
|
20
20
|
import { Namespace } from '@speclynx/apidom-datamodel';
|
|
21
21
|
import { NamespacePlugin } from '@speclynx/apidom-datamodel';
|
|
22
|
+
import { NullElement } from '@speclynx/apidom-datamodel';
|
|
22
23
|
import { NumberElement } from '@speclynx/apidom-datamodel';
|
|
23
24
|
import { ObjectElement } from '@speclynx/apidom-datamodel';
|
|
24
25
|
import { Path } from '@speclynx/apidom-traverse';
|
|
@@ -1348,7 +1349,7 @@ export declare interface RefractorPluginNormalizeSecurityRequirementsOptions {
|
|
|
1348
1349
|
*/
|
|
1349
1350
|
export declare const refractorPluginReplaceEmptyElement: () => () => {
|
|
1350
1351
|
visitor: {
|
|
1351
|
-
|
|
1352
|
+
NullElement(path: Path<NullElement>): void;
|
|
1352
1353
|
};
|
|
1353
1354
|
};
|
|
1354
1355
|
|