openapi-explorer 2.2.700 → 2.2.702
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.
@@ -470,6 +470,12 @@ export default class ApiRequest extends LitElement {
|
|
470
470
|
pathParameterMap[el.dataset.pname] = el.value;
|
471
471
|
pathUrl = pathUrl.replace(`{${el.dataset.pname}}`, encodeURIComponent(el.value) || '-');
|
472
472
|
});
|
473
|
+
const missingPathParameterValue = pathParamEls.find(el => !el.value);
|
474
|
+
if (missingPathParameterValue) {
|
475
|
+
const error = Error(`All path parameters are required and a valid value was not found for the parameter: '${missingPathParameterValue.dataset.pname}'.`);
|
476
|
+
error.code = 'MissingPathParameter';
|
477
|
+
throw error;
|
478
|
+
}
|
473
479
|
|
474
480
|
// Handle relative serverUrls
|
475
481
|
if (!pathUrl.startsWith('http')) {
|
@@ -688,15 +694,19 @@ export default class ApiRequest extends LitElement {
|
|
688
694
|
};
|
689
695
|
}
|
690
696
|
computeCurlSyntax(headerOverride) {
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
697
|
+
try {
|
698
|
+
const {
|
699
|
+
fetchOptions,
|
700
|
+
fetchUrl,
|
701
|
+
curlParts
|
702
|
+
} = this.recomputeFetchOptions();
|
703
|
+
const curl = `curl -X ${this.method.toUpperCase()} "${fetchUrl.toString()}"`;
|
704
|
+
const headers = headerOverride !== null && headerOverride !== void 0 ? headerOverride : fetchOptions.headers;
|
705
|
+
const curlHeaders = [...headers.entries()].reduce((acc, [key, value]) => `${acc} \\\n -H "${key}: ${value}"`, '');
|
706
|
+
this.curlSyntax = `${curl}${curlHeaders}${curlParts.data}${curlParts.form}`;
|
707
|
+
} catch (error) {
|
708
|
+
/* There was an explicit issue and likely it was because the fetch options threw. */
|
709
|
+
}
|
700
710
|
// We don't need to request and update because we are watch the curlSyntax property in this lit element
|
701
711
|
// this.requestUpdate();
|
702
712
|
}
|
@@ -704,12 +714,26 @@ export default class ApiRequest extends LitElement {
|
|
704
714
|
// onExecuteButtonClicked
|
705
715
|
async onTryClick() {
|
706
716
|
const tryBtnEl = this.querySelectorAll('.btn-execute')[0];
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
717
|
+
let fetchOptions;
|
718
|
+
let fetchUrl;
|
719
|
+
let path;
|
720
|
+
let query;
|
721
|
+
try {
|
722
|
+
({
|
723
|
+
fetchOptions,
|
724
|
+
fetchUrl,
|
725
|
+
path,
|
726
|
+
query
|
727
|
+
} = this.recomputeFetchOptions());
|
728
|
+
} catch (error) {
|
729
|
+
this.responseMessage = error.message;
|
730
|
+
this.responseStatus = 'error';
|
731
|
+
this.responseUrl = '';
|
732
|
+
this.responseHeaders = '';
|
733
|
+
this.responseText = error.message;
|
734
|
+
this.activeResponseTab = 'response';
|
735
|
+
return;
|
736
|
+
}
|
713
737
|
this.responseIsBlob = false;
|
714
738
|
this.respContentDisposition = '';
|
715
739
|
if (this.responseBlobUrl) {
|
@@ -163,7 +163,7 @@ export default class SchemaTable extends LitElement {
|
|
163
163
|
});
|
164
164
|
}
|
165
165
|
const displayLine = [title && `**${title}${description ? ':' : ''}**`, description].filter(v => v).join(' ');
|
166
|
-
const outerResult = html` ${newSchemaLevel >= 0 && key ? html` <div class="tr ${newSchemaLevel <= this.schemaExpandLevel ? '' : 'collapsed'} ${data['::type']}" data-obj="${keyLabel}"> <div class="td no-select key ${data['::deprecated'] ? 'deprecated' : ''}" part="schema-key" style="padding-left:${leftPadding}px;cursor:pointer" @click="${e => this.toggleObjectExpand(e, keyLabel)}"> <div style="display:flex;align-items:center"> ${keyLabel || keyDescr ? html`<div class="obj-toggle" data-obj="${keyLabel}">▾</div>` : ''} ${data['::type'] === 'xxx-of-option' || key.startsWith('::OPTION') ? html`<span class="xxx-of-key" style="margin-left:-6px">${keyLabel}</span><span class="${isOneOfLabel ? 'xxx-of-key' : 'xxx-of-descr'}">${keyDescr}</span>` : keyLabel.endsWith('*') ? html`<span class="key-label requiredStar" style="display:inline-block;margin-left:-6px" title="Required"> ${keyLabel.substring(0, keyLabel.length - 1)}</span>` : html`<span class="key-label" style="display:inline-block;margin-left:-6px">${keyLabel === '::props' ? '' : keyLabel}</span>`} </div> </div> <div class="td key-type" part="schema-type"> ${displaySchemaLink ? html`<div class="schema-link" style="overflow:hidden;text-overflow:ellipsis" @click="${() => this.scrollToSchemaComponentByName(displaySchemaLink)}"> ${dataType === 'array' ? '[' : ''}<span style="color:var(--
|
166
|
+
const outerResult = html` ${newSchemaLevel >= 0 && key ? html` <div class="tr ${newSchemaLevel <= this.schemaExpandLevel ? '' : 'collapsed'} ${data['::type']}" data-obj="${keyLabel}"> <div class="td no-select key ${data['::deprecated'] ? 'deprecated' : ''}" part="schema-key" style="padding-left:${leftPadding}px;cursor:pointer" @click="${e => this.toggleObjectExpand(e, keyLabel)}"> <div style="display:flex;align-items:center"> ${keyLabel || keyDescr ? html`<div class="obj-toggle" data-obj="${keyLabel}">▾</div>` : ''} ${data['::type'] === 'xxx-of-option' || key.startsWith('::OPTION') ? html`<span class="xxx-of-key" style="margin-left:-6px">${keyLabel}</span><span class="${isOneOfLabel ? 'xxx-of-key' : 'xxx-of-descr'}">${keyDescr}</span>` : keyLabel.endsWith('*') ? html`<span class="key-label requiredStar" style="display:inline-block;margin-left:-6px" title="Required"> ${keyLabel.substring(0, keyLabel.length - 1)}</span>` : html`<span class="key-label" style="display:inline-block;margin-left:-6px">${keyLabel === '::props' ? '' : keyLabel}</span>`} </div> </div> <div class="td key-type" part="schema-type"> ${displaySchemaLink ? html`<div class="schema-link" style="overflow:hidden;text-overflow:ellipsis" @click="${() => this.scrollToSchemaComponentByName(displaySchemaLink)}"> ${dataType === 'array' ? '[' : ''}<span style="color:var(--secondary-color)">${detailObjType}</span>${dataType === 'array' ? ']' : ''} </div>` : html`<div>${(data['::type'] || '').includes('xxx-of') ? '' : `${dataType === 'array' ? '[' : ''}${detailObjType}${dataType === 'array' ? ']' : ''}`}</div>`} <div class="attributes" title="${flags['🆁'] && 'Read only attribute' || flags['🆆'] && 'Write only attribute' || ''}">${flags['🆁'] || flags['🆆'] || ''}</div> </div> <div class="td key-descr" part="schema-description"> <span class="m-markdown-small">${unsafeHTML(marked(displayLine))}</span> ${(_data$Metadata = data['::metadata']) !== null && _data$Metadata !== void 0 && (_data$Metadata$constr = _data$Metadata.constraints) !== null && _data$Metadata$constr !== void 0 && _data$Metadata$constr.length ? html`<div style="display:inline-block;line-break:anywhere;margin-right:8px"><span class="bold-text">Constraints: </span>${data['::metadata'].constraints.join(', ')}</div><br>` : ''} </div> </div>` : html` ${data['::type'] === 'array' && dataType === 'array' ? html`<div class="tr"> <div class="td"> ${dataType} </div> </div>` : ''} `} <div class="object-body"> ${recursiveResult} <div> </div></div>`;
|
167
167
|
return {
|
168
168
|
result: outerResult,
|
169
169
|
keyLabelMaxCharacterLength: Math.max(innerMaxIndentationLevel, (keyLabel || keyDescr).length),
|
@@ -475,6 +475,12 @@ class ApiRequest extends _lit.LitElement {
|
|
475
475
|
pathParameterMap[el.dataset.pname] = el.value;
|
476
476
|
pathUrl = pathUrl.replace(`{${el.dataset.pname}}`, encodeURIComponent(el.value) || '-');
|
477
477
|
});
|
478
|
+
const missingPathParameterValue = pathParamEls.find(el => !el.value);
|
479
|
+
if (missingPathParameterValue) {
|
480
|
+
const error = Error(`All path parameters are required and a valid value was not found for the parameter: '${missingPathParameterValue.dataset.pname}'.`);
|
481
|
+
error.code = 'MissingPathParameter';
|
482
|
+
throw error;
|
483
|
+
}
|
478
484
|
|
479
485
|
// Handle relative serverUrls
|
480
486
|
if (!pathUrl.startsWith('http')) {
|
@@ -693,15 +699,19 @@ class ApiRequest extends _lit.LitElement {
|
|
693
699
|
};
|
694
700
|
}
|
695
701
|
computeCurlSyntax(headerOverride) {
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
702
|
+
try {
|
703
|
+
const {
|
704
|
+
fetchOptions,
|
705
|
+
fetchUrl,
|
706
|
+
curlParts
|
707
|
+
} = this.recomputeFetchOptions();
|
708
|
+
const curl = `curl -X ${this.method.toUpperCase()} "${fetchUrl.toString()}"`;
|
709
|
+
const headers = headerOverride !== null && headerOverride !== void 0 ? headerOverride : fetchOptions.headers;
|
710
|
+
const curlHeaders = [...headers.entries()].reduce((acc, [key, value]) => `${acc} \\\n -H "${key}: ${value}"`, '');
|
711
|
+
this.curlSyntax = `${curl}${curlHeaders}${curlParts.data}${curlParts.form}`;
|
712
|
+
} catch (error) {
|
713
|
+
/* There was an explicit issue and likely it was because the fetch options threw. */
|
714
|
+
}
|
705
715
|
// We don't need to request and update because we are watch the curlSyntax property in this lit element
|
706
716
|
// this.requestUpdate();
|
707
717
|
}
|
@@ -709,12 +719,26 @@ class ApiRequest extends _lit.LitElement {
|
|
709
719
|
// onExecuteButtonClicked
|
710
720
|
async onTryClick() {
|
711
721
|
const tryBtnEl = this.querySelectorAll('.btn-execute')[0];
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
722
|
+
let fetchOptions;
|
723
|
+
let fetchUrl;
|
724
|
+
let path;
|
725
|
+
let query;
|
726
|
+
try {
|
727
|
+
({
|
728
|
+
fetchOptions,
|
729
|
+
fetchUrl,
|
730
|
+
path,
|
731
|
+
query
|
732
|
+
} = this.recomputeFetchOptions());
|
733
|
+
} catch (error) {
|
734
|
+
this.responseMessage = error.message;
|
735
|
+
this.responseStatus = 'error';
|
736
|
+
this.responseUrl = '';
|
737
|
+
this.responseHeaders = '';
|
738
|
+
this.responseText = error.message;
|
739
|
+
this.activeResponseTab = 'response';
|
740
|
+
return;
|
741
|
+
}
|
718
742
|
this.responseIsBlob = false;
|
719
743
|
this.respContentDisposition = '';
|
720
744
|
if (this.responseBlobUrl) {
|
@@ -168,7 +168,7 @@ class SchemaTable extends _lit.LitElement {
|
|
168
168
|
});
|
169
169
|
}
|
170
170
|
const displayLine = [title && `**${title}${description ? ':' : ''}**`, description].filter(v => v).join(' ');
|
171
|
-
const outerResult = (0, _lit.html)` ${newSchemaLevel >= 0 && key ? (0, _lit.html)` <div class="tr ${newSchemaLevel <= this.schemaExpandLevel ? '' : 'collapsed'} ${data['::type']}" data-obj="${keyLabel}"> <div class="td no-select key ${data['::deprecated'] ? 'deprecated' : ''}" part="schema-key" style="padding-left:${leftPadding}px;cursor:pointer" @click="${e => this.toggleObjectExpand(e, keyLabel)}"> <div style="display:flex;align-items:center"> ${keyLabel || keyDescr ? (0, _lit.html)`<div class="obj-toggle" data-obj="${keyLabel}">▾</div>` : ''} ${data['::type'] === 'xxx-of-option' || key.startsWith('::OPTION') ? (0, _lit.html)`<span class="xxx-of-key" style="margin-left:-6px">${keyLabel}</span><span class="${isOneOfLabel ? 'xxx-of-key' : 'xxx-of-descr'}">${keyDescr}</span>` : keyLabel.endsWith('*') ? (0, _lit.html)`<span class="key-label requiredStar" style="display:inline-block;margin-left:-6px" title="Required"> ${keyLabel.substring(0, keyLabel.length - 1)}</span>` : (0, _lit.html)`<span class="key-label" style="display:inline-block;margin-left:-6px">${keyLabel === '::props' ? '' : keyLabel}</span>`} </div> </div> <div class="td key-type" part="schema-type"> ${displaySchemaLink ? (0, _lit.html)`<div class="schema-link" style="overflow:hidden;text-overflow:ellipsis" @click="${() => this.scrollToSchemaComponentByName(displaySchemaLink)}"> ${dataType === 'array' ? '[' : ''}<span style="color:var(--
|
171
|
+
const outerResult = (0, _lit.html)` ${newSchemaLevel >= 0 && key ? (0, _lit.html)` <div class="tr ${newSchemaLevel <= this.schemaExpandLevel ? '' : 'collapsed'} ${data['::type']}" data-obj="${keyLabel}"> <div class="td no-select key ${data['::deprecated'] ? 'deprecated' : ''}" part="schema-key" style="padding-left:${leftPadding}px;cursor:pointer" @click="${e => this.toggleObjectExpand(e, keyLabel)}"> <div style="display:flex;align-items:center"> ${keyLabel || keyDescr ? (0, _lit.html)`<div class="obj-toggle" data-obj="${keyLabel}">▾</div>` : ''} ${data['::type'] === 'xxx-of-option' || key.startsWith('::OPTION') ? (0, _lit.html)`<span class="xxx-of-key" style="margin-left:-6px">${keyLabel}</span><span class="${isOneOfLabel ? 'xxx-of-key' : 'xxx-of-descr'}">${keyDescr}</span>` : keyLabel.endsWith('*') ? (0, _lit.html)`<span class="key-label requiredStar" style="display:inline-block;margin-left:-6px" title="Required"> ${keyLabel.substring(0, keyLabel.length - 1)}</span>` : (0, _lit.html)`<span class="key-label" style="display:inline-block;margin-left:-6px">${keyLabel === '::props' ? '' : keyLabel}</span>`} </div> </div> <div class="td key-type" part="schema-type"> ${displaySchemaLink ? (0, _lit.html)`<div class="schema-link" style="overflow:hidden;text-overflow:ellipsis" @click="${() => this.scrollToSchemaComponentByName(displaySchemaLink)}"> ${dataType === 'array' ? '[' : ''}<span style="color:var(--secondary-color)">${detailObjType}</span>${dataType === 'array' ? ']' : ''} </div>` : (0, _lit.html)`<div>${(data['::type'] || '').includes('xxx-of') ? '' : `${dataType === 'array' ? '[' : ''}${detailObjType}${dataType === 'array' ? ']' : ''}`}</div>`} <div class="attributes" title="${flags['🆁'] && 'Read only attribute' || flags['🆆'] && 'Write only attribute' || ''}">${flags['🆁'] || flags['🆆'] || ''}</div> </div> <div class="td key-descr" part="schema-description"> <span class="m-markdown-small">${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(displayLine))}</span> ${(_data$Metadata = data['::metadata']) !== null && _data$Metadata !== void 0 && (_data$Metadata$constr = _data$Metadata.constraints) !== null && _data$Metadata$constr !== void 0 && _data$Metadata$constr.length ? (0, _lit.html)`<div style="display:inline-block;line-break:anywhere;margin-right:8px"><span class="bold-text">Constraints: </span>${data['::metadata'].constraints.join(', ')}</div><br>` : ''} </div> </div>` : (0, _lit.html)` ${data['::type'] === 'array' && dataType === 'array' ? (0, _lit.html)`<div class="tr"> <div class="td"> ${dataType} </div> </div>` : ''} `} <div class="object-body"> ${recursiveResult} <div> </div></div>`;
|
172
172
|
return {
|
173
173
|
result: outerResult,
|
174
174
|
keyLabelMaxCharacterLength: Math.max(innerMaxIndentationLevel, (keyLabel || keyDescr).length),
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "openapi-explorer",
|
3
|
-
"version": "2.2.
|
3
|
+
"version": "2.2.702",
|
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",
|