swagger-client 3.19.4 → 3.19.6
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 +110 -104
- 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 +51 -51
- package/es/resolver/apidom/reference/resolve/resolvers/http-swagger-client/index.js +11 -2
- package/lib/execute/oas3/build-request.js +2 -1
- package/lib/index.js +1 -1
- package/lib/resolver/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/dereference.js +51 -51
- package/lib/resolver/apidom/reference/resolve/resolvers/http-swagger-client/index.js +11 -2
- package/lib/subtree-resolver/index.js +22 -1
- package/package.json +5 -5
|
@@ -2893,7 +2893,7 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
2893
2893
|
methods: {
|
|
2894
2894
|
async ReferenceElement(referenceElement, key, parent, path, ancestors) {
|
|
2895
2895
|
try {
|
|
2896
|
-
const [ancestorsLineage, directAncestors] = this.toAncestorLineage(ancestors);
|
|
2896
|
+
const [ancestorsLineage, directAncestors] = this.toAncestorLineage([...ancestors, parent]);
|
|
2897
2897
|
|
|
2898
2898
|
// skip already identified cycled Path Item Objects
|
|
2899
2899
|
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.includesClasses)(['cycle'], referenceElement.$ref)) {
|
|
@@ -2942,6 +2942,21 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
2942
2942
|
if (this.indirections.length > this.options.dereference.maxDepth) {
|
|
2943
2943
|
throw new _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_10__["default"](`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
|
|
2944
2944
|
}
|
|
2945
|
+
if (!this.useCircularStructures) {
|
|
2946
|
+
const hasCycles = ancestorsLineage.some(ancs => ancs.has(fragment));
|
|
2947
|
+
if (hasCycles) {
|
|
2948
|
+
if (_swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_6__.isHttpUrl(retrievalURI) || _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_6__.isFileSystemPath(retrievalURI)) {
|
|
2949
|
+
// make the referencing URL or file system path absolute
|
|
2950
|
+
const cycledReferenceElement = new _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_9__.ReferenceElement({
|
|
2951
|
+
$ref: $refBaseURI
|
|
2952
|
+
}, referenceElement.meta.clone(), referenceElement.attributes.clone());
|
|
2953
|
+
cycledReferenceElement.get('$ref').classes.push('cycle');
|
|
2954
|
+
return cycledReferenceElement;
|
|
2955
|
+
}
|
|
2956
|
+
// skip processing this schema and all it's child schemas
|
|
2957
|
+
return false;
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2945
2960
|
|
|
2946
2961
|
// append referencing schema to ancestors lineage
|
|
2947
2962
|
directAncestors.add(referenceElement);
|
|
@@ -2965,21 +2980,6 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
2965
2980
|
// remove referencing schema from ancestors lineage
|
|
2966
2981
|
directAncestors.delete(referenceElement);
|
|
2967
2982
|
this.indirections.pop();
|
|
2968
|
-
if (!this.useCircularStructures) {
|
|
2969
|
-
const hasCycles = ancestorsLineage.some(ancs => ancs.has(fragment));
|
|
2970
|
-
if (hasCycles) {
|
|
2971
|
-
if (_swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_6__.isHttpUrl(retrievalURI) || _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_6__.isFileSystemPath(retrievalURI)) {
|
|
2972
|
-
// make the referencing URL or file system path absolute
|
|
2973
|
-
const cycledReferenceElement = new _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_9__.ReferenceElement({
|
|
2974
|
-
$ref: $refBaseURI
|
|
2975
|
-
}, referenceElement.meta.clone(), referenceElement.attributes.clone());
|
|
2976
|
-
cycledReferenceElement.get('$ref').classes.push('cycle');
|
|
2977
|
-
return cycledReferenceElement;
|
|
2978
|
-
}
|
|
2979
|
-
// skip processing this schema but traverse all it's child schemas
|
|
2980
|
-
return false;
|
|
2981
|
-
}
|
|
2982
|
-
}
|
|
2983
2983
|
fragment = fragment.clone();
|
|
2984
2984
|
fragment.setMetaProperty('ref-fields', {
|
|
2985
2985
|
$ref: referenceElement.$ref?.toValue(),
|
|
@@ -3025,7 +3025,7 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
3025
3025
|
},
|
|
3026
3026
|
async PathItemElement(pathItemElement, key, parent, path, ancestors) {
|
|
3027
3027
|
try {
|
|
3028
|
-
const [ancestorsLineage, directAncestors] = this.toAncestorLineage(ancestors);
|
|
3028
|
+
const [ancestorsLineage, directAncestors] = this.toAncestorLineage([...ancestors, parent]);
|
|
3029
3029
|
|
|
3030
3030
|
// ignore PathItemElement without $ref field
|
|
3031
3031
|
if (!(0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.isStringElement)(pathItemElement.$ref)) {
|
|
@@ -3070,6 +3070,21 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
3070
3070
|
if (this.indirections.length > this.options.dereference.maxDepth) {
|
|
3071
3071
|
throw new _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_10__["default"](`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
|
|
3072
3072
|
}
|
|
3073
|
+
if (!this.useCircularStructures) {
|
|
3074
|
+
const hasCycles = ancestorsLineage.some(ancs => ancs.has(referencedElement));
|
|
3075
|
+
if (hasCycles) {
|
|
3076
|
+
if (_swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_6__.isHttpUrl(retrievalURI) || _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_6__.isFileSystemPath(retrievalURI)) {
|
|
3077
|
+
// make the referencing URL or file system path absolute
|
|
3078
|
+
const cycledPathItemElement = new _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_9__.PathItemElement({
|
|
3079
|
+
$ref: $refBaseURI
|
|
3080
|
+
}, pathItemElement.meta.clone(), pathItemElement.attributes.clone());
|
|
3081
|
+
cycledPathItemElement.get('$ref').classes.push('cycle');
|
|
3082
|
+
return cycledPathItemElement;
|
|
3083
|
+
}
|
|
3084
|
+
// skip processing this schema and all it's child schemas
|
|
3085
|
+
return false;
|
|
3086
|
+
}
|
|
3087
|
+
}
|
|
3073
3088
|
|
|
3074
3089
|
// append referencing schema to ancestors lineage
|
|
3075
3090
|
directAncestors.add(pathItemElement);
|
|
@@ -3093,21 +3108,6 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
3093
3108
|
// remove referencing schema from ancestors lineage
|
|
3094
3109
|
directAncestors.delete(pathItemElement);
|
|
3095
3110
|
this.indirections.pop();
|
|
3096
|
-
if (!this.useCircularStructures) {
|
|
3097
|
-
const hasCycles = ancestorsLineage.some(ancs => ancs.has(referencedElement));
|
|
3098
|
-
if (hasCycles) {
|
|
3099
|
-
if (_swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_6__.isHttpUrl(retrievalURI) || _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_6__.isFileSystemPath(retrievalURI)) {
|
|
3100
|
-
// make the referencing URL or file system path absolute
|
|
3101
|
-
const cycledPathItemElement = new _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_9__.PathItemElement({
|
|
3102
|
-
$ref: $refBaseURI
|
|
3103
|
-
}, pathItemElement.meta.clone(), pathItemElement.attributes.clone());
|
|
3104
|
-
cycledPathItemElement.get('$ref').classes.push('cycle');
|
|
3105
|
-
return cycledPathItemElement;
|
|
3106
|
-
}
|
|
3107
|
-
// skip processing this schema but traverse all it's child schemas
|
|
3108
|
-
return false;
|
|
3109
|
-
}
|
|
3110
|
-
}
|
|
3111
3111
|
|
|
3112
3112
|
// merge fields from referenced Path Item with referencing one
|
|
3113
3113
|
const mergedPathItemElement = new _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_9__.PathItemElement([...referencedElement.content], referencedElement.meta.clone(), referencedElement.attributes.clone());
|
|
@@ -3150,7 +3150,7 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
3150
3150
|
},
|
|
3151
3151
|
async SchemaElement(referencingElement, key, parent, path, ancestors) {
|
|
3152
3152
|
try {
|
|
3153
|
-
const [ancestorsLineage, directAncestors] = this.toAncestorLineage(ancestors);
|
|
3153
|
+
const [ancestorsLineage, directAncestors] = this.toAncestorLineage([...ancestors, parent]);
|
|
3154
3154
|
|
|
3155
3155
|
// skip current referencing schema as $ref keyword was not defined
|
|
3156
3156
|
if (!(0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.isStringElement)(referencingElement.$ref)) {
|
|
@@ -3240,6 +3240,24 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
3240
3240
|
throw new _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_10__["default"](`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
|
|
3241
3241
|
}
|
|
3242
3242
|
|
|
3243
|
+
// useCircularStructures option processing
|
|
3244
|
+
if (!this.useCircularStructures) {
|
|
3245
|
+
const hasCycles = ancestorsLineage.some(ancs => ancs.has(referencedElement));
|
|
3246
|
+
if (hasCycles) {
|
|
3247
|
+
if (_swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_6__.isHttpUrl(retrievalURI) || _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_6__.isFileSystemPath(retrievalURI)) {
|
|
3248
|
+
// make the referencing URL or file system path absolute
|
|
3249
|
+
const baseURI = _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_6__.resolve(retrievalURI, $refBaseURI);
|
|
3250
|
+
const cycledSchemaElement = new _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_9__.SchemaElement({
|
|
3251
|
+
$ref: baseURI
|
|
3252
|
+
}, referencingElement.meta.clone(), referencingElement.attributes.clone());
|
|
3253
|
+
cycledSchemaElement.get('$ref').classes.push('cycle');
|
|
3254
|
+
return cycledSchemaElement;
|
|
3255
|
+
}
|
|
3256
|
+
// skip processing this schema and all it's child schemas
|
|
3257
|
+
return false;
|
|
3258
|
+
}
|
|
3259
|
+
}
|
|
3260
|
+
|
|
3243
3261
|
// append referencing schema to ancestors lineage
|
|
3244
3262
|
directAncestors.add(referencingElement);
|
|
3245
3263
|
|
|
@@ -3274,24 +3292,6 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
3274
3292
|
return jsonSchemaBooleanElement;
|
|
3275
3293
|
}
|
|
3276
3294
|
|
|
3277
|
-
// useCircularStructures option processing
|
|
3278
|
-
if (!this.useCircularStructures) {
|
|
3279
|
-
const hasCycles = ancestorsLineage.some(ancs => ancs.has(referencedElement));
|
|
3280
|
-
if (hasCycles) {
|
|
3281
|
-
if (_swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_6__.isHttpUrl(retrievalURI) || _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_6__.isFileSystemPath(retrievalURI)) {
|
|
3282
|
-
// make the referencing URL or file system path absolute
|
|
3283
|
-
const baseURI = _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_6__.resolve(retrievalURI, $refBaseURI);
|
|
3284
|
-
const cycledSchemaElement = new _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_9__.SchemaElement({
|
|
3285
|
-
$ref: baseURI
|
|
3286
|
-
}, referencingElement.meta.clone(), referencingElement.attributes.clone());
|
|
3287
|
-
cycledSchemaElement.get('$ref').classes.push('cycle');
|
|
3288
|
-
return cycledSchemaElement;
|
|
3289
|
-
}
|
|
3290
|
-
// skip processing this schema but traverse all it's child schemas
|
|
3291
|
-
return false;
|
|
3292
|
-
}
|
|
3293
|
-
}
|
|
3294
|
-
|
|
3295
3295
|
// Schema Object - merge keywords from referenced schema with referencing schema
|
|
3296
3296
|
const mergedSchemaElement = new _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_9__.SchemaElement([...referencedElement.content], referencedElement.meta.clone(), referencedElement.attributes.clone());
|
|
3297
3297
|
// existing keywords from referencing schema overrides ones from referenced schema
|
|
@@ -3796,8 +3796,17 @@ const HttpResolverSwaggerClient = _swagger_api_apidom_reference_configuration_em
|
|
|
3796
3796
|
url: file.uri,
|
|
3797
3797
|
signal,
|
|
3798
3798
|
userFetch: async (resource, options) => {
|
|
3799
|
-
|
|
3800
|
-
|
|
3799
|
+
let res = await fetch(resource, options);
|
|
3800
|
+
try {
|
|
3801
|
+
// node-fetch supports mutations
|
|
3802
|
+
res.headers.delete('Content-Type');
|
|
3803
|
+
} catch {
|
|
3804
|
+
// Fetch API has guards which prevent mutations
|
|
3805
|
+
res = new Response(res.body, (0,_babel_runtime_corejs3_helpers_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])((0,_babel_runtime_corejs3_helpers_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({}, res), {}, {
|
|
3806
|
+
headers: new Headers(res.headers)
|
|
3807
|
+
}));
|
|
3808
|
+
res.headers.delete('Content-Type');
|
|
3809
|
+
}
|
|
3801
3810
|
return res;
|
|
3802
3811
|
},
|
|
3803
3812
|
credentials,
|
|
@@ -22693,13 +22702,11 @@ const YamlVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
22693
22702
|
indentChar: ' '
|
|
22694
22703
|
},
|
|
22695
22704
|
init({
|
|
22696
|
-
|
|
22697
|
-
indent = 0
|
|
22698
|
-
indentChar = ' '
|
|
22705
|
+
directive = false,
|
|
22706
|
+
indent = 0
|
|
22699
22707
|
} = {}) {
|
|
22700
|
-
this.result =
|
|
22708
|
+
this.result = directive ? '%YAML 1.2\n---\n' : '';
|
|
22701
22709
|
this.indent = indent;
|
|
22702
|
-
this.indentChard = indentChar;
|
|
22703
22710
|
},
|
|
22704
22711
|
methods: {
|
|
22705
22712
|
NumberElement(element) {
|
|
@@ -22730,7 +22737,7 @@ const YamlVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
22730
22737
|
const {
|
|
22731
22738
|
result
|
|
22732
22739
|
} = visitor;
|
|
22733
|
-
this.result += result.startsWith('\n') ? `\n${indent}-${
|
|
22740
|
+
this.result += result.startsWith('\n') ? `\n${indent}-${result}` : `\n${indent}- ${result}`;
|
|
22734
22741
|
});
|
|
22735
22742
|
return false;
|
|
22736
22743
|
},
|
|
@@ -22761,10 +22768,11 @@ const YamlVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
22761
22768
|
}
|
|
22762
22769
|
}
|
|
22763
22770
|
});
|
|
22764
|
-
const serializer = element
|
|
22765
|
-
|
|
22771
|
+
const serializer = (element, {
|
|
22772
|
+
directive = false
|
|
22773
|
+
} = {}) => {
|
|
22766
22774
|
const visitor = YamlVisitor({
|
|
22767
|
-
|
|
22775
|
+
directive
|
|
22768
22776
|
});
|
|
22769
22777
|
(0,_traversal_visitor_js__WEBPACK_IMPORTED_MODULE_2__.visit)(element, visitor);
|
|
22770
22778
|
return visitor.result;
|
|
@@ -36500,7 +36508,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
36500
36508
|
* When a list of Security Requirement Objects is defined on the OpenAPI Object or Operation Object,
|
|
36501
36509
|
* only one of the Security Requirement Objects in the list needs to be satisfied to authorize the request.
|
|
36502
36510
|
*/
|
|
36503
|
-
|
|
36504
36511
|
/* eslint-disable no-param-reassign */
|
|
36505
36512
|
const plugin = () => ({
|
|
36506
36513
|
predicates
|
|
@@ -36566,7 +36573,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
36566
36573
|
* If an alternative server object is specified at the Path Item Object level, it will override OpenAPI.servers.
|
|
36567
36574
|
* If an alternative server object is specified at the Operation Object level, it will override PathItem.servers and OpenAPI.servers respectively.
|
|
36568
36575
|
*/
|
|
36569
|
-
|
|
36570
36576
|
/* eslint-disable no-param-reassign */
|
|
36571
36577
|
const plugin = () => ({
|
|
36572
36578
|
predicates
|
|
@@ -40405,20 +40411,20 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
40405
40411
|
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(5413);
|
|
40406
40412
|
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(4926);
|
|
40407
40413
|
/* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(66175);
|
|
40408
|
-
/* harmony import */ var
|
|
40414
|
+
/* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(67277);
|
|
40409
40415
|
/* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(69346);
|
|
40410
|
-
/* harmony import */ var
|
|
40411
|
-
/* harmony import */ var
|
|
40416
|
+
/* harmony import */ var _swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(77782);
|
|
40417
|
+
/* harmony import */ var _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(94022);
|
|
40412
40418
|
/* harmony import */ var _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(21066);
|
|
40413
40419
|
/* harmony import */ var _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(64614);
|
|
40414
40420
|
/* harmony import */ var _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(37988);
|
|
40415
40421
|
/* harmony import */ var _selectors_$anchor_index_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(24634);
|
|
40416
40422
|
/* harmony import */ var _selectors_uri_index_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(96930);
|
|
40417
|
-
/* harmony import */ var
|
|
40423
|
+
/* harmony import */ var _util_errors_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(22513);
|
|
40418
40424
|
/* harmony import */ var _util_errors_index_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(86144);
|
|
40419
40425
|
/* harmony import */ var _util_url_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8549);
|
|
40420
|
-
/* harmony import */ var
|
|
40421
|
-
/* harmony import */ var
|
|
40426
|
+
/* harmony import */ var _parse_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(79605);
|
|
40427
|
+
/* harmony import */ var _Reference_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(39816);
|
|
40422
40428
|
/* harmony import */ var _util_File_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(49512);
|
|
40423
40429
|
/* harmony import */ var _resolve_strategies_openapi_3_1_util_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(49021);
|
|
40424
40430
|
/* harmony import */ var _selectors_uri_errors_EvaluationJsonSchemaUriError_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(51454);
|
|
@@ -40473,14 +40479,14 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_1__({
|
|
|
40473
40479
|
* Compute full ancestors lineage.
|
|
40474
40480
|
* Ancestors are flatten to unwrap all Element instances.
|
|
40475
40481
|
*/
|
|
40476
|
-
const directAncestors = new WeakSet(ancestors.
|
|
40482
|
+
const directAncestors = new WeakSet(ancestors.filter(_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isElement));
|
|
40477
40483
|
const ancestorsLineage = [...this.ancestors, directAncestors];
|
|
40478
40484
|
return [ancestorsLineage, directAncestors];
|
|
40479
40485
|
},
|
|
40480
40486
|
async toReference(uri) {
|
|
40481
40487
|
// detect maximum depth of resolution
|
|
40482
40488
|
if (this.reference.depth >= this.options.resolve.maxDepth) {
|
|
40483
|
-
throw new
|
|
40489
|
+
throw new _util_errors_index_js__WEBPACK_IMPORTED_MODULE_6__["default"](`Maximum resolution depth of ${this.options.resolve.maxDepth} has been exceeded by file "${this.reference.uri}"`);
|
|
40484
40490
|
}
|
|
40485
40491
|
const baseURI = this.toBaseURI(uri);
|
|
40486
40492
|
const {
|
|
@@ -40491,14 +40497,14 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_1__({
|
|
|
40491
40497
|
if (refSet.has(baseURI)) {
|
|
40492
40498
|
return refSet.find((0,ramda__WEBPACK_IMPORTED_MODULE_2__.propEq)('uri', baseURI));
|
|
40493
40499
|
}
|
|
40494
|
-
const parseResult = await (0,
|
|
40500
|
+
const parseResult = await (0,_parse_index_js__WEBPACK_IMPORTED_MODULE_7__["default"])(_util_url_js__WEBPACK_IMPORTED_MODULE_4__.unsanitize(baseURI), _objectSpread(_objectSpread({}, this.options), {}, {
|
|
40495
40501
|
parse: _objectSpread(_objectSpread({}, this.options.parse), {}, {
|
|
40496
40502
|
mediaType: 'text/plain'
|
|
40497
40503
|
})
|
|
40498
40504
|
}));
|
|
40499
40505
|
|
|
40500
40506
|
// register new Reference with ReferenceSet
|
|
40501
|
-
const reference = (0,
|
|
40507
|
+
const reference = (0,_Reference_js__WEBPACK_IMPORTED_MODULE_8__["default"])({
|
|
40502
40508
|
uri: baseURI,
|
|
40503
40509
|
value: parseResult,
|
|
40504
40510
|
depth: this.reference.depth + 1
|
|
@@ -40508,7 +40514,7 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_1__({
|
|
|
40508
40514
|
},
|
|
40509
40515
|
async ReferenceElement(referencingElement, key, parent, path, ancestors) {
|
|
40510
40516
|
var _referencingElement$$, _referencingElement$$2, _referencingElement$$3, _referencingElement$d, _referencingElement$s;
|
|
40511
|
-
const [ancestorsLineage, directAncestors] = this.toAncestorLineage(ancestors);
|
|
40517
|
+
const [ancestorsLineage, directAncestors] = this.toAncestorLineage([...ancestors, parent]);
|
|
40512
40518
|
|
|
40513
40519
|
// detect possible cycle in traversal and avoid it
|
|
40514
40520
|
if (ancestorsLineage.some(ancs => ancs.has(referencingElement))) {
|
|
@@ -40517,20 +40523,20 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_1__({
|
|
|
40517
40523
|
}
|
|
40518
40524
|
|
|
40519
40525
|
// ignore resolving external Reference Objects
|
|
40520
|
-
if (!this.options.resolve.external && (0,
|
|
40526
|
+
if (!this.options.resolve.external && (0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_9__.isReferenceElementExternal)(referencingElement)) {
|
|
40521
40527
|
return false;
|
|
40522
40528
|
}
|
|
40523
40529
|
const reference = await this.toReference((_referencingElement$$ = referencingElement.$ref) === null || _referencingElement$$ === void 0 ? void 0 : _referencingElement$$.toValue());
|
|
40524
40530
|
const retrievalURI = reference.uri;
|
|
40525
40531
|
const $refBaseURI = _util_url_js__WEBPACK_IMPORTED_MODULE_4__.resolve(retrievalURI, (_referencingElement$$2 = referencingElement.$ref) === null || _referencingElement$$2 === void 0 ? void 0 : _referencingElement$$2.toValue());
|
|
40526
40532
|
this.indirections.push(referencingElement);
|
|
40527
|
-
const jsonPointer = (0,
|
|
40533
|
+
const jsonPointer = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__.uriToPointer)($refBaseURI);
|
|
40528
40534
|
|
|
40529
40535
|
// possibly non-semantic fragment
|
|
40530
|
-
let referencedElement = (0,
|
|
40536
|
+
let referencedElement = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__.evaluate)(jsonPointer, reference.value.result);
|
|
40531
40537
|
|
|
40532
40538
|
// applying semantics to a fragment
|
|
40533
|
-
if ((0,
|
|
40539
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isPrimitiveElement)(referencedElement)) {
|
|
40534
40540
|
const referencedElementType = referencingElement.meta.get('referenced-element').toValue();
|
|
40535
40541
|
if ((0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_11__.isReferenceLikeElement)(referencedElement)) {
|
|
40536
40542
|
// handling indirect references
|
|
@@ -40603,10 +40609,10 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_1__({
|
|
|
40603
40609
|
},
|
|
40604
40610
|
async PathItemElement(referencingElement, key, parent, path, ancestors) {
|
|
40605
40611
|
var _referencingElement$$4, _referencingElement$$5, _referencingElement$$6;
|
|
40606
|
-
const [ancestorsLineage, directAncestors] = this.toAncestorLineage(ancestors);
|
|
40612
|
+
const [ancestorsLineage, directAncestors] = this.toAncestorLineage([...ancestors, parent]);
|
|
40607
40613
|
|
|
40608
40614
|
// ignore PathItemElement without $ref field
|
|
40609
|
-
if (!(0,
|
|
40615
|
+
if (!(0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(referencingElement.$ref)) {
|
|
40610
40616
|
return undefined;
|
|
40611
40617
|
}
|
|
40612
40618
|
|
|
@@ -40617,20 +40623,20 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_1__({
|
|
|
40617
40623
|
}
|
|
40618
40624
|
|
|
40619
40625
|
// ignore resolving external Path Item Elements
|
|
40620
|
-
if (!this.options.resolve.external && (0,
|
|
40626
|
+
if (!this.options.resolve.external && (0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_9__.isPathItemElementExternal)(referencingElement)) {
|
|
40621
40627
|
return undefined;
|
|
40622
40628
|
}
|
|
40623
40629
|
const reference = await this.toReference((_referencingElement$$4 = referencingElement.$ref) === null || _referencingElement$$4 === void 0 ? void 0 : _referencingElement$$4.toValue());
|
|
40624
40630
|
const retrievalURI = reference.uri;
|
|
40625
40631
|
const $refBaseURI = _util_url_js__WEBPACK_IMPORTED_MODULE_4__.resolve(retrievalURI, (_referencingElement$$5 = referencingElement.$ref) === null || _referencingElement$$5 === void 0 ? void 0 : _referencingElement$$5.toValue());
|
|
40626
40632
|
this.indirections.push(referencingElement);
|
|
40627
|
-
const jsonPointer = (0,
|
|
40633
|
+
const jsonPointer = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__.uriToPointer)($refBaseURI);
|
|
40628
40634
|
|
|
40629
40635
|
// possibly non-semantic referenced element
|
|
40630
|
-
let referencedElement = (0,
|
|
40636
|
+
let referencedElement = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__.evaluate)(jsonPointer, reference.value.result);
|
|
40631
40637
|
|
|
40632
40638
|
// applying semantics to a referenced element
|
|
40633
|
-
if ((0,
|
|
40639
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isPrimitiveElement)(referencedElement)) {
|
|
40634
40640
|
referencedElement = _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_12__.PathItemElement.refract(referencedElement);
|
|
40635
40641
|
}
|
|
40636
40642
|
|
|
@@ -40687,30 +40693,30 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_1__({
|
|
|
40687
40693
|
},
|
|
40688
40694
|
async LinkElement(linkElement) {
|
|
40689
40695
|
// ignore LinkElement without operationRef or operationId field
|
|
40690
|
-
if (!(0,
|
|
40696
|
+
if (!(0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(linkElement.operationRef) && !(0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(linkElement.operationId)) {
|
|
40691
40697
|
return undefined;
|
|
40692
40698
|
}
|
|
40693
40699
|
|
|
40694
40700
|
// ignore resolving external Path Item Elements
|
|
40695
|
-
if (!this.options.resolve.external && (0,
|
|
40701
|
+
if (!this.options.resolve.external && (0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_9__.isLinkElementExternal)(linkElement)) {
|
|
40696
40702
|
return undefined;
|
|
40697
40703
|
}
|
|
40698
40704
|
|
|
40699
40705
|
// operationRef and operationId fields are mutually exclusive
|
|
40700
|
-
if ((0,
|
|
40706
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(linkElement.operationRef) && (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(linkElement.operationId)) {
|
|
40701
40707
|
throw new Error('LinkElement operationRef and operationId fields are mutually exclusive.');
|
|
40702
40708
|
}
|
|
40703
40709
|
|
|
40704
40710
|
// @ts-ignore
|
|
40705
40711
|
let operationElement;
|
|
40706
|
-
if ((0,
|
|
40712
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(linkElement.operationRef)) {
|
|
40707
40713
|
var _linkElement$operatio, _linkElement$operatio2, _linkElement$operatio3;
|
|
40708
40714
|
// possibly non-semantic referenced element
|
|
40709
|
-
const jsonPointer = (0,
|
|
40715
|
+
const jsonPointer = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__.uriToPointer)((_linkElement$operatio = linkElement.operationRef) === null || _linkElement$operatio === void 0 ? void 0 : _linkElement$operatio.toValue());
|
|
40710
40716
|
const reference = await this.toReference((_linkElement$operatio2 = linkElement.operationRef) === null || _linkElement$operatio2 === void 0 ? void 0 : _linkElement$operatio2.toValue());
|
|
40711
|
-
operationElement = (0,
|
|
40717
|
+
operationElement = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__.evaluate)(jsonPointer, reference.value.result);
|
|
40712
40718
|
// applying semantics to a referenced element
|
|
40713
|
-
if ((0,
|
|
40719
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isPrimitiveElement)(operationElement)) {
|
|
40714
40720
|
operationElement = _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_12__.OperationElement.refract(operationElement);
|
|
40715
40721
|
}
|
|
40716
40722
|
// create shallow clone to be able to annotate with metadata
|
|
@@ -40720,10 +40726,10 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_1__({
|
|
|
40720
40726
|
// annotate operation element with info about origin
|
|
40721
40727
|
operationElement.setMetaProperty('ref-origin', reference.uri);
|
|
40722
40728
|
(_linkElement$operatio3 = linkElement.operationRef) === null || _linkElement$operatio3 === void 0 ? void 0 : _linkElement$operatio3.meta.set('operation', operationElement);
|
|
40723
|
-
} else if ((0,
|
|
40729
|
+
} else if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(linkElement.operationId)) {
|
|
40724
40730
|
var _linkElement$operatio4, _linkElement$operatio5;
|
|
40725
40731
|
const operationId = (_linkElement$operatio4 = linkElement.operationId) === null || _linkElement$operatio4 === void 0 ? void 0 : _linkElement$operatio4.toValue();
|
|
40726
|
-
operationElement = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_16__["default"])(e => (0,
|
|
40732
|
+
operationElement = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_16__["default"])(e => (0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_9__.isOperationElement)(e) && e.operationId.equals(operationId), this.reference.value.result);
|
|
40727
40733
|
// OperationElement not found by its operationId
|
|
40728
40734
|
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_17__["default"])(operationElement)) {
|
|
40729
40735
|
throw new Error(`OperationElement(operationId=${operationId}) not found.`);
|
|
@@ -40735,17 +40741,17 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_1__({
|
|
|
40735
40741
|
async ExampleElement(exampleElement) {
|
|
40736
40742
|
var _exampleElement$exter;
|
|
40737
40743
|
// ignore ExampleElement without externalValue field
|
|
40738
|
-
if (!(0,
|
|
40744
|
+
if (!(0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(exampleElement.externalValue)) {
|
|
40739
40745
|
return undefined;
|
|
40740
40746
|
}
|
|
40741
40747
|
|
|
40742
40748
|
// ignore resolving ExampleElement externalValue
|
|
40743
|
-
if (!this.options.resolve.external && (0,
|
|
40749
|
+
if (!this.options.resolve.external && (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(exampleElement.externalValue)) {
|
|
40744
40750
|
return undefined;
|
|
40745
40751
|
}
|
|
40746
40752
|
|
|
40747
40753
|
// value and externalValue fields are mutually exclusive
|
|
40748
|
-
if (exampleElement.hasKey('value') && (0,
|
|
40754
|
+
if (exampleElement.hasKey('value') && (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(exampleElement.externalValue)) {
|
|
40749
40755
|
throw new Error('ExampleElement value and externalValue fields are mutually exclusive.');
|
|
40750
40756
|
}
|
|
40751
40757
|
const reference = await this.toReference((_exampleElement$exter = exampleElement.externalValue) === null || _exampleElement$exter === void 0 ? void 0 : _exampleElement$exter.toValue());
|
|
@@ -40761,10 +40767,10 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_1__({
|
|
|
40761
40767
|
},
|
|
40762
40768
|
async SchemaElement(referencingElement, key, parent, path, ancestors) {
|
|
40763
40769
|
var _referencingElement$$8;
|
|
40764
|
-
const [ancestorsLineage, directAncestors] = this.toAncestorLineage(ancestors);
|
|
40770
|
+
const [ancestorsLineage, directAncestors] = this.toAncestorLineage([...ancestors, parent]);
|
|
40765
40771
|
|
|
40766
40772
|
// skip current referencing schema as $ref keyword was not defined
|
|
40767
|
-
if (!(0,
|
|
40773
|
+
if (!(0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(referencingElement.$ref)) {
|
|
40768
40774
|
// skip traversing this schema but traverse all it's child schemas
|
|
40769
40775
|
return undefined;
|
|
40770
40776
|
}
|
|
@@ -40810,10 +40816,10 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_1__({
|
|
|
40810
40816
|
} else {
|
|
40811
40817
|
// we're assuming here that we're dealing with JSON Pointer here
|
|
40812
40818
|
reference = await this.toReference(_util_url_js__WEBPACK_IMPORTED_MODULE_4__.unsanitize($refBaseURI));
|
|
40813
|
-
const selector = (0,
|
|
40819
|
+
const selector = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__.uriToPointer)($refBaseURI);
|
|
40814
40820
|
referencedElement = (0,_resolve_strategies_openapi_3_1_util_js__WEBPACK_IMPORTED_MODULE_18__.maybeRefractToSchemaElement)(
|
|
40815
40821
|
// @ts-ignore
|
|
40816
|
-
(0,
|
|
40822
|
+
(0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__.evaluate)(selector, reference.value.result));
|
|
40817
40823
|
}
|
|
40818
40824
|
} catch (error) {
|
|
40819
40825
|
/**
|
|
@@ -40833,10 +40839,10 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_1__({
|
|
|
40833
40839
|
// we're assuming here that we're dealing with JSON Pointer here
|
|
40834
40840
|
reference = await this.toReference(_util_url_js__WEBPACK_IMPORTED_MODULE_4__.unsanitize($refBaseURI));
|
|
40835
40841
|
retrievalURI = reference.uri;
|
|
40836
|
-
const selector = (0,
|
|
40842
|
+
const selector = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__.uriToPointer)($refBaseURI);
|
|
40837
40843
|
referencedElement = (0,_resolve_strategies_openapi_3_1_util_js__WEBPACK_IMPORTED_MODULE_18__.maybeRefractToSchemaElement)(
|
|
40838
40844
|
// @ts-ignore
|
|
40839
|
-
(0,
|
|
40845
|
+
(0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__.evaluate)(selector, reference.value.result));
|
|
40840
40846
|
}
|
|
40841
40847
|
} else {
|
|
40842
40848
|
throw error;
|
|
@@ -40874,7 +40880,7 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_1__({
|
|
|
40874
40880
|
this.indirections.pop();
|
|
40875
40881
|
|
|
40876
40882
|
// Boolean JSON Schemas
|
|
40877
|
-
if ((0,
|
|
40883
|
+
if ((0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_9__.isBooleanJsonSchemaElement)(referencedElement)) {
|
|
40878
40884
|
var _referencingElement$$7;
|
|
40879
40885
|
const referencedElementClone = referencedElement.clone();
|
|
40880
40886
|
// annotate referenced element with info about original referencing element
|