openapi-explorer 2.1.645 → 2.1.648
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/browser/openapi-explorer.min.js +2 -2
- package/dist/es/components/api-request.js +12 -1
- package/dist/es/languages/index.js +2 -2
- package/dist/es/openapi-explorer.js +4 -1
- package/dist/lib/components/api-request.js +12 -1
- package/dist/lib/languages/index.js +2 -2
- package/dist/lib/openapi-explorer.js +4 -1
- package/package.json +1 -1
@@ -496,7 +496,9 @@ export default class ApiRequest extends LitElement {
|
|
496
496
|
const requestBodyContainerEl = requestPanelEl.querySelector('.request-body-container');
|
497
497
|
let pathUrl = `${this.serverUrl.replace(/\/$/, '')}${this.path.replaceAll(' ', '')}`; // Generate URL using Path Params
|
498
498
|
|
499
|
+
const pathParameterMap = {};
|
499
500
|
pathParamEls.map(el => {
|
501
|
+
pathParameterMap[el.dataset.pname] = el.value;
|
500
502
|
pathUrl = pathUrl.replace(`{${el.dataset.pname}}`, encodeURIComponent(el.value) || '-');
|
501
503
|
}); // Handle relative serverUrls
|
502
504
|
|
@@ -511,15 +513,18 @@ export default class ApiRequest extends LitElement {
|
|
511
513
|
headers: new Headers()
|
512
514
|
}; // Query Params
|
513
515
|
|
516
|
+
const queryParameterMap = {};
|
514
517
|
queryParamEls.forEach(el => {
|
515
518
|
if (!el.dataset.array || el.dataset.array === 'false') {
|
516
519
|
if (el.value !== '') {
|
520
|
+
queryParameterMap[el.dataset.pname] = el.value;
|
517
521
|
fetchUrl.searchParams.append(el.dataset.pname, el.value);
|
518
522
|
}
|
519
523
|
} else {
|
520
524
|
const paramSerializeStyle = el.dataset.paramSerializeStyle;
|
521
525
|
const paramSerializeExplode = el.dataset.paramSerializeExplode;
|
522
526
|
const values = Array.isArray(el.value) ? el.value.filter(v => v !== '') : [];
|
527
|
+
queryParameterMap[el.dataset.pname] = values;
|
523
528
|
|
524
529
|
if (values.length > 0) {
|
525
530
|
if (paramSerializeStyle === 'spaceDelimited') {
|
@@ -727,6 +732,8 @@ export default class ApiRequest extends LitElement {
|
|
727
732
|
return {
|
728
733
|
fetchOptions,
|
729
734
|
fetchUrl,
|
735
|
+
path: pathParameterMap,
|
736
|
+
query: queryParameterMap,
|
730
737
|
curlParts: {
|
731
738
|
data: curlData,
|
732
739
|
form: curlForm
|
@@ -752,7 +759,9 @@ export default class ApiRequest extends LitElement {
|
|
752
759
|
const tryBtnEl = this.querySelectorAll('.btn-execute')[0];
|
753
760
|
const {
|
754
761
|
fetchOptions,
|
755
|
-
fetchUrl
|
762
|
+
fetchUrl,
|
763
|
+
path,
|
764
|
+
query
|
756
765
|
} = this.recomputeFetchOptions();
|
757
766
|
this.responseIsBlob = false;
|
758
767
|
this.respContentDisposition = '';
|
@@ -766,6 +775,8 @@ export default class ApiRequest extends LitElement {
|
|
766
775
|
const fetchRequest = {
|
767
776
|
explorerLocation: this.elementId,
|
768
777
|
url: fetchUrl.toString(),
|
778
|
+
path,
|
779
|
+
query,
|
769
780
|
options: fetchOptions,
|
770
781
|
...fetchOptions
|
771
782
|
};
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import i18next from 'i18next';
|
2
2
|
import en from './en.js';
|
3
3
|
import fr from './fr.js';
|
4
|
-
export async function initI18n() {
|
5
|
-
const initLang = window.navigator.language.substring(0, 2);
|
4
|
+
export async function initI18n(resolvedSpecLanguage) {
|
5
|
+
const initLang = (resolvedSpecLanguage || window.navigator.language).substring(0, 2);
|
6
6
|
await i18next.init({
|
7
7
|
lng: initLang,
|
8
8
|
fallbackLng: 'en',
|
@@ -270,7 +270,6 @@ export default class OpenApiExplorer extends LitElement {
|
|
270
270
|
this.handleResize = this.handleResize.bind(this);
|
271
271
|
window.addEventListener('resize', this.handleResize);
|
272
272
|
this.loading = true;
|
273
|
-
initI18n();
|
274
273
|
const parent = this.parentElement;
|
275
274
|
|
276
275
|
if (parent) {
|
@@ -456,6 +455,8 @@ export default class OpenApiExplorer extends LitElement {
|
|
456
455
|
this.matchPaths = '';
|
457
456
|
|
458
457
|
try {
|
458
|
+
var _spec$info;
|
459
|
+
|
459
460
|
this.resolvedSpec = null;
|
460
461
|
this.loading = true;
|
461
462
|
this.loadFailed = false;
|
@@ -468,6 +469,8 @@ export default class OpenApiExplorer extends LitElement {
|
|
468
469
|
return;
|
469
470
|
}
|
470
471
|
|
472
|
+
initI18n((_spec$info = spec.info) === null || _spec$info === void 0 ? void 0 : _spec$info['x-locale']);
|
473
|
+
|
471
474
|
if (!this.serverUrl) {
|
472
475
|
var _spec$servers$, _spec$servers$2;
|
473
476
|
|
@@ -516,7 +516,9 @@ class ApiRequest extends _lit.LitElement {
|
|
516
516
|
const requestBodyContainerEl = requestPanelEl.querySelector('.request-body-container');
|
517
517
|
let pathUrl = `${this.serverUrl.replace(/\/$/, '')}${this.path.replaceAll(' ', '')}`; // Generate URL using Path Params
|
518
518
|
|
519
|
+
const pathParameterMap = {};
|
519
520
|
pathParamEls.map(el => {
|
521
|
+
pathParameterMap[el.dataset.pname] = el.value;
|
520
522
|
pathUrl = pathUrl.replace(`{${el.dataset.pname}}`, encodeURIComponent(el.value) || '-');
|
521
523
|
}); // Handle relative serverUrls
|
522
524
|
|
@@ -531,15 +533,18 @@ class ApiRequest extends _lit.LitElement {
|
|
531
533
|
headers: new Headers()
|
532
534
|
}; // Query Params
|
533
535
|
|
536
|
+
const queryParameterMap = {};
|
534
537
|
queryParamEls.forEach(el => {
|
535
538
|
if (!el.dataset.array || el.dataset.array === 'false') {
|
536
539
|
if (el.value !== '') {
|
540
|
+
queryParameterMap[el.dataset.pname] = el.value;
|
537
541
|
fetchUrl.searchParams.append(el.dataset.pname, el.value);
|
538
542
|
}
|
539
543
|
} else {
|
540
544
|
const paramSerializeStyle = el.dataset.paramSerializeStyle;
|
541
545
|
const paramSerializeExplode = el.dataset.paramSerializeExplode;
|
542
546
|
const values = Array.isArray(el.value) ? el.value.filter(v => v !== '') : [];
|
547
|
+
queryParameterMap[el.dataset.pname] = values;
|
543
548
|
|
544
549
|
if (values.length > 0) {
|
545
550
|
if (paramSerializeStyle === 'spaceDelimited') {
|
@@ -747,6 +752,8 @@ class ApiRequest extends _lit.LitElement {
|
|
747
752
|
return {
|
748
753
|
fetchOptions,
|
749
754
|
fetchUrl,
|
755
|
+
path: pathParameterMap,
|
756
|
+
query: queryParameterMap,
|
750
757
|
curlParts: {
|
751
758
|
data: curlData,
|
752
759
|
form: curlForm
|
@@ -772,7 +779,9 @@ class ApiRequest extends _lit.LitElement {
|
|
772
779
|
const tryBtnEl = this.querySelectorAll('.btn-execute')[0];
|
773
780
|
const {
|
774
781
|
fetchOptions,
|
775
|
-
fetchUrl
|
782
|
+
fetchUrl,
|
783
|
+
path,
|
784
|
+
query
|
776
785
|
} = this.recomputeFetchOptions();
|
777
786
|
this.responseIsBlob = false;
|
778
787
|
this.respContentDisposition = '';
|
@@ -786,6 +795,8 @@ class ApiRequest extends _lit.LitElement {
|
|
786
795
|
const fetchRequest = {
|
787
796
|
explorerLocation: this.elementId,
|
788
797
|
url: fetchUrl.toString(),
|
798
|
+
path,
|
799
|
+
query,
|
789
800
|
options: fetchOptions,
|
790
801
|
...fetchOptions
|
791
802
|
};
|
@@ -12,8 +12,8 @@ var _fr = _interopRequireDefault(require("./fr.js"));
|
|
12
12
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
14
|
|
15
|
-
async function initI18n() {
|
16
|
-
const initLang = window.navigator.language.substring(0, 2);
|
15
|
+
async function initI18n(resolvedSpecLanguage) {
|
16
|
+
const initLang = (resolvedSpecLanguage || window.navigator.language).substring(0, 2);
|
17
17
|
await _i18next.default.init({
|
18
18
|
lng: initLang,
|
19
19
|
fallbackLng: 'en',
|
@@ -300,7 +300,6 @@ class OpenApiExplorer extends _lit.LitElement {
|
|
300
300
|
this.handleResize = this.handleResize.bind(this);
|
301
301
|
window.addEventListener('resize', this.handleResize);
|
302
302
|
this.loading = true;
|
303
|
-
(0, _index.initI18n)();
|
304
303
|
const parent = this.parentElement;
|
305
304
|
|
306
305
|
if (parent) {
|
@@ -486,6 +485,8 @@ class OpenApiExplorer extends _lit.LitElement {
|
|
486
485
|
this.matchPaths = '';
|
487
486
|
|
488
487
|
try {
|
488
|
+
var _spec$info;
|
489
|
+
|
489
490
|
this.resolvedSpec = null;
|
490
491
|
this.loading = true;
|
491
492
|
this.loadFailed = false;
|
@@ -498,6 +499,8 @@ class OpenApiExplorer extends _lit.LitElement {
|
|
498
499
|
return;
|
499
500
|
}
|
500
501
|
|
502
|
+
(0, _index.initI18n)((_spec$info = spec.info) === null || _spec$info === void 0 ? void 0 : _spec$info['x-locale']);
|
503
|
+
|
501
504
|
if (!this.serverUrl) {
|
502
505
|
var _spec$servers$, _spec$servers$2;
|
503
506
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "openapi-explorer",
|
3
|
-
"version": "2.1.
|
3
|
+
"version": "2.1.648",
|
4
4
|
"description": "OpenAPI Explorer - API viewer with dynamically generated components, documentation, and interaction console",
|
5
5
|
"author": "Authress Developers <developers@authress.io>",
|
6
6
|
"type": "module",
|