@swagger-api/apidom-ns-openapi-2 0.93.0 → 0.95.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 +14 -0
- package/cjs/refractor/index.cjs +5 -7
- package/cjs/refractor/visitors/FallbackVisitor.cjs +6 -8
- package/cjs/refractor/visitors/SpecificationExtensionVisitor.cjs +6 -9
- package/cjs/refractor/visitors/SpecificationVisitor.cjs +52 -61
- package/cjs/refractor/visitors/Visitor.cjs +12 -13
- package/cjs/refractor/visitors/generics/AlternatingVisitor.cjs +20 -16
- package/cjs/refractor/visitors/generics/FixedFieldsVisitor.cjs +44 -44
- package/cjs/refractor/visitors/generics/MapVisitor.cjs +5 -5
- package/cjs/refractor/visitors/generics/MixedFieldsVisitor.cjs +35 -30
- package/cjs/refractor/visitors/generics/PatternedFieldsVisitor.cjs +48 -46
- package/cjs/refractor/visitors/open-api-2/BasePathVisitor.cjs +6 -10
- package/cjs/refractor/visitors/open-api-2/ConsumesVisitor.cjs +8 -10
- package/cjs/refractor/visitors/open-api-2/HostVisitor.cjs +6 -10
- package/cjs/refractor/visitors/open-api-2/ProducesVisitor.cjs +8 -10
- package/cjs/refractor/visitors/open-api-2/SchemesVisitor.cjs +8 -10
- package/cjs/refractor/visitors/open-api-2/SecurityVisitor.cjs +15 -16
- package/cjs/refractor/visitors/open-api-2/SwaggerVisitor.cjs +10 -12
- package/cjs/refractor/visitors/open-api-2/TagsVisitor.cjs +16 -17
- package/cjs/refractor/visitors/open-api-2/contact/index.cjs +8 -9
- package/cjs/refractor/visitors/open-api-2/definitions/index.cjs +18 -20
- package/cjs/refractor/visitors/open-api-2/example/index.cjs +7 -8
- package/cjs/refractor/visitors/open-api-2/external-documentation/index.cjs +7 -8
- package/cjs/refractor/visitors/open-api-2/header/index.cjs +8 -9
- package/cjs/refractor/visitors/open-api-2/headers/index.cjs +7 -8
- package/cjs/refractor/visitors/open-api-2/index.cjs +8 -9
- package/cjs/refractor/visitors/open-api-2/info/VersionVisitor.cjs +7 -11
- package/cjs/refractor/visitors/open-api-2/info/index.cjs +8 -9
- package/cjs/refractor/visitors/open-api-2/items/index.cjs +10 -9
- package/cjs/refractor/visitors/open-api-2/license/index.cjs +8 -9
- package/cjs/refractor/visitors/open-api-2/operation/ConsumesVisitor.cjs +8 -10
- package/cjs/refractor/visitors/open-api-2/operation/ParametersVisitor.cjs +18 -19
- package/cjs/refractor/visitors/open-api-2/operation/ProducesVisitor.cjs +8 -10
- package/cjs/refractor/visitors/open-api-2/operation/SchemesVisitor.cjs +8 -10
- package/cjs/refractor/visitors/open-api-2/operation/SecurityVisitor.cjs +15 -16
- package/cjs/refractor/visitors/open-api-2/operation/TagsVisitor.cjs +8 -10
- package/cjs/refractor/visitors/open-api-2/operation/index.cjs +6 -7
- package/cjs/refractor/visitors/open-api-2/parameter/index.cjs +8 -9
- package/cjs/refractor/visitors/open-api-2/parameters-definitions/index.cjs +6 -7
- package/cjs/refractor/visitors/open-api-2/path-item/$RefVisitor.cjs +6 -10
- package/cjs/refractor/visitors/open-api-2/path-item/ParametersVisitor.cjs +18 -19
- package/cjs/refractor/visitors/open-api-2/path-item/index.cjs +21 -23
- package/cjs/refractor/visitors/open-api-2/paths/index.cjs +21 -22
- package/cjs/refractor/visitors/open-api-2/reference/$RefVisitor.cjs +6 -10
- package/cjs/refractor/visitors/open-api-2/reference/index.cjs +14 -18
- package/cjs/refractor/visitors/open-api-2/response/index.cjs +8 -9
- package/cjs/refractor/visitors/open-api-2/responses/DefaultVisitor.cjs +16 -18
- package/cjs/refractor/visitors/open-api-2/responses/index.cjs +28 -29
- package/cjs/refractor/visitors/open-api-2/responses-definitions/index.cjs +6 -7
- package/cjs/refractor/visitors/open-api-2/schema/AllOfVisitor.cjs +1 -3
- package/cjs/refractor/visitors/open-api-2/schema/ItemsVisitor.cjs +1 -3
- package/cjs/refractor/visitors/open-api-2/schema/PropertiesVisitor.cjs +1 -3
- package/cjs/refractor/visitors/open-api-2/schema/SchemaOrJSONReferenceVisitor.cjs +1 -3
- package/cjs/refractor/visitors/open-api-2/schema/index.cjs +8 -9
- package/cjs/refractor/visitors/open-api-2/scopes/index.cjs +7 -8
- package/cjs/refractor/visitors/open-api-2/security-definitions/index.cjs +7 -7
- package/cjs/refractor/visitors/open-api-2/security-requirement/index.cjs +6 -7
- package/cjs/refractor/visitors/open-api-2/security-scheme/index.cjs +8 -9
- package/cjs/refractor/visitors/open-api-2/tag/index.cjs +8 -9
- package/cjs/refractor/visitors/open-api-2/xml/index.cjs +8 -9
- package/dist/apidom-ns-openapi-2.browser.js +3361 -3185
- package/dist/apidom-ns-openapi-2.browser.min.js +1 -1
- package/es/refractor/index.mjs +5 -7
- package/es/refractor/visitors/FallbackVisitor.mjs +5 -8
- package/es/refractor/visitors/SpecificationExtensionVisitor.mjs +6 -9
- package/es/refractor/visitors/SpecificationVisitor.mjs +52 -62
- package/es/refractor/visitors/Visitor.mjs +12 -12
- package/es/refractor/visitors/generics/AlternatingVisitor.mjs +20 -16
- package/es/refractor/visitors/generics/FixedFieldsVisitor.mjs +44 -44
- package/es/refractor/visitors/generics/MapVisitor.mjs +5 -5
- package/es/refractor/visitors/generics/MixedFieldsVisitor.mjs +35 -30
- package/es/refractor/visitors/generics/PatternedFieldsVisitor.mjs +48 -46
- package/es/refractor/visitors/open-api-2/BasePathVisitor.mjs +6 -10
- package/es/refractor/visitors/open-api-2/ConsumesVisitor.mjs +8 -10
- package/es/refractor/visitors/open-api-2/HostVisitor.mjs +6 -10
- package/es/refractor/visitors/open-api-2/ProducesVisitor.mjs +8 -10
- package/es/refractor/visitors/open-api-2/SchemesVisitor.mjs +8 -10
- package/es/refractor/visitors/open-api-2/SecurityVisitor.mjs +15 -16
- package/es/refractor/visitors/open-api-2/SwaggerVisitor.mjs +10 -12
- package/es/refractor/visitors/open-api-2/TagsVisitor.mjs +16 -17
- package/es/refractor/visitors/open-api-2/contact/index.mjs +8 -9
- package/es/refractor/visitors/open-api-2/definitions/index.mjs +18 -20
- package/es/refractor/visitors/open-api-2/example/index.mjs +7 -8
- package/es/refractor/visitors/open-api-2/external-documentation/index.mjs +7 -8
- package/es/refractor/visitors/open-api-2/header/index.mjs +8 -9
- package/es/refractor/visitors/open-api-2/headers/index.mjs +7 -8
- package/es/refractor/visitors/open-api-2/index.mjs +8 -9
- package/es/refractor/visitors/open-api-2/info/VersionVisitor.mjs +7 -11
- package/es/refractor/visitors/open-api-2/info/index.mjs +8 -9
- package/es/refractor/visitors/open-api-2/items/index.mjs +10 -9
- package/es/refractor/visitors/open-api-2/license/index.mjs +8 -9
- package/es/refractor/visitors/open-api-2/operation/ConsumesVisitor.mjs +8 -10
- package/es/refractor/visitors/open-api-2/operation/ParametersVisitor.mjs +18 -19
- package/es/refractor/visitors/open-api-2/operation/ProducesVisitor.mjs +8 -10
- package/es/refractor/visitors/open-api-2/operation/SchemesVisitor.mjs +8 -10
- package/es/refractor/visitors/open-api-2/operation/SecurityVisitor.mjs +15 -16
- package/es/refractor/visitors/open-api-2/operation/TagsVisitor.mjs +8 -10
- package/es/refractor/visitors/open-api-2/operation/index.mjs +6 -7
- package/es/refractor/visitors/open-api-2/parameter/index.mjs +8 -9
- package/es/refractor/visitors/open-api-2/parameters-definitions/index.mjs +6 -7
- package/es/refractor/visitors/open-api-2/path-item/$RefVisitor.mjs +6 -10
- package/es/refractor/visitors/open-api-2/path-item/ParametersVisitor.mjs +18 -19
- package/es/refractor/visitors/open-api-2/path-item/index.mjs +21 -23
- package/es/refractor/visitors/open-api-2/paths/index.mjs +21 -22
- package/es/refractor/visitors/open-api-2/reference/$RefVisitor.mjs +6 -10
- package/es/refractor/visitors/open-api-2/reference/index.mjs +14 -18
- package/es/refractor/visitors/open-api-2/response/index.mjs +8 -9
- package/es/refractor/visitors/open-api-2/responses/DefaultVisitor.mjs +16 -18
- package/es/refractor/visitors/open-api-2/responses/index.mjs +28 -29
- package/es/refractor/visitors/open-api-2/responses-definitions/index.mjs +6 -7
- package/es/refractor/visitors/open-api-2/schema/AllOfVisitor.mjs +1 -2
- package/es/refractor/visitors/open-api-2/schema/ItemsVisitor.mjs +1 -2
- package/es/refractor/visitors/open-api-2/schema/PropertiesVisitor.mjs +1 -2
- package/es/refractor/visitors/open-api-2/schema/SchemaOrJSONReferenceVisitor.mjs +1 -2
- package/es/refractor/visitors/open-api-2/schema/index.mjs +8 -9
- package/es/refractor/visitors/open-api-2/scopes/index.mjs +7 -8
- package/es/refractor/visitors/open-api-2/security-definitions/index.mjs +7 -7
- package/es/refractor/visitors/open-api-2/security-requirement/index.mjs +6 -7
- package/es/refractor/visitors/open-api-2/security-scheme/index.mjs +8 -9
- package/es/refractor/visitors/open-api-2/tag/index.mjs +8 -9
- package/es/refractor/visitors/open-api-2/xml/index.mjs +8 -9
- package/package.json +6 -6
- package/types/dist.d.ts +981 -513
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.95.0](https://github.com/swagger-api/apidom/compare/v0.94.0...v0.95.0) (2024-02-09)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- allow refracting semantic ApiDOM ([#3798](https://github.com/swagger-api/apidom/issues/3798)) ([9d58bec](https://github.com/swagger-api/apidom/commit/9d58beccbaee4c7ff7eaccbb419be9a463cbc62e)), closes [#3756](https://github.com/swagger-api/apidom/issues/3756)
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- **ns-openapi-2:** export new symbols and types ([#3800](https://github.com/swagger-api/apidom/issues/3800)) ([41bf5c3](https://github.com/swagger-api/apidom/commit/41bf5c34354dda9cdcc3a0f9114472b7822c33c6)), closes [#3776](https://github.com/swagger-api/apidom/issues/3776)
|
|
15
|
+
|
|
16
|
+
# [0.94.0](https://github.com/swagger-api/apidom/compare/v0.93.0...v0.94.0) (2024-02-05)
|
|
17
|
+
|
|
18
|
+
**Note:** Version bump only for package @swagger-api/apidom-ns-openapi-2
|
|
19
|
+
|
|
6
20
|
# [0.93.0](https://github.com/swagger-api/apidom/compare/v0.92.0...v0.93.0) (2024-01-23)
|
|
7
21
|
|
|
8
22
|
**Note:** Version bump only for package @swagger-api/apidom-ns-openapi-2
|
package/cjs/refractor/index.cjs
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = exports.createRefractor = void 0;
|
|
6
|
-
var _ramdaAdjunct = require("ramda-adjunct");
|
|
7
6
|
var _apidomCore = require("@swagger-api/apidom-core");
|
|
7
|
+
var _ramda = require("ramda");
|
|
8
8
|
var _specification = _interopRequireDefault(require("./specification.cjs"));
|
|
9
9
|
var _visitor = require("../traversal/visitor.cjs");
|
|
10
10
|
var _toolbox = _interopRequireDefault(require("./toolbox.cjs"));
|
|
@@ -20,13 +20,11 @@ const refract = (value, {
|
|
|
20
20
|
* We don't allow consumers to hook into this translation.
|
|
21
21
|
* Though we allow consumers to define their onw plugins on already transformed ApiDOM.
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
state: {
|
|
27
|
-
specObj: resolvedSpec
|
|
28
|
-
}
|
|
23
|
+
const RootVistorClass = (0, _ramda.path)(specPath, resolvedSpec);
|
|
24
|
+
const rootVisitor = new RootVistorClass({
|
|
25
|
+
specObj: resolvedSpec
|
|
29
26
|
});
|
|
27
|
+
(0, _apidomCore.visit)(element, rootVisitor);
|
|
30
28
|
|
|
31
29
|
/**
|
|
32
30
|
* Running plugins visitors means extra single traversal === performance hit.
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = void 0;
|
|
6
|
-
var _stampit = _interopRequireDefault(require("stampit"));
|
|
7
6
|
var _apidomCore = require("@swagger-api/apidom-core");
|
|
8
7
|
var _Visitor = _interopRequireDefault(require("./Visitor.cjs"));
|
|
9
8
|
/**
|
|
@@ -12,12 +11,11 @@ var _Visitor = _interopRequireDefault(require("./Visitor.cjs"));
|
|
|
12
11
|
* different Element is provided FallBackVisitor is responsible to assigning
|
|
13
12
|
* this Element as current element.
|
|
14
13
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
14
|
+
|
|
15
|
+
class FallbackVisitor extends _Visitor.default {
|
|
16
|
+
enter(element) {
|
|
17
|
+
this.element = (0, _apidomCore.cloneDeep)(element);
|
|
18
|
+
return _apidomCore.BREAK;
|
|
21
19
|
}
|
|
22
|
-
}
|
|
20
|
+
}
|
|
23
21
|
var _default = exports.default = FallbackVisitor;
|
|
@@ -3,16 +3,13 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = void 0;
|
|
6
|
-
var _stampit = _interopRequireDefault(require("stampit"));
|
|
7
6
|
var _apidomCore = require("@swagger-api/apidom-core");
|
|
8
7
|
var _SpecificationVisitor = _interopRequireDefault(require("./SpecificationVisitor.cjs"));
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return _apidomCore.BREAK;
|
|
15
|
-
}
|
|
8
|
+
class SpecificationExtensionVisitor extends _SpecificationVisitor.default {
|
|
9
|
+
MemberElement(memberElement) {
|
|
10
|
+
this.element = (0, _apidomCore.cloneDeep)(memberElement);
|
|
11
|
+
this.element.classes.push('specification-extension');
|
|
12
|
+
return _apidomCore.BREAK;
|
|
16
13
|
}
|
|
17
|
-
}
|
|
14
|
+
}
|
|
18
15
|
var _default = exports.default = SpecificationExtensionVisitor;
|
|
@@ -3,77 +3,68 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = void 0;
|
|
6
|
-
var _stampit = _interopRequireDefault(require("stampit"));
|
|
7
6
|
var _ramda = require("ramda");
|
|
8
7
|
var _ramdaAdjunct = require("ramda-adjunct");
|
|
9
8
|
var _apidomCore = require("@swagger-api/apidom-core");
|
|
10
9
|
var _Visitor = _interopRequireDefault(require("./Visitor.cjs"));
|
|
11
|
-
var
|
|
10
|
+
var _FallbackVisitor = _interopRequireDefault(require("./FallbackVisitor.cjs"));
|
|
12
11
|
/**
|
|
13
12
|
* This is a base Type for every visitor that does
|
|
14
13
|
* internal look-ups to retrieve other child visitors.
|
|
15
14
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
specObj = this.specObj
|
|
15
|
+
|
|
16
|
+
class SpecificationVisitor extends _Visitor.default {
|
|
17
|
+
specObj;
|
|
18
|
+
passingOptionsNames = ['specObj'];
|
|
19
|
+
constructor({
|
|
20
|
+
specObj,
|
|
21
|
+
...rest
|
|
24
22
|
}) {
|
|
23
|
+
super({
|
|
24
|
+
...rest
|
|
25
|
+
});
|
|
25
26
|
this.specObj = specObj;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
if (this.fallbackVisitorPrototype === visitorPrototype) {
|
|
66
|
-
return (0, _apidomCore.cloneDeep)(element);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// standard processing continues
|
|
70
|
-
(0, _apidomCore.visit)(element, visitor, {
|
|
71
|
-
keyMap: _visitor.keyMap,
|
|
72
|
-
nodeTypeGetter: _visitor.getNodeType,
|
|
73
|
-
...options
|
|
74
|
-
});
|
|
75
|
-
return visitor.element;
|
|
27
|
+
}
|
|
28
|
+
retrievePassingOptions() {
|
|
29
|
+
return (0, _ramda.pick)(this.passingOptionsNames, this);
|
|
30
|
+
}
|
|
31
|
+
retrieveFixedFields(specPath) {
|
|
32
|
+
const fixedFields = (0, _ramda.path)(['visitors', ...specPath, 'fixedFields'], this.specObj);
|
|
33
|
+
if (typeof fixedFields === 'object' && fixedFields !== null) {
|
|
34
|
+
return Object.keys(fixedFields);
|
|
35
|
+
}
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
retrieveVisitor(specPath) {
|
|
39
|
+
if ((0, _ramda.pathSatisfies)(_ramdaAdjunct.isFunction, ['visitors', ...specPath], this.specObj)) {
|
|
40
|
+
return (0, _ramda.path)(['visitors', ...specPath], this.specObj);
|
|
41
|
+
}
|
|
42
|
+
return (0, _ramda.path)(['visitors', ...specPath, '$visitor'], this.specObj);
|
|
43
|
+
}
|
|
44
|
+
retrieveVisitorInstance(specPath, options = {}) {
|
|
45
|
+
const passingOpts = this.retrievePassingOptions();
|
|
46
|
+
const VisitorClz = this.retrieveVisitor(specPath);
|
|
47
|
+
const visitorOpts = {
|
|
48
|
+
...passingOpts,
|
|
49
|
+
...options
|
|
50
|
+
};
|
|
51
|
+
return new VisitorClz(visitorOpts);
|
|
52
|
+
}
|
|
53
|
+
toRefractedElement(specPath, element, options = {}) {
|
|
54
|
+
/**
|
|
55
|
+
* This is `Visitor shortcut`: mechanism for short circuiting the traversal and replacing
|
|
56
|
+
* it by basic node cloning.
|
|
57
|
+
*
|
|
58
|
+
* Visiting the element is equivalent to cloning it if the prototype of a visitor
|
|
59
|
+
* is the same as the prototype of FallbackVisitor. If that's the case, we can avoid
|
|
60
|
+
* bootstrapping the traversal cycle for fields that don't require any special visiting.
|
|
61
|
+
*/
|
|
62
|
+
const visitor = this.retrieveVisitorInstance(specPath, options);
|
|
63
|
+
if (visitor instanceof _FallbackVisitor.default && (visitor == null ? void 0 : visitor.constructor) === _FallbackVisitor.default) {
|
|
64
|
+
return (0, _apidomCore.cloneDeep)(element);
|
|
76
65
|
}
|
|
66
|
+
(0, _apidomCore.visit)(element, visitor, options);
|
|
67
|
+
return visitor.element;
|
|
77
68
|
}
|
|
78
|
-
}
|
|
69
|
+
}
|
|
79
70
|
var _default = exports.default = SpecificationVisitor;
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
3
|
exports.__esModule = true;
|
|
5
4
|
exports.default = void 0;
|
|
6
|
-
var _stampit = _interopRequireDefault(require("stampit"));
|
|
7
5
|
var _apidomCore = require("@swagger-api/apidom-core");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
class Visitor {
|
|
7
|
+
element;
|
|
8
|
+
constructor(options = {}) {
|
|
9
|
+
Object.assign(this, options);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line class-methods-use-this
|
|
13
|
+
copyMetaAndAttributes(from, to) {
|
|
14
|
+
// copy sourcemaps
|
|
15
|
+
if ((0, _apidomCore.hasElementSourceMap)(from)) {
|
|
16
|
+
to.meta.set('sourceMap', from.meta.get('sourceMap'));
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
|
-
}
|
|
19
|
+
}
|
|
21
20
|
var _default = exports.default = Visitor;
|
|
@@ -3,25 +3,29 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = void 0;
|
|
6
|
-
var _stampit = _interopRequireDefault(require("stampit"));
|
|
7
6
|
var _ramda = require("ramda");
|
|
8
7
|
var _ramdaAdjunct = require("ramda-adjunct");
|
|
9
8
|
var _apidomCore = require("@swagger-api/apidom-core");
|
|
10
9
|
var _SpecificationVisitor = _interopRequireDefault(require("../SpecificationVisitor.cjs"));
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const specPath = (0, _ramdaAdjunct.dispatch)(functions)(element);
|
|
22
|
-
this.element = this.toRefractedElement(specPath, element);
|
|
23
|
-
return _apidomCore.BREAK;
|
|
24
|
-
}
|
|
10
|
+
class AlternatingVisitor extends _SpecificationVisitor.default {
|
|
11
|
+
alternator;
|
|
12
|
+
constructor({
|
|
13
|
+
alternator,
|
|
14
|
+
...rest
|
|
15
|
+
}) {
|
|
16
|
+
super({
|
|
17
|
+
...rest
|
|
18
|
+
});
|
|
19
|
+
this.alternator = alternator || [];
|
|
25
20
|
}
|
|
26
|
-
|
|
21
|
+
enter(element) {
|
|
22
|
+
const functions = this.alternator.map(({
|
|
23
|
+
predicate,
|
|
24
|
+
specPath
|
|
25
|
+
}) => (0, _ramda.ifElse)(predicate, (0, _ramda.always)(specPath), _ramdaAdjunct.stubUndefined));
|
|
26
|
+
const specPath = (0, _ramdaAdjunct.dispatch)(functions)(element);
|
|
27
|
+
this.element = this.toRefractedElement(specPath, element);
|
|
28
|
+
return _apidomCore.BREAK;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
27
31
|
var _default = exports.default = AlternatingVisitor;
|
|
@@ -3,54 +3,54 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = void 0;
|
|
6
|
-
var _stampit = _interopRequireDefault(require("stampit"));
|
|
7
|
-
var _ramdaAdjunct = require("ramda-adjunct");
|
|
8
6
|
var _apidomCore = require("@swagger-api/apidom-core");
|
|
9
7
|
var _SpecificationVisitor = _interopRequireDefault(require("../SpecificationVisitor.cjs"));
|
|
10
8
|
var _predicates = require("../../predicates.cjs");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
specificationExtensionPredicate = this.specificationExtensionPredicate
|
|
27
|
-
} = {}) {
|
|
9
|
+
class FixedFieldsVisitor extends _SpecificationVisitor.default {
|
|
10
|
+
specPath;
|
|
11
|
+
ignoredFields;
|
|
12
|
+
canSupportSpecificationExtensions = true;
|
|
13
|
+
specificationExtensionPredicate = _predicates.isSwaggerExtension;
|
|
14
|
+
constructor({
|
|
15
|
+
specPath,
|
|
16
|
+
ignoredFields,
|
|
17
|
+
canSupportSpecificationExtensions,
|
|
18
|
+
specificationExtensionPredicate,
|
|
19
|
+
...rest
|
|
20
|
+
}) {
|
|
21
|
+
super({
|
|
22
|
+
...rest
|
|
23
|
+
});
|
|
28
24
|
this.specPath = specPath;
|
|
29
|
-
this.ignoredFields = ignoredFields;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
methods: {
|
|
34
|
-
ObjectElement(objectElement) {
|
|
35
|
-
const specPath = this.specPath(objectElement);
|
|
36
|
-
const fields = this.retrieveFixedFields(specPath);
|
|
37
|
-
objectElement.forEach((value, key, memberElement) => {
|
|
38
|
-
if ((0, _apidomCore.isStringElement)(key) && fields.includes((0, _apidomCore.toValue)(key)) && !this.ignoredFields.includes((0, _apidomCore.toValue)(key))) {
|
|
39
|
-
const fixedFieldElement = this.toRefractedElement([...specPath, 'fixedFields', (0, _apidomCore.toValue)(key)], value);
|
|
40
|
-
const newMemberElement = new _apidomCore.MemberElement((0, _apidomCore.cloneDeep)(key), fixedFieldElement);
|
|
41
|
-
this.copyMetaAndAttributes(memberElement, newMemberElement);
|
|
42
|
-
newMemberElement.classes.push('fixed-field');
|
|
43
|
-
this.element.content.push(newMemberElement);
|
|
44
|
-
} else if (this.canSupportSpecificationExtensions && this.specificationExtensionPredicate(memberElement)) {
|
|
45
|
-
const extensionElement = this.toRefractedElement(['document', 'extension'], memberElement);
|
|
46
|
-
this.element.content.push(extensionElement);
|
|
47
|
-
} else if (!this.ignoredFields.includes((0, _apidomCore.toValue)(key))) {
|
|
48
|
-
this.element.content.push((0, _apidomCore.cloneDeep)(memberElement));
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
this.copyMetaAndAttributes(objectElement, this.element);
|
|
52
|
-
return _apidomCore.BREAK;
|
|
25
|
+
this.ignoredFields = ignoredFields || [];
|
|
26
|
+
if (typeof canSupportSpecificationExtensions === 'boolean') {
|
|
27
|
+
this.canSupportSpecificationExtensions = canSupportSpecificationExtensions;
|
|
53
28
|
}
|
|
29
|
+
if (typeof specificationExtensionPredicate === 'function') {
|
|
30
|
+
this.specificationExtensionPredicate = specificationExtensionPredicate;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
ObjectElement(objectElement) {
|
|
34
|
+
const specPath = this.specPath(objectElement);
|
|
35
|
+
const fields = this.retrieveFixedFields(specPath);
|
|
36
|
+
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
objectElement.forEach((value, key, memberElement) => {
|
|
39
|
+
if ((0, _apidomCore.isStringElement)(key) && fields.includes((0, _apidomCore.toValue)(key)) && !this.ignoredFields.includes((0, _apidomCore.toValue)(key))) {
|
|
40
|
+
const fixedFieldElement = this.toRefractedElement([...specPath, 'fixedFields', (0, _apidomCore.toValue)(key)], value);
|
|
41
|
+
const newMemberElement = new _apidomCore.MemberElement((0, _apidomCore.cloneDeep)(key), fixedFieldElement);
|
|
42
|
+
this.copyMetaAndAttributes(memberElement, newMemberElement);
|
|
43
|
+
newMemberElement.classes.push('fixed-field');
|
|
44
|
+
this.element.content.push(newMemberElement);
|
|
45
|
+
} else if (this.canSupportSpecificationExtensions && this.specificationExtensionPredicate(memberElement)) {
|
|
46
|
+
const extensionElement = this.toRefractedElement(['document', 'extension'], memberElement);
|
|
47
|
+
this.element.content.push(extensionElement);
|
|
48
|
+
} else if (!this.ignoredFields.includes((0, _apidomCore.toValue)(key))) {
|
|
49
|
+
this.element.content.push((0, _apidomCore.cloneDeep)(memberElement));
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
this.copyMetaAndAttributes(objectElement, this.element);
|
|
53
|
+
return _apidomCore.BREAK;
|
|
54
54
|
}
|
|
55
|
-
}
|
|
55
|
+
}
|
|
56
56
|
var _default = exports.default = FixedFieldsVisitor;
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = void 0;
|
|
6
|
-
var _stampit = _interopRequireDefault(require("stampit"));
|
|
7
6
|
var _ramdaAdjunct = require("ramda-adjunct");
|
|
8
7
|
var _PatternedFieldsVisitor = _interopRequireDefault(require("./PatternedFieldsVisitor.cjs"));
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
class MapVisitor extends _PatternedFieldsVisitor.default {
|
|
9
|
+
constructor(options) {
|
|
10
|
+
super(options);
|
|
11
|
+
this.fieldPatternPredicate = _ramdaAdjunct.isNonEmptyString;
|
|
12
12
|
}
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
14
|
var _default = exports.default = MapVisitor;
|
|
@@ -3,40 +3,45 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = void 0;
|
|
6
|
-
var
|
|
6
|
+
var _tsMixer = require("ts-mixer");
|
|
7
7
|
var _ramda = require("ramda");
|
|
8
|
-
var _ramdaAdjunct = require("ramda-adjunct");
|
|
9
8
|
var _apidomCore = require("@swagger-api/apidom-core");
|
|
10
9
|
var _FixedFieldsVisitor = _interopRequireDefault(require("./FixedFieldsVisitor.cjs"));
|
|
11
10
|
var _PatternedFieldsVisitor = _interopRequireDefault(require("./PatternedFieldsVisitor.cjs"));
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
11
|
+
class MixedFieldsVisitor extends (0, _tsMixer.Mixin)(_FixedFieldsVisitor.default, _PatternedFieldsVisitor.default) {
|
|
12
|
+
specPathFixedFields;
|
|
13
|
+
specPathPatternedFields;
|
|
14
|
+
constructor({
|
|
15
|
+
specPathFixedFields,
|
|
16
|
+
specPathPatternedFields,
|
|
17
|
+
...rest
|
|
18
|
+
}) {
|
|
19
|
+
super({
|
|
20
|
+
...rest
|
|
21
|
+
});
|
|
22
|
+
this.specPathFixedFields = specPathFixedFields;
|
|
23
|
+
this.specPathPatternedFields = specPathPatternedFields;
|
|
24
|
+
}
|
|
25
|
+
ObjectElement(objectElement) {
|
|
26
|
+
const {
|
|
27
|
+
specPath,
|
|
28
|
+
ignoredFields
|
|
29
|
+
} = this;
|
|
30
|
+
try {
|
|
31
|
+
this.specPath = this.specPathFixedFields;
|
|
32
|
+
const fixedFields = this.retrieveFixedFields(this.specPath(objectElement));
|
|
33
|
+
// let FixedFieldsVisitor only process fixed fields and leave rest to PatternedFieldsVisitor
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
this.ignoredFields = [...ignoredFields, ...(0, _ramda.difference)(objectElement.keys(), fixedFields)];
|
|
36
|
+
_FixedFieldsVisitor.default.prototype.ObjectElement.call(this, objectElement);
|
|
37
|
+
this.specPath = this.specPathPatternedFields;
|
|
38
|
+
this.ignoredFields = fixedFields;
|
|
39
|
+
_PatternedFieldsVisitor.default.prototype.ObjectElement.call(this, objectElement);
|
|
40
|
+
} catch (e) {
|
|
41
|
+
this.specPath = specPath;
|
|
42
|
+
throw e;
|
|
39
43
|
}
|
|
44
|
+
return _apidomCore.BREAK;
|
|
40
45
|
}
|
|
41
|
-
}
|
|
46
|
+
}
|
|
42
47
|
var _default = exports.default = MixedFieldsVisitor;
|
|
@@ -3,56 +3,58 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = void 0;
|
|
6
|
-
var _stampit = _interopRequireDefault(require("stampit"));
|
|
7
6
|
var _ramda = require("ramda");
|
|
8
|
-
var _ramdaAdjunct = require("ramda-adjunct");
|
|
9
7
|
var _apidomCore = require("@swagger-api/apidom-core");
|
|
10
8
|
var _SpecificationVisitor = _interopRequireDefault(require("../SpecificationVisitor.cjs"));
|
|
11
9
|
var _predicates = require("../../predicates.cjs");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} = {}) {
|
|
10
|
+
class PatternedFieldsVisitor extends _SpecificationVisitor.default {
|
|
11
|
+
specPath;
|
|
12
|
+
ignoredFields;
|
|
13
|
+
fieldPatternPredicate = _ramda.F;
|
|
14
|
+
canSupportSpecificationExtensions = false;
|
|
15
|
+
specificationExtensionPredicate = _predicates.isSwaggerExtension;
|
|
16
|
+
constructor({
|
|
17
|
+
specPath,
|
|
18
|
+
ignoredFields,
|
|
19
|
+
fieldPatternPredicate,
|
|
20
|
+
canSupportSpecificationExtensions,
|
|
21
|
+
specificationExtensionPredicate,
|
|
22
|
+
...rest
|
|
23
|
+
}) {
|
|
24
|
+
super({
|
|
25
|
+
...rest
|
|
26
|
+
});
|
|
30
27
|
this.specPath = specPath;
|
|
31
|
-
this.ignoredFields = ignoredFields;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
methods: {
|
|
36
|
-
ObjectElement(objectElement) {
|
|
37
|
-
// @ts-ignore
|
|
38
|
-
objectElement.forEach((value, key, memberElement) => {
|
|
39
|
-
if (this.canSupportSpecificationExtensions && this.specificationExtensionPredicate(memberElement)) {
|
|
40
|
-
const extensionElement = this.toRefractedElement(['document', 'extension'], memberElement);
|
|
41
|
-
this.element.content.push(extensionElement);
|
|
42
|
-
} else if (!this.ignoredFields.includes((0, _apidomCore.toValue)(key)) && this.fieldPatternPredicate((0, _apidomCore.toValue)(key))) {
|
|
43
|
-
const specPath = this.specPath(value);
|
|
44
|
-
const patternedFieldElement = this.toRefractedElement(specPath, value);
|
|
45
|
-
const newMemberElement = new _apidomCore.MemberElement((0, _apidomCore.cloneDeep)(key), patternedFieldElement);
|
|
46
|
-
this.copyMetaAndAttributes(memberElement, newMemberElement);
|
|
47
|
-
newMemberElement.classes.push('patterned-field');
|
|
48
|
-
this.element.content.push(newMemberElement);
|
|
49
|
-
} else if (!this.ignoredFields.includes((0, _apidomCore.toValue)(key))) {
|
|
50
|
-
this.element.content.push((0, _apidomCore.cloneDeep)(memberElement));
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
this.copyMetaAndAttributes(objectElement, this.element);
|
|
54
|
-
return _apidomCore.BREAK;
|
|
28
|
+
this.ignoredFields = ignoredFields || [];
|
|
29
|
+
if (typeof fieldPatternPredicate === 'function') {
|
|
30
|
+
this.fieldPatternPredicate = fieldPatternPredicate;
|
|
55
31
|
}
|
|
32
|
+
if (typeof canSupportSpecificationExtensions === 'boolean') {
|
|
33
|
+
this.canSupportSpecificationExtensions = canSupportSpecificationExtensions;
|
|
34
|
+
}
|
|
35
|
+
if (typeof specificationExtensionPredicate === 'function') {
|
|
36
|
+
this.specificationExtensionPredicate = specificationExtensionPredicate;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
ObjectElement(objectElement) {
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
objectElement.forEach((value, key, memberElement) => {
|
|
42
|
+
if (this.canSupportSpecificationExtensions && this.specificationExtensionPredicate(memberElement)) {
|
|
43
|
+
const extensionElement = this.toRefractedElement(['document', 'extension'], memberElement);
|
|
44
|
+
this.element.content.push(extensionElement);
|
|
45
|
+
} else if (!this.ignoredFields.includes((0, _apidomCore.toValue)(key)) && this.fieldPatternPredicate((0, _apidomCore.toValue)(key))) {
|
|
46
|
+
const specPath = this.specPath(value);
|
|
47
|
+
const patternedFieldElement = this.toRefractedElement(specPath, value);
|
|
48
|
+
const newMemberElement = new _apidomCore.MemberElement((0, _apidomCore.cloneDeep)(key), patternedFieldElement);
|
|
49
|
+
this.copyMetaAndAttributes(memberElement, newMemberElement);
|
|
50
|
+
newMemberElement.classes.push('patterned-field');
|
|
51
|
+
this.element.content.push(newMemberElement);
|
|
52
|
+
} else if (!this.ignoredFields.includes((0, _apidomCore.toValue)(key))) {
|
|
53
|
+
this.element.content.push((0, _apidomCore.cloneDeep)(memberElement));
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
this.copyMetaAndAttributes(objectElement, this.element);
|
|
57
|
+
return _apidomCore.BREAK;
|
|
56
58
|
}
|
|
57
|
-
}
|
|
58
|
-
var _default = exports.default =
|
|
59
|
+
}
|
|
60
|
+
var _default = exports.default = PatternedFieldsVisitor;
|
|
@@ -3,16 +3,12 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = void 0;
|
|
6
|
-
var _stampit = _interopRequireDefault(require("stampit"));
|
|
7
|
-
var _apidomCore = require("@swagger-api/apidom-core");
|
|
8
6
|
var _FallbackVisitor = _interopRequireDefault(require("../FallbackVisitor.cjs"));
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return _apidomCore.BREAK;
|
|
15
|
-
}
|
|
7
|
+
class BasePathVisitor extends _FallbackVisitor.default {
|
|
8
|
+
StringElement(stringElement) {
|
|
9
|
+
const result = super.enter(stringElement);
|
|
10
|
+
this.element.classes.push('swagger-base-path');
|
|
11
|
+
return result;
|
|
16
12
|
}
|
|
17
|
-
}
|
|
13
|
+
}
|
|
18
14
|
var _default = exports.default = BasePathVisitor;
|