@speclynx/apidom-ns-openapi-3-0 6.0.6 → 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 +12 -0
- package/dist/apidom-ns-openapi-3-0.browser.js +82 -53
- package/dist/apidom-ns-openapi-3-0.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-3-0.d.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@speclynx/apidom-ns-openapi-3-0",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"description": "OpenAPI 3.0.x 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.
|
|
61
|
-
"@speclynx/apidom-datamodel": "6.
|
|
62
|
-
"@speclynx/apidom-error": "6.
|
|
63
|
-
"@speclynx/apidom-json-pointer": "6.
|
|
64
|
-
"@speclynx/apidom-ns-json-schema-draft-4": "6.
|
|
65
|
-
"@speclynx/apidom-traverse": "6.
|
|
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
|
}
|
|
@@ -97,7 +97,7 @@ var _HeaderContent = _interopRequireDefault(require("../../elements/nces/HeaderC
|
|
|
97
97
|
* (OpenapiElement))
|
|
98
98
|
* (MemberElement
|
|
99
99
|
* (StringElement)
|
|
100
|
-
* (
|
|
100
|
+
* (NullElement))
|
|
101
101
|
*
|
|
102
102
|
* Refracting result with this plugin:
|
|
103
103
|
*
|
|
@@ -110,7 +110,6 @@ var _HeaderContent = _interopRequireDefault(require("../../elements/nces/HeaderC
|
|
|
110
110
|
* (InfoElement))
|
|
111
111
|
*/
|
|
112
112
|
|
|
113
|
-
const isEmptyElement = element => (0, _apidomDatamodel.isStringElement)(element) && (0, _apidomDatamodel.includesClasses)(element, ['yaml-e-node', 'yaml-e-scalar']);
|
|
114
113
|
const schema = {
|
|
115
114
|
// concrete types handling (CTs)
|
|
116
115
|
OpenApi3_0Element: {
|
|
@@ -606,9 +605,9 @@ const findElementFactory = (ancestor, keyName) => {
|
|
|
606
605
|
*/
|
|
607
606
|
const plugin = () => () => ({
|
|
608
607
|
visitor: {
|
|
609
|
-
|
|
608
|
+
NullElement(path) {
|
|
610
609
|
const element = path.node;
|
|
611
|
-
if (!
|
|
610
|
+
if (!(0, _apidomDatamodel.includesClasses)(element, ['yaml-e-node', 'yaml-e-scalar'])) return;
|
|
612
611
|
const lineage = path.getAncestorNodes().reverse(); // root to parent
|
|
613
612
|
const parentElement = lineage.at(-1);
|
|
614
613
|
let elementFactory;
|
|
@@ -616,7 +615,8 @@ const plugin = () => () => ({
|
|
|
616
615
|
if ((0, _apidomDatamodel.isArrayElement)(parentElement)) {
|
|
617
616
|
context = element;
|
|
618
617
|
elementFactory = findElementFactory(parentElement, '<*>');
|
|
619
|
-
} else if ((0, _apidomDatamodel.isMemberElement)(parentElement)) {
|
|
618
|
+
} else if ((0, _apidomDatamodel.isMemberElement)(parentElement) && parentElement.value === element) {
|
|
619
|
+
// an empty key is the name of its member; only an empty value stands for a missing element
|
|
620
620
|
context = lineage.at(-2);
|
|
621
621
|
elementFactory = findElementFactory(context, (0, _apidomCore.toValue)(parentElement.key));
|
|
622
622
|
}
|
|
@@ -625,7 +625,7 @@ const plugin = () => () => ({
|
|
|
625
625
|
if (typeof elementFactory !== 'function') return;
|
|
626
626
|
const newElement = elementFactory.call({
|
|
627
627
|
context
|
|
628
|
-
},
|
|
628
|
+
}, null, element.isMetaEmpty ? undefined : (0, _apidomDatamodel.cloneDeep)(element.meta), element.isAttributesEmpty ? undefined : (0, _apidomDatamodel.cloneDeep)(element.attributes));
|
|
629
629
|
_apidomDatamodel.SourceMapElement.transfer(element, newElement);
|
|
630
630
|
_apidomDatamodel.StyleElement.transfer(element, newElement);
|
|
631
631
|
path.replaceWith(newElement);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrayElement, ObjectElement,
|
|
1
|
+
import { ArrayElement, ObjectElement, isArrayElement, isMemberElement, 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
|
|
|
@@ -88,7 +88,7 @@ import HeaderContentElement from "../../elements/nces/HeaderContent.mjs";
|
|
|
88
88
|
* (OpenapiElement))
|
|
89
89
|
* (MemberElement
|
|
90
90
|
* (StringElement)
|
|
91
|
-
* (
|
|
91
|
+
* (NullElement))
|
|
92
92
|
*
|
|
93
93
|
* Refracting result with this plugin:
|
|
94
94
|
*
|
|
@@ -100,7 +100,6 @@ import HeaderContentElement from "../../elements/nces/HeaderContent.mjs";
|
|
|
100
100
|
* (StringElement)
|
|
101
101
|
* (InfoElement))
|
|
102
102
|
*/
|
|
103
|
-
const isEmptyElement = element => isStringElement(element) && includesClasses(element, ['yaml-e-node', 'yaml-e-scalar']);
|
|
104
103
|
const schema = {
|
|
105
104
|
// concrete types handling (CTs)
|
|
106
105
|
OpenApi3_0Element: {
|
|
@@ -596,9 +595,9 @@ const findElementFactory = (ancestor, keyName) => {
|
|
|
596
595
|
*/
|
|
597
596
|
const plugin = () => () => ({
|
|
598
597
|
visitor: {
|
|
599
|
-
|
|
598
|
+
NullElement(path) {
|
|
600
599
|
const element = path.node;
|
|
601
|
-
if (!
|
|
600
|
+
if (!includesClasses(element, ['yaml-e-node', 'yaml-e-scalar'])) return;
|
|
602
601
|
const lineage = path.getAncestorNodes().reverse(); // root to parent
|
|
603
602
|
const parentElement = lineage.at(-1);
|
|
604
603
|
let elementFactory;
|
|
@@ -606,7 +605,8 @@ const plugin = () => () => ({
|
|
|
606
605
|
if (isArrayElement(parentElement)) {
|
|
607
606
|
context = element;
|
|
608
607
|
elementFactory = findElementFactory(parentElement, '<*>');
|
|
609
|
-
} else if (isMemberElement(parentElement)) {
|
|
608
|
+
} else if (isMemberElement(parentElement) && parentElement.value === element) {
|
|
609
|
+
// an empty key is the name of its member; only an empty value stands for a missing element
|
|
610
610
|
context = lineage.at(-2);
|
|
611
611
|
elementFactory = findElementFactory(context, toValue(parentElement.key));
|
|
612
612
|
}
|
|
@@ -615,7 +615,7 @@ const plugin = () => () => ({
|
|
|
615
615
|
if (typeof elementFactory !== 'function') return;
|
|
616
616
|
const newElement = elementFactory.call({
|
|
617
617
|
context
|
|
618
|
-
},
|
|
618
|
+
}, null, element.isMetaEmpty ? undefined : cloneDeep(element.meta), element.isAttributesEmpty ? undefined : cloneDeep(element.attributes));
|
|
619
619
|
SourceMapElement.transfer(element, newElement);
|
|
620
620
|
StyleElement.transfer(element, newElement);
|
|
621
621
|
path.replaceWith(newElement);
|
|
@@ -16,6 +16,7 @@ import { MemberElement } from '@speclynx/apidom-datamodel';
|
|
|
16
16
|
import { Meta } from '@speclynx/apidom-datamodel';
|
|
17
17
|
import { Namespace } from '@speclynx/apidom-datamodel';
|
|
18
18
|
import { NamespacePlugin } from '@speclynx/apidom-datamodel';
|
|
19
|
+
import { NullElement } from '@speclynx/apidom-datamodel';
|
|
19
20
|
import { ObjectElement } from '@speclynx/apidom-datamodel';
|
|
20
21
|
import { OneOfVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
21
22
|
import { Path } from '@speclynx/apidom-traverse';
|
|
@@ -1930,7 +1931,7 @@ export declare interface RefractorPluginNormalizeServersOptions {
|
|
|
1930
1931
|
*/
|
|
1931
1932
|
export declare const refractorPluginReplaceEmptyElement: () => () => {
|
|
1932
1933
|
visitor: {
|
|
1933
|
-
|
|
1934
|
+
NullElement(path: Path<NullElement>): void;
|
|
1934
1935
|
};
|
|
1935
1936
|
};
|
|
1936
1937
|
|