openapi-explorer 2.1.671 → 2.1.675
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 +8 -16
- package/dist/es/components/api-response.js +1 -1
- package/dist/es/components/request-form-table.js +1 -1
- package/dist/es/components/schema-table.js +4 -3
- package/dist/es/components/schema-tree.js +4 -3
- package/dist/es/styles/api-request-styles.js +1 -1
- package/dist/es/templates/components-template.js +2 -2
- package/dist/es/templates/endpoint-template.js +1 -9
- package/dist/es/templates/expanded-endpoint-template.js +1 -10
- package/dist/es/utils/schema-utils.js +4 -4
- package/dist/es/utils/spec-parser.js +17 -15
- package/dist/lib/components/api-request.js +8 -16
- package/dist/lib/components/api-response.js +1 -1
- package/dist/lib/components/request-form-table.js +1 -1
- package/dist/lib/components/schema-table.js +4 -3
- package/dist/lib/components/schema-tree.js +4 -3
- package/dist/lib/styles/api-request-styles.js +1 -1
- package/dist/lib/templates/components-template.js +2 -2
- package/dist/lib/templates/endpoint-template.js +1 -9
- package/dist/lib/templates/expanded-endpoint-template.js +1 -10
- package/dist/lib/utils/schema-utils.js +4 -4
- package/dist/lib/utils/spec-parser.js +17 -15
- package/package.json +1 -1
@@ -3,4 +3,4 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.default = void 0;
|
5
5
|
var _lit = require("lit");
|
6
|
-
var _default = exports.default = (0, _lit.css)`.api-request,.api-request *,.api-request :after,.api-request :before,.api-request:after,.api-request:before{box-sizing:border-box}.api-request.focused-mode,.api-request.read-mode{padding-top:
|
6
|
+
var _default = exports.default = (0, _lit.css)`.api-request,.api-request *,.api-request :after,.api-request :before,.api-request:after,.api-request:before{box-sizing:border-box}.api-request.focused-mode,.api-request.read-mode{padding-top:3rem;margin-top:12px;border-top:1px dashed var(--border-color)}.param-name,.param-type{margin:1px 0;text-align:right;line-height:var(--font-size-small)}.param-name{color:var(--fg);font-family:var(--font-mono)}.param-name.deprecated{text-decoration:line-through}.param-type{color:var(--light-fg);font-family:var(--font-regular)}.api-request .param-constraint{min-width:100px}.api-request .param-constraint:empty{display:none}.api-request .param-description{min-width:100px}.api-request .param-description:empty{display:none}.api-request .param-description p{margin-block:0 0}.api-request .param-description+.param-constraint{margin-block-start:.5em}.api-request .top-gap{margin-top:24px}.api-request .textarea:not(.small){padding:5px;resize:vertical}.api-request .textarea:not(.small){min-height:220px}.api-request .response-message{font-weight:700;text-overflow:ellipsis}.api-request .response-message.error{color:var(--red)}.api-request .response-message.success{color:var(--blue)}.api-request .file-input-container{align-items:flex-end}.api-request .file-input-container .input-set:first-child .file-input-remove-btn{visibility:hidden}.api-request .file-input-remove-btn{font-size:16px;color:var(--red);outline:0;border:none;background:0 0;cursor:pointer}.api-request .v-tab-btn{font-size:var(--smal-font-size);height:24px;border:none;background:0 0;opacity:.3;cursor:pointer;padding:4px 8px}.api-request .v-tab-btn.active{font-weight:700;background:var(--bg);opacity:1}.api-request .border-top{border-top:1px solid var(--border-color)}.api-request .border{border:1px solid var(--border-color);border-radius:var(--border-radius)}.api-request .light-border{border:1px solid var(--light-border-color);border-radius:var(--border-radius)}.api-request .pad-8-16{padding:8px 16px}.api-request .pad-top-8{padding-top:8px}.api-request .mar-top-8{margin-top:8px}@media only screen and (min-width:768px){.api-request .textarea{padding:8px}}`;
|
@@ -53,9 +53,9 @@ function getComponentInfo(componentKeyId) {
|
|
53
53
|
};
|
54
54
|
}
|
55
55
|
function componentsTemplate() {
|
56
|
-
return
|
56
|
+
return this.resolvedSpec.components.map(component => {
|
57
57
|
const componentInfo = getComponentInfo(component.componentKeyId);
|
58
58
|
return (0, _lit.html)` <div id="cmp--${componentInfo.name.toLowerCase()}" class="regular-font section-gap--focused-mode observe-me" style="padding-bottom:0"> <div class="title tag">${componentInfo.name}</div> <div class="regular-font-size"> ${(0, _unsafeHtml.unsafeHTML)(`<div class='m-markdown regular-font'>${(0, _marked.marked)(componentInfo.description ? componentInfo.description : '')}</div>`)} </div> </div> <div class="regular-font section-gap--focused-mode" style="padding-top:0"> ${component.subComponents.filter(c => c.expanded).map(sComponent => componentBodyTemplate.call(this, sComponent))} </div> `;
|
59
|
-
})
|
59
|
+
});
|
60
60
|
}
|
61
61
|
/* eslint-enable indent */
|
@@ -52,21 +52,13 @@ function endpointHeadTemplate(path) {
|
|
52
52
|
}
|
53
53
|
function endpointBodyTemplate(path) {
|
54
54
|
var _path$servers, _path$servers$, _this$selectedServer;
|
55
|
-
const acceptContentTypes = new Set();
|
56
|
-
for (const respStatus in path.responses) {
|
57
|
-
for (const acceptContentType in (_path$responses$respS = path.responses[respStatus]) === null || _path$responses$respS === void 0 ? void 0 : _path$responses$respS.content) {
|
58
|
-
var _path$responses$respS;
|
59
|
-
acceptContentTypes.add(acceptContentType.trim());
|
60
|
-
}
|
61
|
-
}
|
62
|
-
const accept = [...acceptContentTypes].join(', ');
|
63
55
|
// Filter API Keys that are non-empty and are applicable to the the path
|
64
56
|
const nonEmptyApiKeys = this.resolvedSpec.securitySchemes.filter(v => {
|
65
57
|
var _path$security;
|
66
58
|
return v.finalKeyValue && ((_path$security = path.security) === null || _path$security === void 0 ? void 0 : _path$security.some(ps => ps[v.apiKeyId]));
|
67
59
|
}) || [];
|
68
60
|
const codeSampleTabPanel = path.xCodeSamples ? (0, _codeSamplesTemplate.default)(path.xCodeSamples) : '';
|
69
|
-
return (0, _lit.html)` <div class="endpoint-body ${path.method}"> <div class="summary"> ${this.usePathInNavBar ? path.summary ? (0, _lit.html)`<div class="title">${path.summary}<div></div></div>` : path.shortSummary !== path.description ? (0, _lit.html)`<div class="title">${path.shortSummary}</div>` : '' : (0, _lit.html)` <div class="title mono-font regular-font-size" part="section-operation-url" style="display:flex;flex-wrap:wrap;color:var(--fg3)"> ${path.isWebhook ? (0, _lit.html)`<span style="color:var(--primary-color)"> WEBHOOK </span>` : ''} <span part="label-operation-method" class="regular-font upper method-fg bold-text ${path.method}">${path.method} </span> <span style="display:flex;flex-wrap:wrap" part="label-operation-path">${path.path.split('/').filter(t => t.trim()).map(t => (0, _lit.html)`<span>/${t}</span>`)}</span> </div>`} ${path.description ? (0, _lit.html)`<div class="m-markdown"> ${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(path.description))}</div>` : ''} <slot name="${path.elementId}"></slot> <slot name="path-details" data-method="${path.method}" data-path="${path.path}"></slot> ${_securitySchemeTemplate.pathSecurityTemplate.call(this, path.security)} ${codeSampleTabPanel} </div> <div class="req-resp-container"> <div style="display:flex;flex-direction:column" class="request"> <api-request class="request-panel" style="width:100%" method="${path.method}" , path="${path.path}" element-id="${path.elementId}" .parameters="${path.parameters}" .request_body="${path.requestBody}" .api_keys="${nonEmptyApiKeys}" .servers="${path.servers}" server-url="${((_path$servers = path.servers) === null || _path$servers === void 0 ? void 0 : (_path$servers$ = _path$servers[0]) === null || _path$servers$ === void 0 ? void 0 : _path$servers$.url) || ((_this$selectedServer = this.selectedServer) === null || _this$selectedServer === void 0 ? void 0 : _this$selectedServer.computedUrl)}" active-schema-tab="${this.defaultSchemaTab}" fill-defaults="${!this.hideDefaults}" display-nulls="${!!this.includeNulls}" enable-console="${!this.hideExecution}"
|
61
|
+
return (0, _lit.html)` <div class="endpoint-body ${path.method}"> <div class="summary"> ${this.usePathInNavBar ? path.summary ? (0, _lit.html)`<div class="title">${path.summary}<div></div></div>` : path.shortSummary !== path.description ? (0, _lit.html)`<div class="title">${path.shortSummary}</div>` : '' : (0, _lit.html)` <div class="title mono-font regular-font-size" part="section-operation-url" style="display:flex;flex-wrap:wrap;color:var(--fg3)"> ${path.isWebhook ? (0, _lit.html)`<span style="color:var(--primary-color)"> WEBHOOK </span>` : ''} <span part="label-operation-method" class="regular-font upper method-fg bold-text ${path.method}">${path.method} </span> <span style="display:flex;flex-wrap:wrap" part="label-operation-path">${path.path.split('/').filter(t => t.trim()).map(t => (0, _lit.html)`<span>/${t}</span>`)}</span> </div>`} ${path.description ? (0, _lit.html)`<div class="m-markdown"> ${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(path.description))}</div>` : ''} <slot name="${path.elementId}"></slot> <slot name="path-details" data-method="${path.method}" data-path="${path.path}"></slot> ${_securitySchemeTemplate.pathSecurityTemplate.call(this, path.security)} ${codeSampleTabPanel} </div> <div class="req-resp-container"> <div style="display:flex;flex-direction:column" class="request"> <api-request class="request-panel" style="width:100%" method="${path.method}" , path="${path.path}" element-id="${path.elementId}" .parameters="${path.parameters}" .request_body="${path.requestBody}" .api_keys="${nonEmptyApiKeys}" .servers="${path.servers}" server-url="${((_path$servers = path.servers) === null || _path$servers === void 0 ? void 0 : (_path$servers$ = _path$servers[0]) === null || _path$servers$ === void 0 ? void 0 : _path$servers$.url) || ((_this$selectedServer = this.selectedServer) === null || _this$selectedServer === void 0 ? void 0 : _this$selectedServer.computedUrl)}" active-schema-tab="${this.defaultSchemaTab}" fill-defaults="${!this.hideDefaults}" display-nulls="${!!this.includeNulls}" enable-console="${!this.hideExecution}" render-style="${this.renderStyle}" schema-style="${this.displaySchemaAsTable ? 'table' : 'tree'}" schema-expand-level="${this.schemaExpandLevel}" schema-hide-read-only="${this.schemaHideReadOnly}" fetch-credentials="${this.fetchCredentials}" @scrollToSchemaComponentByName="${v => this.scrollToSchemaComponentByName(v)}" exportparts="btn, btn-fill, btn-outline, btn-try, schema-key, schema-type, schema-description, schema-table-header"> </api-request> </div> ${path.callbacks ? _callbackTemplate.default.call(this, path.callbacks) : ''} <api-response class="request response" .responses="${path.responses}" display-nulls="${!!this.includeNulls}" active-schema-tab="${this.defaultSchemaTab}" render-style="${this.renderStyle}" schema-style="${this.displaySchemaAsTable ? 'table' : 'tree'}" schema-expand-level="${this.schemaExpandLevel}" schema-hide-write-only="${this.schemaHideWriteOnly}" selected-status="${Object.keys(path.responses || {})[0] || ''}" @scrollToSchemaComponentByName="${v => this.scrollToSchemaComponentByName(v)}" exportparts="btn--resp, btn-fill--resp, btn-outline--resp, schema-key, schema-type, schema-description, schema-table-header"> </api-response> </div> </div>`;
|
70
62
|
}
|
71
63
|
function endpointTemplate() {
|
72
64
|
return (0, _lit.html)` <div style="display:flex;justify-content:flex-end;padding-right:1rem;font-size:14px;margin-top:16px"> <span @click="${e => expandCollapseAll.call(this, e, true)}" style="color:var(--primary-color);cursor:pointer">Expand</span> | <span @click="${e => expandCollapseAll.call(this, e, false)}" style="color:var(--primary-color);cursor:pointer">Collapse</span> </div> ${(this.resolvedSpec && this.resolvedSpec.tags || []).map(tag => (0, _lit.html)` <div class="regular-font method-section-gap section-tag ${tag.expanded ? 'expanded' : 'collapsed'}"> <div class="section-tag-header" @click="${e => toggleTag.call(this, e, tag.elementId)}"> <div id="${tag.elementId}" class="sub-title tag" style="color:var(--primary-color)">${tag.name}</div> </div> <div class="section-tag-body"> <slot name="${tag.elementId}"></slot> ${tag.description ? (0, _lit.html)` <div class="regular-font regular-font-size m-markdown description" style="padding-bottom:12px"> ${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(tag.description || ''))} </div>` : ''} ${tag.paths.filter(v => (0, _commonUtils.pathIsInSearch)(this.matchPaths, v)).map(path => (0, _lit.html)` <section id="${path.elementId}" class="m-endpoint regular-font ${path.method} ${path.expanded ? 'expanded' : 'collapsed'}"> ${endpointHeadTemplate.call(this, path)} ${path.expanded ? endpointBodyTemplate.call(this, path) : ''} </section>`)} </div> </div> `)}`;
|
@@ -15,19 +15,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
15
15
|
/* eslint-disable indent */
|
16
16
|
function expandedEndpointBodyTemplate(path, tagName = '') {
|
17
17
|
var _path$servers, _path$servers$, _this$selectedServer;
|
18
|
-
const acceptContentTypes = new Set();
|
19
|
-
for (const respStatus in path.responses) {
|
20
|
-
for (const acceptContentType in (_path$responses$respS = path.responses[respStatus]) === null || _path$responses$respS === void 0 ? void 0 : _path$responses$respS.content) {
|
21
|
-
var _path$responses$respS;
|
22
|
-
acceptContentTypes.add(acceptContentType.trim());
|
23
|
-
}
|
24
|
-
}
|
25
|
-
const accept = [...acceptContentTypes].join(', ');
|
26
|
-
|
27
18
|
// Filter API Keys that are non-empty and are applicable to the the path
|
28
19
|
const nonEmptyApiKeys = this.resolvedSpec.securitySchemes.filter(v => v.finalKeyValue && path.security && path.security.some(ps => ps[v.apiKeyId])) || [];
|
29
20
|
const codeSampleTabPanel = path.xCodeSamples ? _codeSamplesTemplate.default.call(this, path.xCodeSamples) : '';
|
30
|
-
return (0, _lit.html)` ${this.renderStyle === 'read' ? (0, _lit.html)`<div class="divider" part="operation-divider"></div>` : ''} <div class="expanded-endpoint-body observe-me ${path.method}" part="section-operation ${path.elementId}" id="${path.elementId}"> ${this.renderStyle === 'focused' && tagName && tagName !== 'General ⦂' ? (0, _lit.html)`<h3 class="upper" style="font-weight:700"> ${tagName} </h3>` : ''} ${path.deprecated ? (0, _lit.html)`<div class="bold-text red-text"> DEPRECATED </div>` : ''} <div style="display:flex;justify-content:space-between"> <div style="flex-grow:1"> <h2>${path.shortSummary || `${path.method.toUpperCase()} ${path.path}`}</h2> <div class='mono-font part="section-operation-url" regular-font-size' style="padding:8px 0;color:var(--fg3)"> ${path.isWebhook ? (0, _lit.html)`<span style="color:var(--primary-color)"> WEBHOOK </span>` : ''} <span part="label-operation-method" class="regular-font upper method-fg bold-text ${path.method}">${path.method}</span> <span part="label-operation-path">${path.path}</span> </div> </div> ${path.externalDocs ? (0, _lit.html)`<div class="m-markdown" style="margin-top:2rem;margin-bottom:.5rem;max-width:300px"> ${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(path.externalDocs.description || ''))} <a href="${path.externalDocs.url}">Navigate to documentation ↗</a> </div>` : ''} </div> <div class="m-markdown" style="margin-right:2rem"> ${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(path.description || ''))}</div> <slot name="${path.elementId}"></slot> <slot name="path-details" data-method="${path.method}" data-path="${path.path}"></slot> ${_securitySchemeTemplate.pathSecurityTemplate.call(this, path.security)} ${codeSampleTabPanel} <div class="expanded-req-resp-container"> <api-request class="request-panel" method="${path.method}" path="${path.path}" element-id="${path.elementId}" .parameters="${path.parameters}" .request_body="${path.requestBody}" .api_keys="${nonEmptyApiKeys}" .servers="${path.servers}" server-url="${((_path$servers = path.servers) === null || _path$servers === void 0 ? void 0 : (_path$servers$ = _path$servers[0]) === null || _path$servers$ === void 0 ? void 0 : _path$servers$.url) || ((_this$selectedServer = this.selectedServer) === null || _this$selectedServer === void 0 ? void 0 : _this$selectedServer.computedUrl)}" fill-defaults="${!this.hideDefaults}" display-nulls="${!!this.includeNulls}" enable-console="${!this.hideExecution}"
|
21
|
+
return (0, _lit.html)` ${this.renderStyle === 'read' ? (0, _lit.html)`<div class="divider" part="operation-divider"></div>` : ''} <div class="expanded-endpoint-body observe-me ${path.method}" part="section-operation ${path.elementId}" id="${path.elementId}"> ${this.renderStyle === 'focused' && tagName && tagName !== 'General ⦂' ? (0, _lit.html)`<h3 class="upper" style="font-weight:700"> ${tagName} </h3>` : ''} ${path.deprecated ? (0, _lit.html)`<div class="bold-text red-text"> DEPRECATED </div>` : ''} <div style="display:flex;justify-content:space-between"> <div style="flex-grow:1"> <h2>${path.shortSummary || `${path.method.toUpperCase()} ${path.path}`}</h2> <div class='mono-font part="section-operation-url" regular-font-size' style="padding:8px 0;color:var(--fg3)"> ${path.isWebhook ? (0, _lit.html)`<span style="color:var(--primary-color)"> WEBHOOK </span>` : ''} <span part="label-operation-method" class="regular-font upper method-fg bold-text ${path.method}">${path.method}</span> <span part="label-operation-path">${path.path}</span> </div> </div> ${path.externalDocs ? (0, _lit.html)`<div class="m-markdown" style="margin-top:2rem;margin-bottom:.5rem;max-width:300px"> ${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(path.externalDocs.description || ''))} <a href="${path.externalDocs.url}">Navigate to documentation ↗</a> </div>` : ''} </div> <div class="m-markdown" style="margin-right:2rem"> ${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(path.description || ''))}</div> <slot name="${path.elementId}"></slot> <slot name="path-details" data-method="${path.method}" data-path="${path.path}"></slot> ${_securitySchemeTemplate.pathSecurityTemplate.call(this, path.security)} ${codeSampleTabPanel} <div class="expanded-req-resp-container"> <api-request class="request-panel" method="${path.method}" path="${path.path}" element-id="${path.elementId}" .parameters="${path.parameters}" .request_body="${path.requestBody}" .api_keys="${nonEmptyApiKeys}" .servers="${path.servers}" server-url="${((_path$servers = path.servers) === null || _path$servers === void 0 ? void 0 : (_path$servers$ = _path$servers[0]) === null || _path$servers$ === void 0 ? void 0 : _path$servers$.url) || ((_this$selectedServer = this.selectedServer) === null || _this$selectedServer === void 0 ? void 0 : _this$selectedServer.computedUrl)}" fill-defaults="${!this.hideDefaults}" display-nulls="${!!this.includeNulls}" enable-console="${!this.hideExecution}" render-style="${this.renderStyle}" schema-style="${this.displaySchemaAsTable ? 'table' : 'tree'}" active-schema-tab="${this.defaultSchemaTab}" schema-expand-level="${this.schemaExpandLevel}" schema-hide-read-only="${this.schemaHideReadOnly}" fetch-credentials="${this.fetchCredentials}" @scrollToSchemaComponentByName="${v => this.scrollToSchemaComponentByName(v)}" exportparts="btn, btn-fill, btn-outline, btn-try, schema-key, schema-type, schema-description, schema-table-header"> </api-request> ${path.callbacks ? _callbackTemplate.default.call(this, path.callbacks) : ''} <api-response class="response-panel" .responses="${path.responses}" display-nulls="${!!this.includeNulls}" render-style="${this.renderStyle}" schema-style="${this.displaySchemaAsTable ? 'table' : 'tree'}" active-schema-tab="${this.defaultSchemaTab}" schema-expand-level="${this.schemaExpandLevel}" schema-hide-write-only="${this.schemaHideWriteOnly}" selected-status="${Object.keys(path.responses || {})[0] || ''}" @scrollToSchemaComponentByName="${v => this.scrollToSchemaComponentByName(v)}" exportparts="btn--resp, btn-fill--resp, btn-outline--resp, schema-key, schema-type, schema-description, schema-table-header"> </api-response> </div> </div>`;
|
31
22
|
}
|
32
23
|
function expandedTagTemplate(tagId, subsectionFullId) {
|
33
24
|
const tag = (this.resolvedSpec.tags || []).find(t => t.elementId === tagId);
|
@@ -21,7 +21,7 @@ function getTypeInfo(parameter, options = {
|
|
21
21
|
includeNulls: false,
|
22
22
|
enableExampleGeneration: false
|
23
23
|
}) {
|
24
|
-
var _schema$items
|
24
|
+
var _schema$items;
|
25
25
|
if (!parameter) {
|
26
26
|
return undefined;
|
27
27
|
}
|
@@ -56,16 +56,16 @@ function getTypeInfo(parameter, options = {
|
|
56
56
|
title: schema.title || '',
|
57
57
|
description: schema.description || '',
|
58
58
|
constraints: [],
|
59
|
-
allowedValues:
|
59
|
+
allowedValues: typeof schema.const !== 'undefined' && [schema.const] || schema.enum || null,
|
60
60
|
arrayType: ''
|
61
61
|
};
|
62
62
|
if (dataType === 'array' && schema.items) {
|
63
|
-
var _ref, _schema$items$default
|
63
|
+
var _ref, _schema$items$default;
|
64
64
|
const arrayItemType = schema.items.type;
|
65
65
|
const arrayItemDefault = (_ref = (_schema$items$default = schema.items.default) !== null && _schema$items$default !== void 0 ? _schema$items$default : schema.default) !== null && _ref !== void 0 ? _ref : '';
|
66
66
|
info.arrayType = `${schema.type} of ${Array.isArray(arrayItemType) ? arrayItemType.join('') : arrayItemType}`;
|
67
67
|
info.default = arrayItemDefault;
|
68
|
-
info.allowedValues =
|
68
|
+
info.allowedValues = typeof schema.const !== 'undefined' && [schema.const] || schema.items.enum || null;
|
69
69
|
}
|
70
70
|
if (schema.uniqueItems) {
|
71
71
|
info.constraints.push('Requires unique items');
|
@@ -168,7 +168,7 @@ function groupByTags(openApiSpec) {
|
|
168
168
|
const commonPathPropServers = pathsAndWebhooks[pathOrHookName].servers || [];
|
169
169
|
const isWebhook = pathsAndWebhooks[pathOrHookName]._type === 'webhook'; // eslint-disable-line no-underscore-dangle
|
170
170
|
supportedMethods.forEach(methodName => {
|
171
|
-
const commonParams = (0, _lodash.default)(pathsAndWebhooks[pathOrHookName].parameters);
|
171
|
+
const commonParams = (0, _lodash.default)(pathsAndWebhooks[pathOrHookName].parameters || []);
|
172
172
|
if (pathsAndWebhooks[pathOrHookName][methodName]) {
|
173
173
|
const pathOrHookObj = openApiSpec.paths[pathOrHookName][methodName];
|
174
174
|
// If path.methods are tagged, else generate it from path
|
@@ -177,6 +177,7 @@ function groupByTags(openApiSpec) {
|
|
177
177
|
pathTags.push('General ⦂');
|
178
178
|
}
|
179
179
|
pathTags.forEach(tag => {
|
180
|
+
var _pathOrHookObj$parame;
|
180
181
|
let tagObj;
|
181
182
|
let specTagsItem;
|
182
183
|
if (openApiSpec.tags) {
|
@@ -201,20 +202,21 @@ function groupByTags(openApiSpec) {
|
|
201
202
|
shortSummary = shortSummary.split(/[.|!|?]\s|[\r?\n]/)[0]; // take the first line (period or carriage return)
|
202
203
|
}
|
203
204
|
// Merge Common Parameters with This methods parameters
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
205
|
+
const finalParameters = ((_pathOrHookObj$parame = pathOrHookObj.parameters) === null || _pathOrHookObj$parame === void 0 ? void 0 : _pathOrHookObj$parame.slice(0)) || [];
|
206
|
+
finalParameters.push(...commonParams.filter(commonParam => !finalParameters.some(param => commonParam.name === param.name && commonParam.in === param.in)));
|
207
|
+
const responseContentTypes = Object.values(pathOrHookObj.responses || {}).map(response => Object.keys(response.content || {})).flat(1);
|
208
|
+
if (!finalParameters.some(p => p.in === 'header' && p.name.match(/^accept$/i)) && responseContentTypes.length > 1) {
|
209
|
+
finalParameters.push({
|
210
|
+
in: 'header',
|
211
|
+
name: 'Accept',
|
212
|
+
description: 'Select the response body Content-Type. By default, the service will return a Content-Type that matches best the requested type.',
|
213
|
+
schema: {
|
214
|
+
type: 'string',
|
215
|
+
enum: responseContentTypes
|
216
|
+
},
|
217
|
+
default: responseContentTypes[0],
|
218
|
+
example: responseContentTypes[0]
|
219
|
+
});
|
218
220
|
}
|
219
221
|
|
220
222
|
// Remove bad callbacks
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "openapi-explorer",
|
3
|
-
"version": "2.1.
|
3
|
+
"version": "2.1.675",
|
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",
|