@swagger-api/apidom-ns-openapi-2 0.83.0 → 0.85.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 +13 -0
- package/cjs/index.cjs +2 -1
- package/cjs/refractor/plugins/replace-empty-element.cjs +22 -33
- package/cjs/refractor/visitors/SpecificationVisitor.cjs +3 -11
- package/cjs/refractor/visitors/Visitor.cjs +0 -1
- package/dist/apidom-ns-openapi-2.browser.js +7763 -7595
- package/dist/apidom-ns-openapi-2.browser.min.js +1 -1
- package/es/index.mjs +1 -1
- package/es/refractor/plugins/replace-empty-element.mjs +23 -34
- package/es/refractor/visitors/SpecificationVisitor.mjs +3 -11
- package/es/refractor/visitors/Visitor.mjs +0 -1
- package/package.json +6 -6
- package/types/dist.d.ts +3 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
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.85.0](https://github.com/swagger-api/apidom/compare/v0.84.0...v0.85.0) (2023-11-30)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **reference:** fix internal/external URL determination for OpenAPI 2.0 ([#3454](https://github.com/swagger-api/apidom/issues/3454)) ([c720584](https://github.com/swagger-api/apidom/commit/c7205840e5ef1d107b3855ee1ef597cc5121d173)), closes [#3451](https://github.com/swagger-api/apidom/issues/3451)
|
|
11
|
+
|
|
12
|
+
# [0.84.0](https://github.com/swagger-api/apidom/compare/v0.83.0...v0.84.0) (2023-11-24)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- **ns-workflows-1:** add support for Info Object ([#3393](https://github.com/swagger-api/apidom/issues/3393)) ([5508c54](https://github.com/swagger-api/apidom/commit/5508c5479844c4328867f84481f56c445ec13225)), closes [#3392](https://github.com/swagger-api/apidom/issues/3392)
|
|
17
|
+
- **reference:** add OpenAPI 2.0 dereference strategy ([#3435](https://github.com/swagger-api/apidom/issues/3435)) ([aa3710b](https://github.com/swagger-api/apidom/commit/aa3710be00fef5ecc177c7d9e2ae570a077e8b68)), closes [#3102](https://github.com/swagger-api/apidom/issues/3102)
|
|
18
|
+
|
|
6
19
|
# [0.83.0](https://github.com/swagger-api/apidom/compare/v0.82.2...v0.83.0) (2023-11-07)
|
|
7
20
|
|
|
8
21
|
**Note:** Version bump only for package @swagger-api/apidom-ns-openapi-2
|
package/cjs/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard").default;
|
|
5
5
|
exports.__esModule = true;
|
|
6
|
-
exports.specificationObj = exports.refractorPluginReplaceEmptyElement = exports.refract = exports.mediaTypes = exports.keyMap = exports.isXmlElement = exports.isTagElement = exports.isSwaggerVersionElement = exports.isSwaggerExtension = exports.isSwaggerElement = exports.isStringElement = exports.isSecuritySchemeElement = exports.isSecurityRequirementElement = exports.isSecurityDefinitionsElement = exports.isScopesElement = exports.isSchemaElement = exports.isResponsesElement = exports.isResponsesDefinitionsElement = exports.isResponseElement = exports.isReferenceLikeElement = exports.isReferenceElement = exports.isRefElement = exports.isPathsElement = exports.isPathItemElement = exports.isParametersDefinitionsElement = exports.isParameterElement = exports.isOperationElement = exports.isObjectElement = exports.isNumberElement = exports.isNullElement = exports.isMemberElement = exports.isLinkPrimitiveElement = exports.isLicenseElement = exports.isJSONReferenceElement = exports.isItemsElement = exports.isInfoElement = exports.isHeadersElement = exports.isHeaderElement = exports.isExternalDocumentationElement = exports.isExampleElement = exports.isElement = exports.isDefinitionsElement = exports.isContactElement = exports.isBooleanElement = exports.isArrayElement = exports.getNodeType = exports.default = exports.createRefractor = exports.XmlElement = exports.Visitor = exports.TagElement = exports.SwaggerVersionElement = exports.SwaggerTagsElement = exports.SwaggerSecurityElement = exports.SwaggerSchemesElement = exports.SwaggerProducesElement = exports.SwaggerElement = exports.SwaggerConsumesElement = exports.SpecificationVisitor = exports.SecuritySchemeElement = exports.SecurityRequirementElement = exports.SecurityDefinitionsElement = exports.ScopesElement = exports.SchemaElement = exports.ResponsesElement = exports.ResponsesDefinitionsElement = exports.ResponseElement = exports.ReferenceElement = exports.PatternedFieldsVisitor = exports.PathsElement = exports.PathItemParametersElement = exports.PathItemElement = exports.ParametersDefinitionsElement = exports.ParameterElement = exports.OperationTagsElement = exports.OperationSecurityElement = exports.OperationSchemesElement = exports.OperationProducesElement = exports.OperationParametersElement = exports.OperationElement = exports.OperationConsumesElement = exports.OpenAPIMediaTypes = exports.MixedFieldsVisitor = exports.MapVisitor = exports.LicenseElement = exports.JSONReferenceElement = exports.ItemsElement = exports.InfoElement = exports.HeadersElement = exports.HeaderElement = exports.FixedFieldsVisitor = exports.FallbackVisitor = exports.ExternalDocumentationElement = exports.ExampleElement = exports.DefinitionsElement = exports.ContactElement = exports.AlternatingVisitor = void 0;
|
|
6
|
+
exports.specificationObj = exports.refractorPluginReplaceEmptyElement = exports.refract = exports.mediaTypes = exports.keyMap = exports.isXmlElement = exports.isTagElement = exports.isSwaggerVersionElement = exports.isSwaggerExtension = exports.isSwaggerElement = exports.isStringElement = exports.isSecuritySchemeElement = exports.isSecurityRequirementElement = exports.isSecurityDefinitionsElement = exports.isScopesElement = exports.isSchemaElement = exports.isResponsesElement = exports.isResponsesDefinitionsElement = exports.isResponseElement = exports.isReferenceLikeElement = exports.isReferenceElement = exports.isRefElement = exports.isPathsElement = exports.isPathItemElement = exports.isParametersDefinitionsElement = exports.isParameterElement = exports.isOperationElement = exports.isObjectElement = exports.isNumberElement = exports.isNullElement = exports.isMemberElement = exports.isLinkPrimitiveElement = exports.isLicenseElement = exports.isJSONReferenceLikeElement = exports.isJSONReferenceElement = exports.isItemsElement = exports.isInfoElement = exports.isHeadersElement = exports.isHeaderElement = exports.isExternalDocumentationElement = exports.isExampleElement = exports.isElement = exports.isDefinitionsElement = exports.isContactElement = exports.isBooleanElement = exports.isArrayElement = exports.getNodeType = exports.default = exports.createRefractor = exports.XmlElement = exports.Visitor = exports.TagElement = exports.SwaggerVersionElement = exports.SwaggerTagsElement = exports.SwaggerSecurityElement = exports.SwaggerSchemesElement = exports.SwaggerProducesElement = exports.SwaggerElement = exports.SwaggerConsumesElement = exports.SpecificationVisitor = exports.SecuritySchemeElement = exports.SecurityRequirementElement = exports.SecurityDefinitionsElement = exports.ScopesElement = exports.SchemaElement = exports.ResponsesElement = exports.ResponsesDefinitionsElement = exports.ResponseElement = exports.ReferenceElement = exports.PatternedFieldsVisitor = exports.PathsElement = exports.PathItemParametersElement = exports.PathItemElement = exports.ParametersDefinitionsElement = exports.ParameterElement = exports.OperationTagsElement = exports.OperationSecurityElement = exports.OperationSchemesElement = exports.OperationProducesElement = exports.OperationParametersElement = exports.OperationElement = exports.OperationConsumesElement = exports.OpenAPIMediaTypes = exports.MixedFieldsVisitor = exports.MapVisitor = exports.LicenseElement = exports.JSONReferenceElement = exports.ItemsElement = exports.InfoElement = exports.HeadersElement = exports.HeaderElement = exports.FixedFieldsVisitor = exports.FallbackVisitor = exports.ExternalDocumentationElement = exports.ExampleElement = exports.DefinitionsElement = exports.ContactElement = exports.AlternatingVisitor = void 0;
|
|
7
7
|
var _apidomCore = require("@swagger-api/apidom-core");
|
|
8
8
|
exports.isRefElement = _apidomCore.isRefElement;
|
|
9
9
|
exports.isLinkPrimitiveElement = _apidomCore.isLinkElement;
|
|
@@ -17,6 +17,7 @@ exports.isNumberElement = _apidomCore.isNumberElement;
|
|
|
17
17
|
exports.isStringElement = _apidomCore.isStringElement;
|
|
18
18
|
var _apidomNsJsonSchemaDraft = require("@swagger-api/apidom-ns-json-schema-draft-4");
|
|
19
19
|
exports.isJSONReferenceElement = _apidomNsJsonSchemaDraft.isJSONReferenceElement;
|
|
20
|
+
exports.isJSONReferenceLikeElement = _apidomNsJsonSchemaDraft.isJSONReferenceLikeElement;
|
|
20
21
|
exports.JSONReferenceElement = _apidomNsJsonSchemaDraft.JSONReferenceElement;
|
|
21
22
|
var _mediaTypes = _interopRequireWildcard(require("./media-types.cjs"));
|
|
22
23
|
exports.mediaTypes = _mediaTypes.default;
|
|
@@ -327,39 +327,28 @@ const findElementFactory = (ancestor, keyName) => {
|
|
|
327
327
|
const keyMapping = schema[elementType] || schema[(0, _apidomCore.toValue)(ancestor.classes.first)];
|
|
328
328
|
return typeof keyMapping === 'undefined' ? undefined : Object.prototype.hasOwnProperty.call(keyMapping, '[key: *]') ? keyMapping['[key: *]'] : keyMapping[keyName];
|
|
329
329
|
};
|
|
330
|
-
const plugin = () => () => {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
context: ancestor
|
|
345
|
-
}, undefined, (0, _apidomCore.cloneDeep)(originalValue.meta), (0, _apidomCore.cloneDeep)(originalValue.attributes)), (0, _apidomCore.cloneDeep)(element.meta), (0, _apidomCore.cloneDeep)(element.attributes));
|
|
346
|
-
},
|
|
347
|
-
StringElement(element, ...rest) {
|
|
348
|
-
if (!isEmptyElement(element)) return undefined;
|
|
349
|
-
const [,,, ancestors] = rest;
|
|
350
|
-
const ancestor = ancestors[ancestors.length - 1]; // @TODO(vladimir.gorej@gmail.com): can be replaced by Array.prototype.at in future
|
|
351
|
-
|
|
352
|
-
// we're only interested in empty elements in ArrayElements
|
|
353
|
-
if (!(0, _apidomCore.isArrayElement)(ancestor)) return undefined;
|
|
354
|
-
const elementFactory = findElementFactory(ancestor, '<*>');
|
|
355
|
-
|
|
356
|
-
// no element factory found
|
|
357
|
-
if (typeof elementFactory === 'undefined') return undefined;
|
|
358
|
-
return elementFactory.call({
|
|
359
|
-
context: element
|
|
360
|
-
}, undefined, (0, _apidomCore.cloneDeep)(element.meta), (0, _apidomCore.cloneDeep)(element.attributes));
|
|
330
|
+
const plugin = () => () => ({
|
|
331
|
+
visitor: {
|
|
332
|
+
StringElement(element, key, parent, path, ancestors) {
|
|
333
|
+
if (!isEmptyElement(element)) return undefined;
|
|
334
|
+
const lineage = [...ancestors, parent].filter(_apidomCore.isElement);
|
|
335
|
+
const parentElement = lineage[lineage.length - 1]; // @TODO(vladimir.gorej@gmail.com): can be replaced by Array.prototype.at in future
|
|
336
|
+
let elementFactory;
|
|
337
|
+
let context;
|
|
338
|
+
if ((0, _apidomCore.isArrayElement)(parentElement)) {
|
|
339
|
+
context = element;
|
|
340
|
+
elementFactory = findElementFactory(parentElement, '<*>');
|
|
341
|
+
} else if ((0, _apidomCore.isMemberElement)(parentElement)) {
|
|
342
|
+
context = lineage[lineage.length - 2]; // @TODO(vladimir.gorej@gmail.com): can be replaced by Array.prototype.at in future
|
|
343
|
+
elementFactory = findElementFactory(context, (0, _apidomCore.toValue)(parentElement.key));
|
|
361
344
|
}
|
|
345
|
+
|
|
346
|
+
// no element factory found
|
|
347
|
+
if (typeof elementFactory !== 'function') return undefined;
|
|
348
|
+
return elementFactory.call({
|
|
349
|
+
context
|
|
350
|
+
}, undefined, (0, _apidomCore.cloneDeep)(element.meta), (0, _apidomCore.cloneDeep)(element.attributes));
|
|
362
351
|
}
|
|
363
|
-
}
|
|
364
|
-
};
|
|
352
|
+
}
|
|
353
|
+
});
|
|
365
354
|
var _default = exports.default = plugin;
|
|
@@ -15,22 +15,14 @@ var _visitor = require("../../traversal/visitor.cjs");
|
|
|
15
15
|
*/
|
|
16
16
|
const SpecificationVisitor = (0, _stampit.default)(_Visitor.default, {
|
|
17
17
|
props: {
|
|
18
|
-
passingOptionsNames: ['specObj', 'openApiGenericElement', 'openApiSemanticElement'],
|
|
19
18
|
specObj: null,
|
|
20
|
-
|
|
21
|
-
openApiSemanticElement: null
|
|
19
|
+
passingOptionsNames: ['specObj']
|
|
22
20
|
},
|
|
23
21
|
init({
|
|
24
|
-
// @ts-
|
|
25
|
-
specObj = this.specObj
|
|
26
|
-
// @ts-ignore
|
|
27
|
-
openApiGenericElement = this.openApiGenericElement,
|
|
28
|
-
// @ts-ignore
|
|
29
|
-
openApiSemanticElement = this.openApiSemanticElement
|
|
22
|
+
// @ts-ignoreh
|
|
23
|
+
specObj = this.specObj
|
|
30
24
|
}) {
|
|
31
25
|
this.specObj = specObj;
|
|
32
|
-
this.openApiGenericElement = openApiGenericElement;
|
|
33
|
-
this.openApiSemanticElement = openApiSemanticElement;
|
|
34
26
|
},
|
|
35
27
|
methods: {
|
|
36
28
|
retrievePassingOptions() {
|