swagger-client 3.35.0 → 3.35.2
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/dist/swagger-client.browser.js +1600 -730
- package/dist/swagger-client.browser.min.js +1 -1
- package/dist/swagger-client.browser.min.js.map +1 -1
- package/es/resolver/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/dereference.js +17 -17
- package/es/resolver/strategies/generic/normalize.js +7 -2
- package/es/resolver/strategies/openapi-3-1-apidom/resolve.js +3 -3
- package/lib/index.js +15 -15
- package/lib/resolver/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/dereference.js +13 -13
- package/lib/resolver/strategies/generic/normalize.js +7 -2
- package/lib/resolver/strategies/openapi-3-1-apidom/resolve.js +4 -4
- package/package.json +10 -10
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { RefElement, isObjectElement, isPrimitiveElement, isStringElement, isMemberElement, IdentityManager, visit, includesClasses, toValue, cloneShallow, cloneDeep } from '@swagger-api/apidom-core';
|
|
3
3
|
import { ApiDOMError } from '@swagger-api/apidom-error';
|
|
4
4
|
import { isReferenceLikeElement, isReferenceElement, isBooleanJsonSchemaElement, isPathItemElement, isSchemaElement, ReferenceElement, PathItemElement, SchemaElement, getNodeType, keyMap } from '@swagger-api/apidom-ns-openapi-3-1';
|
|
5
|
-
import { evaluate as jsonPointerEvaluate,
|
|
5
|
+
import { evaluate as jsonPointerEvaluate, URIFragmentIdentifier } from '@swagger-api/apidom-json-pointer/modern';
|
|
6
6
|
import { url, MaximumDereferenceDepthError, File } from '@swagger-api/apidom-reference/configuration/empty';
|
|
7
7
|
import { OpenAPI3_1DereferenceVisitor, resolveSchema$refField, maybeRefractToSchemaElement } from '@swagger-api/apidom-reference/dereference/strategies/openapi-3-1';
|
|
8
8
|
import { isAnchor, uriToAnchor, evaluate as $anchorEvaluate } from '@swagger-api/apidom-reference/dereference/strategies/openapi-3-1/selectors/$anchor';
|
|
@@ -64,10 +64,10 @@ class OpenAPI3_1SwaggerClientDereferenceVisitor extends OpenAPI3_1DereferenceVis
|
|
|
64
64
|
const reference = await this.toReference(toValue(referencingElement.$ref));
|
|
65
65
|
const $refBaseURI = url.resolve(retrievalURI, toValue(referencingElement.$ref));
|
|
66
66
|
this.indirections.push(referencingElement);
|
|
67
|
-
const jsonPointer =
|
|
67
|
+
const jsonPointer = URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
68
68
|
|
|
69
69
|
// possibly non-semantic fragment
|
|
70
|
-
let referencedElement = jsonPointerEvaluate(
|
|
70
|
+
let referencedElement = jsonPointerEvaluate(reference.value.result, jsonPointer);
|
|
71
71
|
referencedElement.id = identityManager.identify(referencedElement);
|
|
72
72
|
|
|
73
73
|
// applying semantics to a fragment
|
|
@@ -204,7 +204,7 @@ class OpenAPI3_1SwaggerClientDereferenceVisitor extends OpenAPI3_1DereferenceVis
|
|
|
204
204
|
const wrappedError = wrapError(rootCause, {
|
|
205
205
|
baseDoc: this.reference.uri,
|
|
206
206
|
$ref: toValue(referencingElement.$ref),
|
|
207
|
-
pointer:
|
|
207
|
+
pointer: URIFragmentIdentifier.fromURIReference(toValue(referencingElement.$ref)),
|
|
208
208
|
fullPath: (_this$basePath2 = this.basePath) !== null && _this$basePath2 !== void 0 ? _this$basePath2 : [...toPath([...ancestors, parent, referencingElement]), '$ref']
|
|
209
209
|
});
|
|
210
210
|
(_this$options$derefer3 = this.options.dereference.dereferenceOpts) === null || _this$options$derefer3 === void 0 || (_this$options$derefer3 = _this$options$derefer3.errors) === null || _this$options$derefer3 === void 0 || (_this$options$derefer4 = _this$options$derefer3.push) === null || _this$options$derefer4 === void 0 || _this$options$derefer4.call(_this$options$derefer3, wrappedError);
|
|
@@ -243,10 +243,10 @@ class OpenAPI3_1SwaggerClientDereferenceVisitor extends OpenAPI3_1DereferenceVis
|
|
|
243
243
|
const reference = await this.toReference(toValue(pathItemElement.$ref));
|
|
244
244
|
const $refBaseURI = url.resolve(retrievalURI, toValue(pathItemElement.$ref));
|
|
245
245
|
this.indirections.push(pathItemElement);
|
|
246
|
-
const jsonPointer =
|
|
246
|
+
const jsonPointer = URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
247
247
|
|
|
248
248
|
// possibly non-semantic referenced element
|
|
249
|
-
let referencedElement = jsonPointerEvaluate(
|
|
249
|
+
let referencedElement = jsonPointerEvaluate(reference.value.result, jsonPointer);
|
|
250
250
|
referencedElement.id = identityManager.identify(referencedElement);
|
|
251
251
|
|
|
252
252
|
// applying semantics to a referenced element
|
|
@@ -375,7 +375,7 @@ class OpenAPI3_1SwaggerClientDereferenceVisitor extends OpenAPI3_1DereferenceVis
|
|
|
375
375
|
const wrappedError = wrapError(rootCause, {
|
|
376
376
|
baseDoc: this.reference.uri,
|
|
377
377
|
$ref: toValue(pathItemElement.$ref),
|
|
378
|
-
pointer:
|
|
378
|
+
pointer: URIFragmentIdentifier.fromURIReference(toValue(pathItemElement.$ref)),
|
|
379
379
|
fullPath: (_this$basePath4 = this.basePath) !== null && _this$basePath4 !== void 0 ? _this$basePath4 : [...toPath([...ancestors, parent, pathItemElement]), '$ref']
|
|
380
380
|
});
|
|
381
381
|
(_this$options$derefer7 = this.options.dereference.dereferenceOpts) === null || _this$options$derefer7 === void 0 || (_this$options$derefer7 = _this$options$derefer7.errors) === null || _this$options$derefer7 === void 0 || (_this$options$derefer8 = _this$options$derefer7.push) === null || _this$options$derefer8 === void 0 || _this$options$derefer8.call(_this$options$derefer7, wrappedError);
|
|
@@ -451,9 +451,9 @@ class OpenAPI3_1SwaggerClientDereferenceVisitor extends OpenAPI3_1DereferenceVis
|
|
|
451
451
|
return undefined;
|
|
452
452
|
}
|
|
453
453
|
reference = await this.toReference(url.unsanitize($refBaseURI));
|
|
454
|
-
const selector =
|
|
454
|
+
const selector = URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
455
455
|
const referenceAsSchema = maybeRefractToSchemaElement(reference.value.result);
|
|
456
|
-
referencedElement = jsonPointerEvaluate(
|
|
456
|
+
referencedElement = jsonPointerEvaluate(referenceAsSchema, selector);
|
|
457
457
|
referencedElement = maybeRefractToSchemaElement(referencedElement);
|
|
458
458
|
referencedElement.id = identityManager.identify(referencedElement);
|
|
459
459
|
}
|
|
@@ -501,9 +501,9 @@ class OpenAPI3_1SwaggerClientDereferenceVisitor extends OpenAPI3_1DereferenceVis
|
|
|
501
501
|
return undefined;
|
|
502
502
|
}
|
|
503
503
|
reference = await this.toReference(url.unsanitize($refBaseURI));
|
|
504
|
-
const selector =
|
|
504
|
+
const selector = URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
505
505
|
const referenceAsSchema = maybeRefractToSchemaElement(reference.value.result);
|
|
506
|
-
referencedElement = jsonPointerEvaluate(
|
|
506
|
+
referencedElement = jsonPointerEvaluate(referenceAsSchema, selector);
|
|
507
507
|
referencedElement = maybeRefractToSchemaElement(referencedElement);
|
|
508
508
|
referencedElement.id = identityManager.identify(referencedElement);
|
|
509
509
|
}
|
|
@@ -528,7 +528,7 @@ class OpenAPI3_1SwaggerClientDereferenceVisitor extends OpenAPI3_1DereferenceVis
|
|
|
528
528
|
if (this.options.dereference.circular === 'error') {
|
|
529
529
|
throw new ApiDOMError('Circular reference detected');
|
|
530
530
|
} else if (this.options.dereference.circular === 'replace') {
|
|
531
|
-
var _this$options$derefer9, _this$options$
|
|
531
|
+
var _this$options$derefer9, _this$options$derefer0;
|
|
532
532
|
const refElement = new RefElement(referencedElement.id, {
|
|
533
533
|
type: 'json-schema',
|
|
534
534
|
uri: reference.uri,
|
|
@@ -536,7 +536,7 @@ class OpenAPI3_1SwaggerClientDereferenceVisitor extends OpenAPI3_1DereferenceVis
|
|
|
536
536
|
baseURI: url.resolve(retrievalURI, $refBaseURI),
|
|
537
537
|
referencingElement
|
|
538
538
|
});
|
|
539
|
-
const replacer = (_this$options$derefer9 = (_this$options$
|
|
539
|
+
const replacer = (_this$options$derefer9 = (_this$options$derefer0 = this.options.dereference.strategyOpts['openapi-3-1']) === null || _this$options$derefer0 === void 0 ? void 0 : _this$options$derefer0.circularReplacer) !== null && _this$options$derefer9 !== void 0 ? _this$options$derefer9 : this.options.dereference.circularReplacer;
|
|
540
540
|
const replacement = replacer(refElement);
|
|
541
541
|
link.replaceWith(replacement, mutationReplacer);
|
|
542
542
|
return !parent ? replacement : false;
|
|
@@ -635,7 +635,7 @@ class OpenAPI3_1SwaggerClientDereferenceVisitor extends OpenAPI3_1DereferenceVis
|
|
|
635
635
|
*/
|
|
636
636
|
return !parent ? referencedElement : undefined;
|
|
637
637
|
} catch (error) {
|
|
638
|
-
var _this$basePath6, _this$options$
|
|
638
|
+
var _this$basePath6, _this$options$derefer1, _this$options$derefer10;
|
|
639
639
|
const rootCause = getRootCause(error);
|
|
640
640
|
const wrappedError = new SchemaRefError(`Could not resolve reference: ${rootCause.message}`, {
|
|
641
641
|
baseDoc: this.reference.uri,
|
|
@@ -643,7 +643,7 @@ class OpenAPI3_1SwaggerClientDereferenceVisitor extends OpenAPI3_1DereferenceVis
|
|
|
643
643
|
fullPath: (_this$basePath6 = this.basePath) !== null && _this$basePath6 !== void 0 ? _this$basePath6 : [...toPath([...ancestors, parent, referencingElement]), '$ref'],
|
|
644
644
|
cause: rootCause
|
|
645
645
|
});
|
|
646
|
-
(_this$options$
|
|
646
|
+
(_this$options$derefer1 = this.options.dereference.dereferenceOpts) === null || _this$options$derefer1 === void 0 || (_this$options$derefer1 = _this$options$derefer1.errors) === null || _this$options$derefer1 === void 0 || (_this$options$derefer10 = _this$options$derefer1.push) === null || _this$options$derefer10 === void 0 || _this$options$derefer10.call(_this$options$derefer1, wrappedError);
|
|
647
647
|
return undefined;
|
|
648
648
|
}
|
|
649
649
|
}
|
|
@@ -661,14 +661,14 @@ class OpenAPI3_1SwaggerClientDereferenceVisitor extends OpenAPI3_1DereferenceVis
|
|
|
661
661
|
try {
|
|
662
662
|
return await super.ExampleElement(exampleElement, key, parent, path, ancestors, link);
|
|
663
663
|
} catch (error) {
|
|
664
|
-
var _this$basePath7, _this$options$
|
|
664
|
+
var _this$basePath7, _this$options$derefer11, _this$options$derefer12;
|
|
665
665
|
const rootCause = getRootCause(error);
|
|
666
666
|
const wrappedError = wrapError(rootCause, {
|
|
667
667
|
baseDoc: this.reference.uri,
|
|
668
668
|
externalValue: toValue(exampleElement.externalValue),
|
|
669
669
|
fullPath: (_this$basePath7 = this.basePath) !== null && _this$basePath7 !== void 0 ? _this$basePath7 : [...toPath([...ancestors, parent, exampleElement]), 'externalValue']
|
|
670
670
|
});
|
|
671
|
-
(_this$options$
|
|
671
|
+
(_this$options$derefer11 = this.options.dereference.dereferenceOpts) === null || _this$options$derefer11 === void 0 || (_this$options$derefer11 = _this$options$derefer11.errors) === null || _this$options$derefer11 === void 0 || (_this$options$derefer12 = _this$options$derefer11.push) === null || _this$options$derefer12 === void 0 || _this$options$derefer12.call(_this$options$derefer11, wrappedError);
|
|
672
672
|
return undefined;
|
|
673
673
|
}
|
|
674
674
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isPlainObject } from 'ramda-adjunct';
|
|
1
2
|
import opId from '../../../helpers/op-id.js';
|
|
2
3
|
export default function normalize(parsedSpec) {
|
|
3
4
|
const {
|
|
@@ -73,12 +74,16 @@ export default function normalize(parsedSpec) {
|
|
|
73
74
|
for (const inherits of inheritsList) {
|
|
74
75
|
// eslint-disable-next-line no-restricted-syntax
|
|
75
76
|
for (const inheritName in inherits) {
|
|
76
|
-
if (!operation[inheritName]) {
|
|
77
|
+
if (!Array.isArray(operation[inheritName])) {
|
|
77
78
|
operation[inheritName] = inherits[inheritName];
|
|
78
79
|
} else if (inheritName === 'parameters') {
|
|
79
80
|
// eslint-disable-next-line no-restricted-syntax
|
|
80
81
|
for (const param of inherits[inheritName]) {
|
|
81
|
-
const exists = operation[inheritName].some(opParam =>
|
|
82
|
+
const exists = operation[inheritName].some(opParam => {
|
|
83
|
+
if (!isPlainObject(opParam) && !isPlainObject(param)) return false;
|
|
84
|
+
if (opParam === param) return true;
|
|
85
|
+
return ['name', '$ref', '$$ref'].some(key => typeof opParam[key] === 'string' && typeof param[key] === 'string' && opParam[key] === param[key]);
|
|
86
|
+
});
|
|
82
87
|
if (!exists) {
|
|
83
88
|
operation[inheritName].push(param);
|
|
84
89
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable camelcase */
|
|
2
2
|
import { ParseResultElement, ObjectElement, toValue, transclude, cloneDeep } from '@swagger-api/apidom-core';
|
|
3
|
-
import { compile as jsonPointerCompile, evaluate as jsonPointerEvaluate,
|
|
3
|
+
import { compile as jsonPointerCompile, evaluate as jsonPointerEvaluate, JSONPointerEvaluateError } from '@swagger-api/apidom-json-pointer/modern';
|
|
4
4
|
import { mediaTypes, OpenApi3_1Element } from '@swagger-api/apidom-ns-openapi-3-1';
|
|
5
5
|
import { dereferenceApiDOM, url, ReferenceSet, Reference, options as referenceOptions } from '@swagger-api/apidom-reference/configuration/empty';
|
|
6
6
|
import BinaryParser from '@swagger-api/apidom-reference/parse/parsers/binary';
|
|
@@ -66,7 +66,7 @@ const resolveOpenAPI31Strategy = async options => {
|
|
|
66
66
|
// prepare fragment for dereferencing
|
|
67
67
|
const jsonPointer = jsonPointerCompile(pathDiscriminator);
|
|
68
68
|
const jsonPointerURI = jsonPointer === '' ? '' : `#${jsonPointer}`;
|
|
69
|
-
const fragmentElement = jsonPointerEvaluate(
|
|
69
|
+
const fragmentElement = jsonPointerEvaluate(openApiElement, jsonPointer);
|
|
70
70
|
|
|
71
71
|
// prepare reference set for dereferencing
|
|
72
72
|
const openApiElementReference = new Reference({
|
|
@@ -147,7 +147,7 @@ const resolveOpenAPI31Strategy = async options => {
|
|
|
147
147
|
errors
|
|
148
148
|
};
|
|
149
149
|
} catch (error) {
|
|
150
|
-
if (error instanceof
|
|
150
|
+
if (error instanceof JSONPointerEvaluateError) {
|
|
151
151
|
return {
|
|
152
152
|
spec,
|
|
153
153
|
errors: []
|
package/lib/index.js
CHANGED
|
@@ -15,14 +15,14 @@ var _index7 = _interopRequireDefault(require("./resolver/strategies/openapi-3-0/
|
|
|
15
15
|
var _index8 = _interopRequireDefault(require("./resolver/strategies/openapi-3-1-apidom/index.js"));
|
|
16
16
|
var _interfaces = require("./interfaces.js");
|
|
17
17
|
var _index9 = require("./execute/index.js");
|
|
18
|
-
var
|
|
18
|
+
var _index0 = require("./helpers/index.js");
|
|
19
19
|
var _openapiPredicates = require("./helpers/openapi-predicates.js");
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
20
|
+
var _index1 = _interopRequireDefault(require("./resolver/apidom/reference/resolve/resolvers/http-swagger-client/index.js"));
|
|
21
|
+
var _index10 = _interopRequireDefault(require("./resolver/apidom/reference/parse/parsers/json/index.js"));
|
|
22
|
+
var _index11 = _interopRequireDefault(require("./resolver/apidom/reference/parse/parsers/yaml-1-2/index.js"));
|
|
23
|
+
var _index12 = _interopRequireDefault(require("./resolver/apidom/reference/parse/parsers/openapi-json-3-1/index.js"));
|
|
24
|
+
var _index13 = _interopRequireDefault(require("./resolver/apidom/reference/parse/parsers/openapi-yaml-3-1/index.js"));
|
|
25
|
+
var _index14 = _interopRequireDefault(require("./resolver/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/index.js"));
|
|
26
26
|
/* eslint-disable camelcase */
|
|
27
27
|
|
|
28
28
|
Swagger.http = _index.default;
|
|
@@ -46,26 +46,26 @@ Swagger.clearCache = _index6.clearCache;
|
|
|
46
46
|
Swagger.makeApisTagOperation = _interfaces.makeApisTagOperation;
|
|
47
47
|
Swagger.buildRequest = _index9.buildRequest;
|
|
48
48
|
Swagger.helpers = {
|
|
49
|
-
opId:
|
|
49
|
+
opId: _index0.opId
|
|
50
50
|
};
|
|
51
51
|
Swagger.getBaseUrl = _index9.baseUrl;
|
|
52
52
|
Swagger.apidom = {
|
|
53
53
|
resolve: {
|
|
54
54
|
resolvers: {
|
|
55
|
-
HTTPResolverSwaggerClient:
|
|
55
|
+
HTTPResolverSwaggerClient: _index1.default
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
parse: {
|
|
59
59
|
parsers: {
|
|
60
|
-
JsonParser:
|
|
61
|
-
YamlParser:
|
|
62
|
-
OpenApiJson3_1Parser:
|
|
63
|
-
OpenApiYaml3_1Parser:
|
|
60
|
+
JsonParser: _index10.default,
|
|
61
|
+
YamlParser: _index11.default,
|
|
62
|
+
OpenApiJson3_1Parser: _index12.default,
|
|
63
|
+
OpenApiYaml3_1Parser: _index13.default
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
dereference: {
|
|
67
67
|
strategies: {
|
|
68
|
-
OpenApi3_1SwaggerClientDereferenceStrategy:
|
|
68
|
+
OpenApi3_1SwaggerClientDereferenceStrategy: _index14.default
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
};
|
|
@@ -132,7 +132,7 @@ Swagger.prototype.applyDefaults = function applyDefaults() {
|
|
|
132
132
|
spec
|
|
133
133
|
} = this;
|
|
134
134
|
const specUrl = this.url;
|
|
135
|
-
if ((0, _openapiPredicates.isOpenAPI2)(spec) && (0,
|
|
135
|
+
if ((0, _openapiPredicates.isOpenAPI2)(spec) && (0, _index0.isHttpUrl)(specUrl)) {
|
|
136
136
|
const parsed = new URL(specUrl);
|
|
137
137
|
if (!spec.host) {
|
|
138
138
|
spec.host = parsed.host;
|
|
@@ -6,7 +6,7 @@ exports.default = void 0;
|
|
|
6
6
|
var _apidomCore = require("@swagger-api/apidom-core");
|
|
7
7
|
var _apidomError = require("@swagger-api/apidom-error");
|
|
8
8
|
var _apidomNsOpenapi = require("@swagger-api/apidom-ns-openapi-3-1");
|
|
9
|
-
var
|
|
9
|
+
var _modern = require("@swagger-api/apidom-json-pointer/modern");
|
|
10
10
|
var _empty = require("@swagger-api/apidom-reference/configuration/empty");
|
|
11
11
|
var _openapi = require("@swagger-api/apidom-reference/dereference/strategies/openapi-3-1");
|
|
12
12
|
var _$anchor = require("@swagger-api/apidom-reference/dereference/strategies/openapi-3-1/selectors/$anchor");
|
|
@@ -70,10 +70,10 @@ class OpenAPI3_1SwaggerClientDereferenceVisitor extends _openapi.OpenAPI3_1Deref
|
|
|
70
70
|
const reference = await this.toReference((0, _apidomCore.toValue)(referencingElement.$ref));
|
|
71
71
|
const $refBaseURI = _empty.url.resolve(retrievalURI, (0, _apidomCore.toValue)(referencingElement.$ref));
|
|
72
72
|
this.indirections.push(referencingElement);
|
|
73
|
-
const jsonPointer =
|
|
73
|
+
const jsonPointer = _modern.URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
74
74
|
|
|
75
75
|
// possibly non-semantic fragment
|
|
76
|
-
let referencedElement = (0,
|
|
76
|
+
let referencedElement = (0, _modern.evaluate)(reference.value.result, jsonPointer);
|
|
77
77
|
referencedElement.id = identityManager.identify(referencedElement);
|
|
78
78
|
|
|
79
79
|
// applying semantics to a fragment
|
|
@@ -210,7 +210,7 @@ class OpenAPI3_1SwaggerClientDereferenceVisitor extends _openapi.OpenAPI3_1Deref
|
|
|
210
210
|
const wrappedError = wrapError(rootCause, {
|
|
211
211
|
baseDoc: this.reference.uri,
|
|
212
212
|
$ref: (0, _apidomCore.toValue)(referencingElement.$ref),
|
|
213
|
-
pointer:
|
|
213
|
+
pointer: _modern.URIFragmentIdentifier.fromURIReference((0, _apidomCore.toValue)(referencingElement.$ref)),
|
|
214
214
|
fullPath: (_this$basePath2 = this.basePath) != null ? _this$basePath2 : [...(0, _toPath.default)([...ancestors, parent, referencingElement]), '$ref']
|
|
215
215
|
});
|
|
216
216
|
(_this$options$derefer3 = this.options.dereference.dereferenceOpts) == null || (_this$options$derefer3 = _this$options$derefer3.errors) == null || _this$options$derefer3.push == null || _this$options$derefer3.push(wrappedError);
|
|
@@ -249,10 +249,10 @@ class OpenAPI3_1SwaggerClientDereferenceVisitor extends _openapi.OpenAPI3_1Deref
|
|
|
249
249
|
const reference = await this.toReference((0, _apidomCore.toValue)(pathItemElement.$ref));
|
|
250
250
|
const $refBaseURI = _empty.url.resolve(retrievalURI, (0, _apidomCore.toValue)(pathItemElement.$ref));
|
|
251
251
|
this.indirections.push(pathItemElement);
|
|
252
|
-
const jsonPointer =
|
|
252
|
+
const jsonPointer = _modern.URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
253
253
|
|
|
254
254
|
// possibly non-semantic referenced element
|
|
255
|
-
let referencedElement = (0,
|
|
255
|
+
let referencedElement = (0, _modern.evaluate)(reference.value.result, jsonPointer);
|
|
256
256
|
referencedElement.id = identityManager.identify(referencedElement);
|
|
257
257
|
|
|
258
258
|
// applying semantics to a referenced element
|
|
@@ -381,7 +381,7 @@ class OpenAPI3_1SwaggerClientDereferenceVisitor extends _openapi.OpenAPI3_1Deref
|
|
|
381
381
|
const wrappedError = wrapError(rootCause, {
|
|
382
382
|
baseDoc: this.reference.uri,
|
|
383
383
|
$ref: (0, _apidomCore.toValue)(pathItemElement.$ref),
|
|
384
|
-
pointer:
|
|
384
|
+
pointer: _modern.URIFragmentIdentifier.fromURIReference((0, _apidomCore.toValue)(pathItemElement.$ref)),
|
|
385
385
|
fullPath: (_this$basePath4 = this.basePath) != null ? _this$basePath4 : [...(0, _toPath.default)([...ancestors, parent, pathItemElement]), '$ref']
|
|
386
386
|
});
|
|
387
387
|
(_this$options$derefer6 = this.options.dereference.dereferenceOpts) == null || (_this$options$derefer6 = _this$options$derefer6.errors) == null || _this$options$derefer6.push == null || _this$options$derefer6.push(wrappedError);
|
|
@@ -457,9 +457,9 @@ class OpenAPI3_1SwaggerClientDereferenceVisitor extends _openapi.OpenAPI3_1Deref
|
|
|
457
457
|
return undefined;
|
|
458
458
|
}
|
|
459
459
|
reference = await this.toReference(_empty.url.unsanitize($refBaseURI));
|
|
460
|
-
const selector =
|
|
460
|
+
const selector = _modern.URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
461
461
|
const referenceAsSchema = (0, _openapi.maybeRefractToSchemaElement)(reference.value.result);
|
|
462
|
-
referencedElement = (0,
|
|
462
|
+
referencedElement = (0, _modern.evaluate)(referenceAsSchema, selector);
|
|
463
463
|
referencedElement = (0, _openapi.maybeRefractToSchemaElement)(referencedElement);
|
|
464
464
|
referencedElement.id = identityManager.identify(referencedElement);
|
|
465
465
|
}
|
|
@@ -507,9 +507,9 @@ class OpenAPI3_1SwaggerClientDereferenceVisitor extends _openapi.OpenAPI3_1Deref
|
|
|
507
507
|
return undefined;
|
|
508
508
|
}
|
|
509
509
|
reference = await this.toReference(_empty.url.unsanitize($refBaseURI));
|
|
510
|
-
const selector =
|
|
510
|
+
const selector = _modern.URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
511
511
|
const referenceAsSchema = (0, _openapi.maybeRefractToSchemaElement)(reference.value.result);
|
|
512
|
-
referencedElement = (0,
|
|
512
|
+
referencedElement = (0, _modern.evaluate)(referenceAsSchema, selector);
|
|
513
513
|
referencedElement = (0, _openapi.maybeRefractToSchemaElement)(referencedElement);
|
|
514
514
|
referencedElement.id = identityManager.identify(referencedElement);
|
|
515
515
|
}
|
|
@@ -667,14 +667,14 @@ class OpenAPI3_1SwaggerClientDereferenceVisitor extends _openapi.OpenAPI3_1Deref
|
|
|
667
667
|
try {
|
|
668
668
|
return await super.ExampleElement(exampleElement, key, parent, path, ancestors, link);
|
|
669
669
|
} catch (error) {
|
|
670
|
-
var _this$basePath7, _this$options$
|
|
670
|
+
var _this$basePath7, _this$options$derefer0;
|
|
671
671
|
const rootCause = (0, _getRootCause.default)(error);
|
|
672
672
|
const wrappedError = wrapError(rootCause, {
|
|
673
673
|
baseDoc: this.reference.uri,
|
|
674
674
|
externalValue: (0, _apidomCore.toValue)(exampleElement.externalValue),
|
|
675
675
|
fullPath: (_this$basePath7 = this.basePath) != null ? _this$basePath7 : [...(0, _toPath.default)([...ancestors, parent, exampleElement]), 'externalValue']
|
|
676
676
|
});
|
|
677
|
-
(_this$options$
|
|
677
|
+
(_this$options$derefer0 = this.options.dereference.dereferenceOpts) == null || (_this$options$derefer0 = _this$options$derefer0.errors) == null || _this$options$derefer0.push == null || _this$options$derefer0.push(wrappedError);
|
|
678
678
|
return undefined;
|
|
679
679
|
}
|
|
680
680
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = normalize;
|
|
6
|
+
var _ramdaAdjunct = require("ramda-adjunct");
|
|
6
7
|
var _opId = _interopRequireDefault(require("../../../helpers/op-id.js"));
|
|
7
8
|
function normalize(parsedSpec) {
|
|
8
9
|
const {
|
|
@@ -78,12 +79,16 @@ function normalize(parsedSpec) {
|
|
|
78
79
|
for (const inherits of inheritsList) {
|
|
79
80
|
// eslint-disable-next-line no-restricted-syntax
|
|
80
81
|
for (const inheritName in inherits) {
|
|
81
|
-
if (!operation[inheritName]) {
|
|
82
|
+
if (!Array.isArray(operation[inheritName])) {
|
|
82
83
|
operation[inheritName] = inherits[inheritName];
|
|
83
84
|
} else if (inheritName === 'parameters') {
|
|
84
85
|
// eslint-disable-next-line no-restricted-syntax
|
|
85
86
|
for (const param of inherits[inheritName]) {
|
|
86
|
-
const exists = operation[inheritName].some(opParam =>
|
|
87
|
+
const exists = operation[inheritName].some(opParam => {
|
|
88
|
+
if (!(0, _ramdaAdjunct.isPlainObject)(opParam) && !(0, _ramdaAdjunct.isPlainObject)(param)) return false;
|
|
89
|
+
if (opParam === param) return true;
|
|
90
|
+
return ['name', '$ref', '$$ref'].some(key => typeof opParam[key] === 'string' && typeof param[key] === 'string' && opParam[key] === param[key]);
|
|
91
|
+
});
|
|
87
92
|
if (!exists) {
|
|
88
93
|
operation[inheritName].push(param);
|
|
89
94
|
}
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
5
5
|
exports.__esModule = true;
|
|
6
6
|
exports.default = exports.circularReplacer = void 0;
|
|
7
7
|
var _apidomCore = require("@swagger-api/apidom-core");
|
|
8
|
-
var
|
|
8
|
+
var _modern = require("@swagger-api/apidom-json-pointer/modern");
|
|
9
9
|
var _apidomNsOpenapi = require("@swagger-api/apidom-ns-openapi-3-1");
|
|
10
10
|
var _empty = require("@swagger-api/apidom-reference/configuration/empty");
|
|
11
11
|
var _binary = _interopRequireDefault(require("@swagger-api/apidom-reference/parse/parsers/binary"));
|
|
@@ -72,9 +72,9 @@ const resolveOpenAPI31Strategy = async options => {
|
|
|
72
72
|
const openApiParseResultElement = new _apidomCore.ParseResultElement([openApiElement]);
|
|
73
73
|
|
|
74
74
|
// prepare fragment for dereferencing
|
|
75
|
-
const jsonPointer = (0,
|
|
75
|
+
const jsonPointer = (0, _modern.compile)(pathDiscriminator);
|
|
76
76
|
const jsonPointerURI = jsonPointer === '' ? '' : `#${jsonPointer}`;
|
|
77
|
-
const fragmentElement = (0,
|
|
77
|
+
const fragmentElement = (0, _modern.evaluate)(openApiElement, jsonPointer);
|
|
78
78
|
|
|
79
79
|
// prepare reference set for dereferencing
|
|
80
80
|
const openApiElementReference = new _empty.Reference({
|
|
@@ -155,7 +155,7 @@ const resolveOpenAPI31Strategy = async options => {
|
|
|
155
155
|
errors
|
|
156
156
|
};
|
|
157
157
|
} catch (error) {
|
|
158
|
-
if (error instanceof
|
|
158
|
+
if (error instanceof _modern.JSONPointerEvaluateError) {
|
|
159
159
|
return {
|
|
160
160
|
spec,
|
|
161
161
|
errors: []
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "swagger-client",
|
|
3
|
-
"version": "3.35.
|
|
3
|
+
"version": "3.35.2",
|
|
4
4
|
"description": "SwaggerJS - a collection of interfaces for OAI specs",
|
|
5
5
|
"browser": {
|
|
6
6
|
"./src/helpers/btoa.node.js": "./src/helpers/btoa.browser.js",
|
|
@@ -74,11 +74,11 @@
|
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@babel/runtime-corejs3": "^7.22.15",
|
|
76
76
|
"@scarf/scarf": "=1.4.0",
|
|
77
|
-
"@swagger-api/apidom-core": ">=1.0.0-beta.
|
|
78
|
-
"@swagger-api/apidom-error": ">=1.0.0-beta.
|
|
79
|
-
"@swagger-api/apidom-json-pointer": ">=1.0.0-beta.
|
|
80
|
-
"@swagger-api/apidom-ns-openapi-3-1": ">=1.0.0-beta.
|
|
81
|
-
"@swagger-api/apidom-reference": ">=1.0.0-beta.
|
|
77
|
+
"@swagger-api/apidom-core": ">=1.0.0-beta.37 <1.0.0-rc.0",
|
|
78
|
+
"@swagger-api/apidom-error": ">=1.0.0-beta.37 <1.0.0-rc.0",
|
|
79
|
+
"@swagger-api/apidom-json-pointer": ">=1.0.0-beta.37 <1.0.0-rc.0",
|
|
80
|
+
"@swagger-api/apidom-ns-openapi-3-1": ">=1.0.0-beta.37 <1.0.0-rc.0",
|
|
81
|
+
"@swagger-api/apidom-reference": ">=1.0.0-beta.37 <1.0.0-rc.0",
|
|
82
82
|
"@swaggerexpert/cookie": "^2.0.2",
|
|
83
83
|
"deepmerge": "~4.3.0",
|
|
84
84
|
"fast-json-patch": "^3.0.0-1",
|
|
@@ -104,9 +104,9 @@
|
|
|
104
104
|
"cross-env": "=7.0.3",
|
|
105
105
|
"eslint": "^8.42.0",
|
|
106
106
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
107
|
-
"eslint-config-prettier": "=10.1.
|
|
107
|
+
"eslint-config-prettier": "=10.1.5",
|
|
108
108
|
"eslint-plugin-import": "=2.31.0",
|
|
109
|
-
"eslint-plugin-prettier": "=5.
|
|
109
|
+
"eslint-plugin-prettier": "=5.4.0",
|
|
110
110
|
"expect": "^29.0.3",
|
|
111
111
|
"glob": "=11.0.2",
|
|
112
112
|
"husky": "^9.0.11",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"jest-environment-jsdom": "^29.0.3",
|
|
117
117
|
"json-loader": "=0.5.7",
|
|
118
118
|
"license-checker": "=25.0.1",
|
|
119
|
-
"lint-staged": "=
|
|
119
|
+
"lint-staged": "=16.0.0",
|
|
120
120
|
"lodash": "^4.17.21",
|
|
121
121
|
"npm-run-all": "=4.1.5",
|
|
122
122
|
"prettier": "^3.1.1",
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"source-map-explorer": "^2.5.3",
|
|
125
125
|
"terser-webpack-plugin": "^5.0.3",
|
|
126
126
|
"undici": "^5.28.4",
|
|
127
|
-
"webpack": "=5.99.
|
|
127
|
+
"webpack": "=5.99.8",
|
|
128
128
|
"webpack-bundle-size-analyzer": "=3.1.0",
|
|
129
129
|
"webpack-cli": "=6.0.1",
|
|
130
130
|
"webpack-stats-plugin": "=1.1.3"
|