swagger-client 3.26.6 → 3.26.8
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 +49 -29
- package/dist/swagger-client.browser.min.js +1 -1
- package/dist/swagger-client.browser.min.js.map +1 -1
- package/es/execute/oas3/content-serializer.js +10 -1
- package/es/execute/oas3/parameter-builders.js +3 -5
- package/es/execute/oas3/style-serializer.js +11 -23
- package/lib/execute/oas3/content-serializer.js +10 -1
- package/lib/execute/oas3/parameter-builders.js +2 -4
- package/lib/execute/oas3/style-serializer.js +12 -24
- package/package.json +1 -1
|
@@ -622,9 +622,18 @@ function serialize(value, mediaType) {
|
|
|
622
622
|
// Assume the user has a JSON string
|
|
623
623
|
return value;
|
|
624
624
|
}
|
|
625
|
+
if (Array.isArray(value)) {
|
|
626
|
+
value = value.map(v => {
|
|
627
|
+
try {
|
|
628
|
+
return JSON.parse(v);
|
|
629
|
+
} catch (e) {
|
|
630
|
+
return v;
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
}
|
|
625
634
|
return JSON.stringify(value);
|
|
626
635
|
}
|
|
627
|
-
return value
|
|
636
|
+
return String(value);
|
|
628
637
|
}
|
|
629
638
|
|
|
630
639
|
/***/ }),
|
|
@@ -658,16 +667,14 @@ function path({
|
|
|
658
667
|
if (value === undefined) return;
|
|
659
668
|
if (content) {
|
|
660
669
|
const effectiveMediaType = Object.keys(content)[0];
|
|
661
|
-
req.url = req.url.split(`{${name}}`).join((0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_0__.
|
|
662
|
-
escape: true
|
|
663
|
-
}));
|
|
670
|
+
req.url = req.url.split(`{${name}}`).join((0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_0__.encodeCharacters)((0,_content_serializer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value, effectiveMediaType)));
|
|
664
671
|
} else {
|
|
665
672
|
const styledValue = (0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_0__["default"])({
|
|
666
673
|
key: parameter.name,
|
|
667
674
|
value,
|
|
668
675
|
style: style || 'simple',
|
|
669
676
|
explode: explode || false,
|
|
670
|
-
escape:
|
|
677
|
+
escape: 'reserved'
|
|
671
678
|
});
|
|
672
679
|
req.url = req.url.replace(new RegExp(`{${name}}`, 'g'), styledValue);
|
|
673
680
|
}
|
|
@@ -774,38 +781,23 @@ function cookie({
|
|
|
774
781
|
__webpack_require__.r(__webpack_exports__);
|
|
775
782
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
776
783
|
/* harmony export */ "default": () => (/* binding */ stylize),
|
|
777
|
-
/* harmony export */
|
|
784
|
+
/* harmony export */ encodeCharacters: () => (/* binding */ encodeCharacters),
|
|
778
785
|
/* harmony export */ valueEncoder: () => (/* binding */ valueEncoder)
|
|
779
786
|
/* harmony export */ });
|
|
780
787
|
const isRfc3986Reserved = char => ":/?#[]@!$&'()*+,;=".indexOf(char) > -1;
|
|
781
|
-
const
|
|
788
|
+
const isRfc3986Unreserved = char => /^[a-z0-9\-._~]+$/i.test(char);
|
|
782
789
|
|
|
783
790
|
// eslint-disable-next-line default-param-last
|
|
784
|
-
function
|
|
785
|
-
escape
|
|
786
|
-
} = {}, parse) {
|
|
787
|
-
if (typeof str === 'number') {
|
|
788
|
-
str = str.toString();
|
|
789
|
-
}
|
|
790
|
-
if (typeof str !== 'string' || !str.length) {
|
|
791
|
-
return str;
|
|
792
|
-
}
|
|
793
|
-
if (!escape) {
|
|
794
|
-
return str;
|
|
795
|
-
}
|
|
796
|
-
if (parse) {
|
|
797
|
-
return JSON.parse(str);
|
|
798
|
-
}
|
|
799
|
-
|
|
791
|
+
function encodeCharacters(str, characterSet = 'reserved') {
|
|
800
792
|
// In ES6 you can do this quite easily by using the new ... spread operator.
|
|
801
793
|
// This causes the string iterator (another new ES6 feature) to be used internally,
|
|
802
794
|
// and because that iterator is designed to deal with
|
|
803
795
|
// code points rather than UCS-2/UTF-16 code units.
|
|
804
796
|
return [...str].map(char => {
|
|
805
|
-
if (
|
|
797
|
+
if (isRfc3986Unreserved(char)) {
|
|
806
798
|
return char;
|
|
807
799
|
}
|
|
808
|
-
if (isRfc3986Reserved(char) &&
|
|
800
|
+
if (isRfc3986Reserved(char) && characterSet === 'unsafe') {
|
|
809
801
|
return char;
|
|
810
802
|
}
|
|
811
803
|
const encoder = new TextEncoder();
|
|
@@ -825,13 +817,16 @@ function stylize(config) {
|
|
|
825
817
|
}
|
|
826
818
|
return encodePrimitive(config);
|
|
827
819
|
}
|
|
828
|
-
function valueEncoder(value, escape) {
|
|
820
|
+
function valueEncoder(value, escape = false) {
|
|
829
821
|
if (Array.isArray(value) || value !== null && typeof value === 'object') {
|
|
830
822
|
value = JSON.stringify(value);
|
|
823
|
+
} else if (typeof value === 'number' || typeof value === 'boolean') {
|
|
824
|
+
value = String(value);
|
|
831
825
|
}
|
|
832
|
-
|
|
833
|
-
escape
|
|
834
|
-
}
|
|
826
|
+
if (escape && value.length > 0) {
|
|
827
|
+
return encodeCharacters(value, escape);
|
|
828
|
+
}
|
|
829
|
+
return value;
|
|
835
830
|
}
|
|
836
831
|
function encodeArray({
|
|
837
832
|
key,
|
|
@@ -20650,6 +20645,14 @@ const mergeAll = (visitors, {
|
|
|
20650
20645
|
const visitFn = visitFnGetter(visitors[i], nodeTypeGetter(currentNode), false);
|
|
20651
20646
|
if (typeof visitFn === 'function') {
|
|
20652
20647
|
const result = visitFn.call(visitors[i], currentNode, ...rest);
|
|
20648
|
+
|
|
20649
|
+
// check if the visitor is async
|
|
20650
|
+
if (typeof (result === null || result === void 0 ? void 0 : result.then) === 'function') {
|
|
20651
|
+
throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_0__["default"]('Async visitor not supported in sync mode', {
|
|
20652
|
+
visitor: visitors[i],
|
|
20653
|
+
visitFn
|
|
20654
|
+
});
|
|
20655
|
+
}
|
|
20653
20656
|
if (result === skipVisitingNodeSymbol) {
|
|
20654
20657
|
skipping[i] = node;
|
|
20655
20658
|
} else if (result === breakSymbol) {
|
|
@@ -20675,6 +20678,14 @@ const mergeAll = (visitors, {
|
|
|
20675
20678
|
const visitFn = visitFnGetter(visitors[i], nodeTypeGetter(node), true);
|
|
20676
20679
|
if (typeof visitFn === 'function') {
|
|
20677
20680
|
const result = visitFn.call(visitors[i], node, ...rest);
|
|
20681
|
+
|
|
20682
|
+
// check if the visitor is async
|
|
20683
|
+
if (typeof (result === null || result === void 0 ? void 0 : result.then) === 'function') {
|
|
20684
|
+
throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_0__["default"]('Async visitor not supported in sync mode', {
|
|
20685
|
+
visitor: visitors[i],
|
|
20686
|
+
visitFn
|
|
20687
|
+
});
|
|
20688
|
+
}
|
|
20678
20689
|
if (result === breakSymbol) {
|
|
20679
20690
|
skipping[i] = breakSymbol;
|
|
20680
20691
|
} else if (result !== undefined && result !== skipVisitingNodeSymbol) {
|
|
@@ -20918,6 +20929,7 @@ visitor, {
|
|
|
20918
20929
|
}
|
|
20919
20930
|
let result;
|
|
20920
20931
|
if (!Array.isArray(node)) {
|
|
20932
|
+
var _result;
|
|
20921
20933
|
if (!nodePredicate(node)) {
|
|
20922
20934
|
throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_0__["default"](`Invalid AST Node: ${String(node)}`, {
|
|
20923
20935
|
node
|
|
@@ -20939,6 +20951,14 @@ visitor, {
|
|
|
20939
20951
|
// retrieve result
|
|
20940
20952
|
result = visitFn.call(visitor, node, key, parent, path, ancestors);
|
|
20941
20953
|
}
|
|
20954
|
+
|
|
20955
|
+
// check if the visitor is async
|
|
20956
|
+
if (typeof ((_result = result) === null || _result === void 0 ? void 0 : _result.then) === 'function') {
|
|
20957
|
+
throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_0__["default"]('Async visitor not supported in sync mode', {
|
|
20958
|
+
visitor,
|
|
20959
|
+
visitFn
|
|
20960
|
+
});
|
|
20961
|
+
}
|
|
20942
20962
|
if (result === breakSymbol) {
|
|
20943
20963
|
break;
|
|
20944
20964
|
}
|