openapi-explorer 1.1.578 → 1.1.581
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 +3 -3
- package/dist/browser/openapi-explorer.min.js.map +1 -1
- package/dist/es/components/api-request.js +65 -63
- package/dist/es/components/request-form-table.js +11 -3
- package/dist/es/components/tag-input.js +7 -3
- package/dist/lib/components/api-request.js +65 -63
- package/dist/lib/components/request-form-table.js +11 -3
- package/dist/lib/components/tag-input.js +7 -3
- package/package.json +1 -1
|
@@ -258,7 +258,9 @@ class ApiRequest extends _lit.LitElement {
|
|
|
258
258
|
tableRows.push((0, _lit.html)` <tr> <td colspan="1" style="width:160px;min-width:50px;vertical-align:top"> <div class="param-name ${paramSchema.deprecated ? 'deprecated' : ''}" style="margin-top:1rem"> ${param.name}${!paramSchema.deprecated && param.required ? (0, _lit.html)`<span style="color:var(--red)">*</span>` : ''} </div> <div class="param-type" style="margin-bottom:1rem"> ${paramSchema.type === 'array' ? `${paramSchema.arrayType}` : `${paramSchema.format ? paramSchema.format : paramSchema.type}`}${!paramSchema.deprecated && param.required ? (0, _lit.html)`<span style="opacity:0">*</span>` : ''} </div> </td> <td colspan="2" style="min-width:160px;vertical-align:top"> ${this.allowTry === 'true' ? paramSchema.type === 'array' && (0, _lit.html)` <div style="margin-top:1rem;margin-bottom:1rem"> <tag-input class="request-param" style="width:100%" data-ptype="${paramLocation}" data-pname="${param.name}" data-default="${Array.isArray(defaultVal) ? defaultVal.join('~|~') : defaultVal}" data-param-serialize-style="${paramStyle}" data-param-serialize-explode="${paramExplode}" data-array="true" placeholder="add-multiple ↩" @change="${e => {
|
|
259
259
|
this.storedParamValues[param.name] = e.detail.value;
|
|
260
260
|
this.computeCurlSyntax();
|
|
261
|
-
}}" .value="${(_this$storedParamValu = this.storedParamValues[param.name]) !== null && _this$storedParamValu !== void 0 ? _this$storedParamValu : this.fillRequestWithDefault === 'true' && Array.isArray(defaultVal) ? defaultVal : defaultVal.split(',')}"></tag-input> </div>` || paramSchema.type === 'object' && (0, _lit.html)` <textarea
|
|
261
|
+
}}" .value="${(_this$storedParamValu = this.storedParamValues[param.name]) !== null && _this$storedParamValu !== void 0 ? _this$storedParamValu : this.fillRequestWithDefault === 'true' && Array.isArray(defaultVal) ? defaultVal : defaultVal.split(',')}"></tag-input> </div>` || paramSchema.type === 'object' && (0, _lit.html)` <textarea @input="${() => {
|
|
262
|
+
this.computeCurlSyntax();
|
|
263
|
+
}}" class="textarea small request-param" part="textarea small textarea-param" rows="3" data-ptype="${paramLocation}" data-pname="${param.name}" data-default="${defaultVal}" data-param-serialize-style="${paramStyle}" data-param-serialize-explode="${paramExplode}" spellcheck="false" placeholder="${paramSchema.example || defaultVal || ''}" style="width:100%;margin-top:1rem;margin-bottom:1rem" .value="${this.fillRequestWithDefault === 'true' ? defaultVal : ''}"></textarea>` || (0, _lit.html)` <input type="${paramSchema.format === 'password' ? 'password' : 'text'}" spellcheck="false" style="width:100%;margin-top:1rem;margin-bottom:1rem" @input="${() => {
|
|
262
264
|
this.computeCurlSyntax();
|
|
263
265
|
}}" placeholder="${paramSchema.example || defaultVal || ''}" class="request-param" part="textbox textbox-param" data-ptype="${paramLocation}" data-pname="${param.name}" data-default="${Array.isArray(defaultVal) ? defaultVal.join('~|~') : defaultVal}" data-array="false" @keyup="${this.requestParamFunction}" .value="${this.fillRequestWithDefault === 'true' ? defaultVal : ''}">` : ''} ${this.exampleListTemplate.call(this, param, paramSchema.type)} </td> ${this.renderStyle === 'focused' ? (0, _lit.html)` <td colspan="2" style="vertical-align:top"> ${param.description ? (0, _lit.html)` <div class="param-description" style="margin-top:1rem"> ${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(param.description))} </div>` : ''} ${paramSchema.default || paramSchema.s || paramSchema.allowedValues || paramSchema.pattern ? (0, _lit.html)` <div class="param-constraint" style="margin-top:1rem"> ${paramSchema.constraints.length ? (0, _lit.html)`<span style="font-weight:700">Constraints: </span>${paramSchema.constraints.join(', ')}<br>` : ''} ${paramSchema.pattern ? (0, _lit.html)` <div class="tooltip tooltip-replace" style="cursor:pointer;max-width:100%;display:flex"> <div style="white-space:nowrap;font-weight:700;margin-right:2px">Pattern: </div> <div style="white-space:nowrap;text-overflow:ellipsis;max-width:100%;overflow:hidden">${paramSchema.pattern}</div> <br> <div class="tooltip-text" style="position:absolute;display:block">${paramSchema.pattern}</div> </div> ` : ''} ${paramSchema.allowedValues && paramSchema.allowedValues.split('┃').map((v, i) => (0, _lit.html)` ${i > 0 ? '|' : (0, _lit.html)`<span style="font-weight:700">Allowed: </span>`} ${(0, _lit.html)` <a part="anchor anchor-param-constraint" class="${this.allowTry === 'true' ? '' : 'inactive-link'}" data-type="${paramSchema.type === 'array' ? 'array' : 'string'}" data-enum="${v.trim()}" @click="${e => {
|
|
264
266
|
const inputEl = e.target.closest('table').querySelector(`[data-pname="${param.name}"]`);
|
|
@@ -415,7 +417,9 @@ class ApiRequest extends _lit.LitElement {
|
|
|
415
417
|
}
|
|
416
418
|
|
|
417
419
|
const displayedBodyExample = reqBodyExamples.find(v => v.exampleId === this.selectedRequestBodyExample) || reqBodyExamples[0];
|
|
418
|
-
reqBodyDefaultHtml = (0, _lit.html)` <div class="example-panel border-top pad-top-8"> ${reqBodyExamples.length === 1 ? '' : (0, _lit.html)` <select aria-label="request body example" style="min-width:100px;max-width:100%;margin-bottom:-1px" @change="${e => this.onSelectExample(e)}"> ${reqBodyExamples.map(v => (0, _lit.html)`<option value="${v.exampleId}" ?selected="${v.exampleId === this.selectedRequestBodyExample}"> ${v.exampleSummary.length > 80 ? v.exampleId : v.exampleSummary ? v.exampleSummary : v.exampleId} </option>`)} </select>`} ${displayedBodyExample ? (0, _lit.html)` <div class="example" data-default="${displayedBodyExample.exampleId}"> ${displayedBodyExample.exampleSummary && displayedBodyExample.exampleSummary.length > 80 ? (0, _lit.html)`<div style="padding:4px 0"> ${displayedBodyExample.exampleSummary} </div>` : ''} ${displayedBodyExample.exampleDescription ? (0, _lit.html)`<div class="m-markdown-small" style="padding:4px 0"> ${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(displayedBodyExample.exampleDescription || ''))} </div>` : ''} <slot name="${this.elementId}--request-body"> <textarea
|
|
420
|
+
reqBodyDefaultHtml = (0, _lit.html)` <div class="example-panel border-top pad-top-8"> ${reqBodyExamples.length === 1 ? '' : (0, _lit.html)` <select aria-label="request body example" style="min-width:100px;max-width:100%;margin-bottom:-1px" @change="${e => this.onSelectExample(e)}"> ${reqBodyExamples.map(v => (0, _lit.html)`<option value="${v.exampleId}" ?selected="${v.exampleId === this.selectedRequestBodyExample}"> ${v.exampleSummary.length > 80 ? v.exampleId : v.exampleSummary ? v.exampleSummary : v.exampleId} </option>`)} </select>`} ${displayedBodyExample ? (0, _lit.html)` <div class="example" data-default="${displayedBodyExample.exampleId}"> ${displayedBodyExample.exampleSummary && displayedBodyExample.exampleSummary.length > 80 ? (0, _lit.html)`<div style="padding:4px 0"> ${displayedBodyExample.exampleSummary} </div>` : ''} ${displayedBodyExample.exampleDescription ? (0, _lit.html)`<div class="m-markdown-small" style="padding:4px 0"> ${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(displayedBodyExample.exampleDescription || ''))} </div>` : ''} <slot name="${this.elementId}--request-body"> <textarea @input="${() => {
|
|
421
|
+
this.computeCurlSyntax();
|
|
422
|
+
}}" class="textarea request-body-param-user-input" part="textarea textarea-param" spellcheck="false" data-ptype="${reqBody.mimeType}" data-default="${displayedBodyExample.exampleFormat === 'text' ? displayedBodyExample.exampleValue : JSON.stringify(displayedBodyExample.exampleValue, null, 8)}" data-default-format="${displayedBodyExample.exampleFormat}" style="width:100%;resize:vertical" .value="${this.fillRequestWithDefault === 'true' ? displayedBodyExample.exampleFormat === 'text' ? displayedBodyExample.exampleValue : JSON.stringify(displayedBodyExample.exampleValue, null, 8) : ''}"></textarea> </slot> <textarea class="textarea is-hidden request-body-param ${reqBody.mimeType.substring(reqBody.mimeType.indexOf('/') + 1)}" spellcheck="false" data-ptype="${reqBody.mimeType}" style="width:100%;resize:vertical;display:none" .value="${displayedBodyExample.exampleFormat === 'text' ? displayedBodyExample.exampleValue : JSON.stringify(displayedBodyExample.exampleValue, null, 8)}"></textarea> </div>` : ''} </div> `;
|
|
419
423
|
} else if (this.selectedRequestBodyType.includes('form-urlencoded') || this.selectedRequestBodyType.includes('form-data')) {
|
|
420
424
|
bodyTabNameUseBody = false;
|
|
421
425
|
const schemaAsObj = (0, _schemaUtils.schemaInObjectNotation)(reqBody.schema, {
|
|
@@ -469,7 +473,7 @@ class ApiRequest extends _lit.LitElement {
|
|
|
469
473
|
}
|
|
470
474
|
|
|
471
475
|
this.activeResponseTab = e.target.dataset.tab;
|
|
472
|
-
}}"> <br> <div style="width:100%"> ${!hasResponse ? '' : (0, _lit.html)` <button class="tab-btn ${this.activeResponseTab === 'response' ? 'active' : ''}" data-tab="response">${(0, _languages.getI18nText)('operations.response')}</button> <button class="tab-btn ${this.activeResponseTab === 'headers' ? 'active' : ''}" data-tab="headers">${(0, _languages.getI18nText)('operations.response-headers')}</button>`} <button class="tab-btn ${!hasResponse || this.activeResponseTab === 'curl' ? 'active' : ''}" data-tab="curl">FULL REQUEST</button> </div> </div> ${this.responseIsBlob ? (0, _lit.html)` <div class="tab-content col" style="flex:1;display:${this.activeResponseTab === 'response' ? 'flex' : 'none'}"> <button class="m-btn thin-border mar-top-8" style="width:135px" @click="${this.downloadResponseBlob}" part="btn btn-outline">DOWNLOAD</button> ${this.responseBlobType === 'view' ? (0, _lit.html)`<button class="m-btn thin-border mar-top-8" style="width:135px" @click="${this.viewResponseBlob}" part="btn btn-outline">VIEW (NEW TAB)</button>` : ''} </div>` : (0, _lit.html)` <div class="tab-content col m-markdown" style="flex:1;display:${this.activeResponseTab === 'response' ? 'flex' : 'none'}"> ${this.responseText ? (0, _lit.html)`<button class="m-btn outline-primary toolbar-copy-btn" @click="${e => {
|
|
476
|
+
}}"> <br> <div style="width:100%"> ${!hasResponse ? '' : (0, _lit.html)` <button class="tab-btn ${this.activeResponseTab === 'response' ? 'active' : ''}" data-tab="response">${(0, _languages.getI18nText)('operations.response')}</button> <button class="tab-btn ${this.activeResponseTab === 'headers' ? 'active' : ''}" data-tab="headers">${(0, _languages.getI18nText)('operations.response-headers')}</button>`} <button class="tab-btn ${!hasResponse || this.activeResponseTab === 'curl' ? 'active' : ''}" data-tab="curl">FULL REQUEST</button> </div> </div> ${this.responseIsBlob ? (0, _lit.html)` <div class="tab-content col" style="flex:1;display:${this.activeResponseTab === 'response' ? 'flex' : 'none'}"> ${this.responseBlobType === 'image' ? (0, _lit.html)`<img style="max-height:var(--resp-area-height,300px);object-fit:contain" class="mar-top-8" src="${this.responseBlobUrl}">` : ''} <div style="display:flex;justify-content:center"> <div> <button class="m-btn thin-border mar-top-8" style="width:135px" @click="${this.downloadResponseBlob}" part="btn btn-outline">DOWNLOAD</button> ${this.responseBlobType === 'view' || this.responseBlobType === 'image' ? (0, _lit.html)`<button class="m-btn thin-border mar-top-8" style="width:135px" @click="${this.viewResponseBlob}" part="btn btn-outline">VIEW (NEW TAB)</button>` : ''} </div> </div> </div>` : (0, _lit.html)` <div class="tab-content col m-markdown" style="flex:1;display:${this.activeResponseTab === 'response' ? 'flex' : 'none'}"> ${this.responseText ? (0, _lit.html)`<button class="m-btn outline-primary toolbar-copy-btn" @click="${e => {
|
|
473
477
|
(0, _commonUtils.copyToClipboard)(this.responseText, e);
|
|
474
478
|
}}" part="btn btn-fill">${(0, _languages.getI18nText)('operations.copy')}</button>` : ''} <pre style="min-height:60px" @copy="${() => {
|
|
475
479
|
(0, _commonUtils.copyToClipboard)(window.getSelection().toString());
|
|
@@ -538,75 +542,68 @@ class ApiRequest extends _lit.LitElement {
|
|
|
538
542
|
headers: new Headers()
|
|
539
543
|
}; // Query Params
|
|
540
544
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
if (el.
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
545
|
+
queryParamEls.forEach(el => {
|
|
546
|
+
if (!el.dataset.array || el.dataset.array === 'false') {
|
|
547
|
+
if (el.value !== '') {
|
|
548
|
+
fetchUrl.searchParams.append(el.dataset.pname, el.value);
|
|
549
|
+
}
|
|
550
|
+
} else {
|
|
551
|
+
const paramSerializeStyle = el.dataset.paramSerializeStyle;
|
|
552
|
+
const paramSerializeExplode = el.dataset.paramSerializeExplode;
|
|
553
|
+
const values = Array.isArray(el.value) ? el.value.filter(v => v !== '') : [];
|
|
554
|
+
|
|
555
|
+
if (values.length > 0) {
|
|
556
|
+
if (paramSerializeStyle === 'spaceDelimited') {
|
|
557
|
+
fetchUrl.searchParams.append(el.dataset.pname, values.join(' ').replace(/^\s|\s$/g, ''));
|
|
558
|
+
} else if (paramSerializeStyle === 'pipeDelimited') {
|
|
559
|
+
fetchUrl.searchParams.append(el.dataset.pname, values.join('|').replace(/^\||\|$/g, ''));
|
|
560
|
+
} else {
|
|
561
|
+
if (paramSerializeExplode === 'true') {
|
|
562
|
+
// eslint-disable-line no-lonely-if
|
|
563
|
+
values.forEach(v => {
|
|
564
|
+
fetchUrl.searchParams.append(el.dataset.pname, v);
|
|
565
|
+
});
|
|
558
566
|
} else {
|
|
559
|
-
|
|
560
|
-
// eslint-disable-line no-lonely-if
|
|
561
|
-
vals.forEach(v => {
|
|
562
|
-
fetchUrl.searchParams.append(el.dataset.pname, v);
|
|
563
|
-
});
|
|
564
|
-
} else {
|
|
565
|
-
fetchUrl.searchParams.append(el.dataset.pname, vals.join(',').replace(/^,|,$/g, ''));
|
|
566
|
-
}
|
|
567
|
+
fetchUrl.searchParams.append(el.dataset.pname, values.join(',').replace(/^,|,$/g, ''));
|
|
567
568
|
}
|
|
568
569
|
}
|
|
569
570
|
}
|
|
570
|
-
}
|
|
571
|
-
} // Query Params (Dynamic - create from JSON)
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
571
|
+
}
|
|
572
|
+
}); // Query Params (Dynamic - create from JSON)
|
|
573
|
+
|
|
574
|
+
queryParamObjTypeEls.map(el => {
|
|
575
|
+
try {
|
|
576
|
+
let queryParamObj = {};
|
|
577
|
+
const paramSerializeStyle = el.dataset.paramSerializeStyle;
|
|
578
|
+
const paramSerializeExplode = el.dataset.paramSerializeExplode;
|
|
579
|
+
queryParamObj = Object.assign(queryParamObj, JSON.parse(el.value.replace(/\s+/g, ' ')));
|
|
580
|
+
|
|
581
|
+
for (const key in queryParamObj) {
|
|
582
|
+
if (typeof queryParamObj[key] === 'object') {
|
|
583
|
+
if (Array.isArray(queryParamObj[key])) {
|
|
584
|
+
if (paramSerializeStyle === 'spaceDelimited') {
|
|
585
|
+
fetchUrl.searchParams.append(key, queryParamObj[key].join(' '));
|
|
586
|
+
} else if (paramSerializeStyle === 'pipeDelimited') {
|
|
587
|
+
fetchUrl.searchParams.append(key, queryParamObj[key].join('|'));
|
|
588
|
+
} else {
|
|
589
|
+
if (paramSerializeExplode === 'true') {
|
|
590
|
+
// eslint-disable-line no-lonely-if
|
|
591
|
+
queryParamObj[key].forEach(v => {
|
|
592
|
+
fetchUrl.searchParams.append(key, v);
|
|
593
|
+
});
|
|
589
594
|
} else {
|
|
590
|
-
|
|
591
|
-
// eslint-disable-line no-lonely-if
|
|
592
|
-
queryParamObj[key].forEach(v => {
|
|
593
|
-
fetchUrl.searchParams.append(key, v);
|
|
594
|
-
});
|
|
595
|
-
} else {
|
|
596
|
-
fetchUrl.searchParams.append(key, queryParamObj[key]);
|
|
597
|
-
}
|
|
595
|
+
fetchUrl.searchParams.append(key, queryParamObj[key]);
|
|
598
596
|
}
|
|
599
597
|
}
|
|
600
|
-
} else {
|
|
601
|
-
fetchUrl.searchParams.append(key, queryParamObj[key]);
|
|
602
598
|
}
|
|
599
|
+
} else {
|
|
600
|
+
fetchUrl.searchParams.append(key, queryParamObj[key]);
|
|
603
601
|
}
|
|
604
|
-
} catch (err) {
|
|
605
|
-
console.log('OpenAPI Explorer: unable to parse %s into object', el.value); // eslint-disable-line no-console
|
|
606
602
|
}
|
|
607
|
-
})
|
|
608
|
-
|
|
609
|
-
|
|
603
|
+
} catch (err) {
|
|
604
|
+
console.log('OpenAPI Explorer: unable to parse %s into object', el.value); // eslint-disable-line no-console
|
|
605
|
+
}
|
|
606
|
+
}); // Add Authentication api keys if provided
|
|
610
607
|
|
|
611
608
|
this.api_keys.filter(v => v.finalKeyValue).forEach(v => {
|
|
612
609
|
if (v.in === 'query') {
|
|
@@ -876,6 +873,9 @@ class ApiRequest extends _lit.LitElement {
|
|
|
876
873
|
} else if (textFileRegex.test(contentType)) {
|
|
877
874
|
this.responseIsBlob = true;
|
|
878
875
|
this.responseBlobType = 'download';
|
|
876
|
+
} else if (contentType.match(/^image/)) {
|
|
877
|
+
this.responseIsBlob = true;
|
|
878
|
+
this.responseBlobType = 'image';
|
|
879
879
|
} else if (mediaFileRegex.test(contentType)) {
|
|
880
880
|
this.responseIsBlob = true;
|
|
881
881
|
this.responseBlobType = 'view';
|
|
@@ -896,7 +896,7 @@ class ApiRequest extends _lit.LitElement {
|
|
|
896
896
|
const contentDisposition = fetchResponse.headers.get('content-disposition');
|
|
897
897
|
const filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
|
|
898
898
|
const filename = filenameRegex.exec(contentDisposition);
|
|
899
|
-
this.respContentDisposition = filename && filename[1] && filename[1].replace(/['"]/g, '') || `download.${_mimeTypes.default
|
|
899
|
+
this.respContentDisposition = filename && filename[1] && filename[1].replace(/['"]/g, '') || `download.${(0, _mimeTypes.default)(contentType) || 'file'}`;
|
|
900
900
|
respBlob = await fetchResponse.blob();
|
|
901
901
|
this.responseBlobUrl = URL.createObjectURL(respBlob);
|
|
902
902
|
}
|
|
@@ -936,6 +936,8 @@ class ApiRequest extends _lit.LitElement {
|
|
|
936
936
|
document.dispatchEvent(new CustomEvent('after-try', responseEvent));
|
|
937
937
|
document.dispatchEvent(new CustomEvent('response', responseEvent));
|
|
938
938
|
}
|
|
939
|
+
|
|
940
|
+
this.requestUpdate();
|
|
939
941
|
}
|
|
940
942
|
|
|
941
943
|
onAddRemoveFileInput(e, pname) {
|
|
@@ -129,19 +129,24 @@ function generatePrimitiveRow(rowData, parentRecursionOptions) {
|
|
|
129
129
|
if (inputEl) {
|
|
130
130
|
inputEl.value = e.target.dataset.type === 'array' ? [e.target.dataset.enum] : e.target.dataset.enum;
|
|
131
131
|
}
|
|
132
|
+
|
|
133
|
+
this.computeCurlSyntax();
|
|
132
134
|
}}"> ${v} </a>`}`)} </div>` : ''} </td> </tr> ${schemaDescription || example ? (0, _lit.html)`<tr class="form-parameter-description"> <td> </td> <td colspan="2" style="margin-top:0;padding:0 5px 8px 5px"> <span class="m-markdown-small">${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(schemaDescription || ''))}</span> ${example ? (0, _lit.html)`<span> <span style="font-weight:700"> Example: </span> ${type === 'array' ? '[ ' : ''} <a part="anchor anchor-param-example" data-example-type="${type === 'array' ? type : 'string'}" data-example="${Array.isArray(example) && example.join('~|~') || example || ''}" @click="${e => {
|
|
133
135
|
const inputEl = e.target.closest('table').querySelector(`[data-pname="${keyLabel}"]`);
|
|
134
136
|
|
|
135
137
|
if (inputEl) {
|
|
136
138
|
inputEl.value = e.target.dataset.exampleType === 'array' ? e.target.dataset.example.split('~|~') : e.target.dataset.example;
|
|
137
139
|
}
|
|
140
|
+
|
|
141
|
+
this.computeCurlSyntax();
|
|
138
142
|
}}"> ${type === 'array' ? example.join(', ') : example} </a> ${type === 'array' ? '] ' : ''} </span>` : ''} </td> </tr>` : ''}`);
|
|
139
143
|
}
|
|
140
144
|
|
|
141
145
|
function inputFieldKeyLabel(isOption, keyLabel, keyDescription, dataType, deprecated, isRequired, schemaTitle, format, rowGenerator) {
|
|
142
146
|
if ((0, _schemaUtils.isPatternProperty)(keyLabel)) {
|
|
143
|
-
return (0, _lit.html)` <td style="width:160px;min-width:100px"> <div class="param-name ${deprecated ? 'deprecated' : ''}"> <input placeholder="${keyLabel}" @
|
|
147
|
+
return (0, _lit.html)` <td style="width:160px;min-width:100px"> <div class="param-name ${deprecated ? 'deprecated' : ''}"> <input placeholder="${keyLabel}" @input="${e => {
|
|
144
148
|
rowGenerator(e);
|
|
149
|
+
this.computeCurlSyntax();
|
|
145
150
|
}}" .value="${''}" spellcheck="false" type="${format === 'binary' ? 'file' : format === 'password' ? 'password' : 'text'}" part="textbox textbox-param" style="width:100%" data-ptype="pattern-property-key" data-pname="${keyLabel}" data-default="${''}" data-array="false"> </div></td>`;
|
|
146
151
|
}
|
|
147
152
|
|
|
@@ -172,19 +177,22 @@ function inputFieldKeyLabel(isOption, keyLabel, keyDescription, dataType, deprec
|
|
|
172
177
|
|
|
173
178
|
function getArrayFormField(keyLabel, example, defaultValue, format, rowGenerator) {
|
|
174
179
|
if (format === 'binary') {
|
|
175
|
-
return (0, _lit.html)`<td style="min-width:100px"> <div class="file-input-container col" style="align-items:flex-end" @click="${e => this.onAddRemoveFileInput(e, keyLabel)}"> <div class="input-set row"> <input @
|
|
180
|
+
return (0, _lit.html)`<td style="min-width:100px"> <div class="file-input-container col" style="align-items:flex-end" @click="${e => this.onAddRemoveFileInput(e, keyLabel)}"> <div class="input-set row"> <input @input="${e => {
|
|
176
181
|
rowGenerator(e);
|
|
182
|
+
this.computeCurlSyntax();
|
|
177
183
|
}}" type="file" part="file-input" class="file-input" data-pname="${keyLabel}" data-ptype="form-input" data-array="false" data-file-array="true"> <button class="file-input-remove-btn"> ✕ </button> </div> <button class="m-btn primary file-input-add-btn" part="btn btn-fill" style="margin:2px 25px 0 0;padding:2px 6px">ADD</button> </div> </td>`;
|
|
178
184
|
}
|
|
179
185
|
|
|
180
186
|
return (0, _lit.html)`<td style="min-width:100px"> <tag-input @change="${e => {
|
|
181
187
|
rowGenerator(e);
|
|
188
|
+
this.computeCurlSyntax();
|
|
182
189
|
}}" style="width:100%" data-ptype="form-input" data-pname="${keyLabel}" data-default="${defaultValue || ''}" data-array="true" placeholder="${(Array.isArray(example) ? example[0] : example) || defaultValue || 'add-multiple ↩'}" .value="${defaultValue || ''}"></tag-input> </td>`;
|
|
183
190
|
}
|
|
184
191
|
|
|
185
192
|
function getPrimitiveFormField(keyLabel, example, defaultValue, format, options, rowGenerator) {
|
|
186
|
-
return (0, _lit.html)`<td style="min-width:100px"> <input placeholder="${example || defaultValue || ''}" @
|
|
193
|
+
return (0, _lit.html)`<td style="min-width:100px"> <input placeholder="${example || defaultValue || ''}" @input="${e => {
|
|
187
194
|
rowGenerator(e);
|
|
195
|
+
this.computeCurlSyntax();
|
|
188
196
|
}}" .value="${options.fillRequestWithDefault && defaultValue || ''}" spellcheck="false" type="${format === 'binary' ? 'file' : format === 'password' ? 'password' : 'text'}" part="textbox textbox-param" style="width:100%" data-ptype="form-input" data-pname="${keyLabel}" data-default="${defaultValue || ''}" data-array="false"> </td>`;
|
|
189
197
|
}
|
|
190
198
|
|
|
@@ -77,12 +77,16 @@ class TagInput extends _lit.LitElement {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
emitChanged() {
|
|
80
|
-
|
|
80
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
81
81
|
detail: {
|
|
82
82
|
value: this.value
|
|
83
83
|
}
|
|
84
|
-
});
|
|
85
|
-
this.dispatchEvent(
|
|
84
|
+
}));
|
|
85
|
+
this.dispatchEvent(new CustomEvent('input', {
|
|
86
|
+
detail: {
|
|
87
|
+
value: this.value
|
|
88
|
+
}
|
|
89
|
+
}));
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
} // Register the element with the browser
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-explorer",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.581",
|
|
4
4
|
"description": "OpenAPI Explorer - API viewer with dynamically generated components, documentation, and interaction console",
|
|
5
5
|
"author": "Rhosys Developers <developers@rhosys.ch>",
|
|
6
6
|
"type": "module",
|