openapi-explorer 2.3.779 → 2.4.783
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/README.md +1 -1
- package/dist/browser/openapi-explorer.min.js +2 -2
- package/dist/es/styles/font-styles.js +1 -1
- package/dist/es/templates/expanded-endpoint-template.js +4 -2
- package/dist/es/utils/spec-parser.js +13 -2
- package/dist/lib/components/api-request.js +1 -1
- package/dist/lib/components/api-response.js +1 -1
- package/dist/lib/components/json-tree.js +1 -1
- package/dist/lib/components/schema-table.js +1 -1
- package/dist/lib/components/schema-tree.js +1 -1
- package/dist/lib/components/syntax-highlighter.js +1 -1
- package/dist/lib/languages/index.js +1 -1
- package/dist/lib/openapi-explorer.js +1 -1
- package/dist/lib/styles/font-styles.js +1 -1
- package/dist/lib/templates/endpoint-template.js +1 -1
- package/dist/lib/templates/expanded-endpoint-template.js +5 -3
- package/dist/lib/templates/focused-endpoint-template.js +1 -1
- package/dist/lib/templates/mainBodyTemplate.js +1 -1
- package/dist/lib/templates/security-scheme-template.js +1 -1
- package/dist/lib/utils/schema-utils.js +1 -1
- package/dist/lib/utils/spec-parser.js +14 -3
- package/dist/lib/utils/theme.js +1 -1
- package/package.json +6 -6
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export default css`.hover-bg:hover{background:var(--bg3)}::selection{background:var(--selection-bg);color:var(--selection-fg)}.regular-font{font-family:var(--font-regular)}.mono-font{font-family:var(--font-mono)}.title{font-size:calc(var(--font-size-small) + 1rem);font-weight:400}.sub-title{font-size:20px}.req-res-title{font-family:var(--font-regular);font-size:calc(var(--font-size-small) + 4px);font-weight:700}.tiny-title{font-size:calc(var(--font-size-small) + 1px);font-weight:700}.regular-font-size{font-size:var(--font-size-regular)}.small-font-size{font-size:var(--font-size-small)}.upper{text-transform:uppercase}.primary-text{color:var(--primary-color)}.bold-text{font-weight:700}.gray-text{color:var(--light-fg)}.red-text{color:var(--red)}.blue-text{color:var(--blue)}.multiline{overflow:scroll;max-height:var(--resp-area-height,300px);color:var(--fg3)}.method-fg.put{color:var(--orange)}.method-fg.post{color:var(--green)}.method-fg.get,.method-fg.head{color:var(--blue)}.method-fg.delete{color:var(--red)}.method-fg.query{color:var(--purple)}.method-fg.trace{color:var(--purple)}.method-fg.options{color:var(--gray)}.method-fg.patch{color:var(--yellow)}h1{font-family:var(--font-regular);font-size:28px;padding-top:10px;letter-spacing:normal;font-weight:400}h2{font-family:var(--font-regular);font-size:24px;padding-top:10px;letter-spacing:normal;font-weight:400}h3{font-family:var(--font-regular);font-size:18px;padding-top:10px;letter-spacing:normal;font-weight:400}h4{font-family:var(--font-regular);font-size:16px;padding-top:10px;letter-spacing:normal;font-weight:400}h5{font-family:var(--font-regular);font-size:14px;padding-top:10px;letter-spacing:normal;font-weight:400}h6{font-family:var(--font-regular);font-size:14px;padding-top:10px;letter-spacing:normal;font-weight:400}h1,h2,h3,h4,h5{margin-block-end:.2em;margin-block-start:.5em}h3{margin-top:0}p{margin-block-start:.5em}a{color:var(--blue);cursor:pointer}a.inactive-link{color:var(--fg);text-decoration:none;cursor:text}code,pre,syntax-highlighter{margin:0;font-family:var(--font-mono);font-size:var(--font-size-mono)}.m-markdown syntax-highlighter{display:block}.m-markdown,.m-markdown-small{display:block}.m-markdown a,.m-markdown li,.m-markdown p,.m-markdown span{font-size:var(--font-size-regular);line-height:calc(var(--font-size-regular) + 6px)}.m-markdown-small a,.m-markdown-small li,.m-markdown-small p,.m-markdown-small span{font-size:var(--font-size-small);line-height:calc(var(--font-size-small) + 6px)}.m-markdown p:not(:first-child){margin-block-start:12px}.m-markdown-small p:not(:first-child){margin-block-start:12px}.m-markdown :first-child,.m-markdown-small :first-child{margin-block-start:0}.m-markdown p,.m-markdown-small p{margin-block-end:0;overflow-wrap:anywhere}.toolbar .m-markdown p,.toolbar .m-markdown-small p{margin-block-start:0}.m-markdown code span{font-size:var(--font-size-mono)}.m-markdown code,.m-markdown syntax-highlighter,.m-markdown-small code{padding:1px 6px;border-radius:2px;color:var(--inline-code-fg);background-color:var(--bg3);font-size:calc(var(--font-size-mono));line-height:1.2}.m-markdown-small code,.m-markdown-small syntax-highlighter{font-size:var(--font-size-mono)}.m-markdown pre,.m-markdown syntax-highlighter,.m-markdown-small pre{white-space:pre-wrap;overflow-x:auto;line-height:normal;border-radius:2px;border:1px solid var(--code-border-color)}.m-markdown pre,.m-markdown syntax-highlighter{padding:8px;background-color:var(--bg2);color:var(--code-fg)}.m-markdown-small pre,.m-markdown-small syntax-highlighter{margin-top:4px;padding:2px 4px;background-color:var(--bg3);color:var(--fg2)}.m-markdown pre code,.m-markdown-small pre code{border:none;padding:0}.m-markdown pre code{color:var(--code-fg);background-color:var(--bg2);background-color:transparent}.m-markdown-small pre code,.m-markdown-small syntax-highlighter{color:var(--fg2);background-color:var(--bg3)}.m-markdown ol,.m-markdown ul{padding-inline-start:30px}.m-markdown-small ol,.m-markdown-small ul{padding-inline-start:20px}.m-markdown a,.m-markdown-small a{color:var(--blue)}.m-markdown img,.m-markdown-small img{max-width:100%}.m-markdown table,.m-markdown-small table{border-spacing:0;margin:10px 0;border-collapse:separate;border:1px solid var(--border-color);border-radius:var(--border-radius);font-size:calc(var(--font-size-small) + 1px);line-height:calc(var(--font-size-small) + 4px);max-width:100%}.m-markdown-small table{font-size:var(--font-size-small);line-height:calc(var(--font-size-small) + 2px);margin:8px 0}.m-markdown td,.m-markdown th,.m-markdown-small td,.m-markdown-small th{vertical-align:top;border-top:1px solid var(--border-color);line-height:calc(var(--font-size-small) + 4px)}.m-markdown tr:first-child th,.m-markdown-small tr:first-child th{border-top:0 none}.m-markdown td,.m-markdown th{padding:10px 12px}.m-markdown-small td,.m-markdown-small th{padding:8px 8px}.m-markdown th,.m-markdown-small th{font-weight:600;background-color:var(--bg2);vertical-align:middle}.m-markdown-small table code{font-size:calc(var(--font-size-mono) - 1px)}.m-markdown table code{font-size:var(--font-size-mono)}.m-markdown blockquote,.m-markdown-small blockquote{margin-inline-start:0;margin-inline-end:0;border-left:3px solid var(--border-color);padding:6px 0 6px 6px}`;
|
|
2
|
+
export default css`.hover-bg:hover{background:var(--bg3)}::selection{background:var(--selection-bg);color:var(--selection-fg)}.regular-font{font-family:var(--font-regular)}.mono-font{font-family:var(--font-mono)}.title{font-size:calc(var(--font-size-small) + 1rem);font-weight:400}.sub-title{font-size:20px}.req-res-title{font-family:var(--font-regular);font-size:calc(var(--font-size-small) + 4px);font-weight:700}.tiny-title{font-size:calc(var(--font-size-small) + 1px);font-weight:700}.regular-font-size{font-size:var(--font-size-regular)}.small-font-size{font-size:var(--font-size-small)}.upper{text-transform:uppercase}.primary-text{color:var(--primary-color)}.bold-text{font-weight:700}.gray-text{color:var(--light-fg)}.red-text{color:var(--red)}.blue-text{color:var(--blue)}.multiline{overflow:scroll;max-height:var(--resp-area-height,300px);color:var(--fg3)}.method-fg.put{color:var(--orange)}.method-fg.post{color:var(--green)}.method-fg.get,.method-fg.head{color:var(--blue)}.method-fg.delete{color:var(--red)}.method-fg.query{color:var(--purple)}.method-fg.trace{color:var(--purple)}.method-fg.options{color:var(--gray)}.method-fg.patch{color:var(--yellow)}h1{font-family:var(--font-regular);font-size:28px;padding-top:10px;letter-spacing:normal;font-weight:400}h2{font-family:var(--font-regular);font-size:24px;padding-top:10px;letter-spacing:normal;font-weight:400}h3{font-family:var(--font-regular);font-size:18px;padding-top:10px;letter-spacing:normal;font-weight:400}h4{font-family:var(--font-regular);font-size:16px;padding-top:10px;letter-spacing:normal;font-weight:400}h5{font-family:var(--font-regular);font-size:14px;padding-top:10px;letter-spacing:normal;font-weight:400}h6{font-family:var(--font-regular);font-size:14px;padding-top:10px;letter-spacing:normal;font-weight:400}h1,h2,h3,h4,h5{margin-block-end:.2em;margin-block-start:.5em;padding-top:0}h3{margin-top:0}p{margin-block-start:.5em}a{color:var(--blue);cursor:pointer}a.inactive-link{color:var(--fg);text-decoration:none;cursor:text}code,pre,syntax-highlighter{margin:0;font-family:var(--font-mono);font-size:var(--font-size-mono)}.m-markdown syntax-highlighter{display:block}.m-markdown,.m-markdown-small{display:block}.m-markdown a,.m-markdown li,.m-markdown p,.m-markdown span{font-size:var(--font-size-regular);line-height:calc(var(--font-size-regular) + 6px)}.m-markdown-small a,.m-markdown-small li,.m-markdown-small p,.m-markdown-small span{font-size:var(--font-size-small);line-height:calc(var(--font-size-small) + 6px)}.m-markdown p:not(:first-child){margin-block-start:12px}.m-markdown-small p:not(:first-child){margin-block-start:12px}.m-markdown :first-child,.m-markdown-small :first-child{margin-block-start:0}.m-markdown p,.m-markdown-small p{margin-block-end:0;overflow-wrap:anywhere}.toolbar .m-markdown p,.toolbar .m-markdown-small p{margin-block-start:0}.m-markdown code span{font-size:var(--font-size-mono)}.m-markdown code,.m-markdown syntax-highlighter,.m-markdown-small code{padding:1px 6px;border-radius:2px;color:var(--inline-code-fg);background-color:var(--bg3);font-size:calc(var(--font-size-mono));line-height:1.2}.m-markdown-small code,.m-markdown-small syntax-highlighter{font-size:var(--font-size-mono)}.m-markdown pre,.m-markdown syntax-highlighter,.m-markdown-small pre{white-space:pre-wrap;overflow-x:auto;line-height:normal;border-radius:2px;border:1px solid var(--code-border-color)}.m-markdown pre,.m-markdown syntax-highlighter{padding:8px;background-color:var(--bg2);color:var(--code-fg)}.m-markdown-small pre,.m-markdown-small syntax-highlighter{margin-top:4px;padding:2px 4px;background-color:var(--bg3);color:var(--fg2)}.m-markdown pre code,.m-markdown-small pre code{border:none;padding:0}.m-markdown pre code{color:var(--code-fg);background-color:var(--bg2);background-color:transparent}.m-markdown-small pre code,.m-markdown-small syntax-highlighter{color:var(--fg2);background-color:var(--bg3)}.m-markdown ol,.m-markdown ul{padding-inline-start:30px}.m-markdown-small ol,.m-markdown-small ul{padding-inline-start:20px}.m-markdown a,.m-markdown-small a{color:var(--blue)}.m-markdown img,.m-markdown-small img{max-width:100%}.m-markdown table,.m-markdown-small table{border-spacing:0;margin:10px 0;border-collapse:separate;border:1px solid var(--border-color);border-radius:var(--border-radius);font-size:calc(var(--font-size-small) + 1px);line-height:calc(var(--font-size-small) + 4px);max-width:100%}.m-markdown-small table{font-size:var(--font-size-small);line-height:calc(var(--font-size-small) + 2px);margin:8px 0}.m-markdown td,.m-markdown th,.m-markdown-small td,.m-markdown-small th{vertical-align:top;border-top:1px solid var(--border-color);line-height:calc(var(--font-size-small) + 4px)}.m-markdown tr:first-child th,.m-markdown-small tr:first-child th{border-top:0 none}.m-markdown td,.m-markdown th{padding:10px 12px}.m-markdown-small td,.m-markdown-small th{padding:8px 8px}.m-markdown th,.m-markdown-small th{font-weight:600;background-color:var(--bg2);vertical-align:middle}.m-markdown-small table code{font-size:calc(var(--font-size-mono) - 1px)}.m-markdown table code{font-size:var(--font-size-mono)}.m-markdown blockquote,.m-markdown-small blockquote{margin-inline-start:0;margin-inline-end:0;border-left:3px solid var(--border-color);padding:6px 0 6px 6px}`;
|
|
@@ -14,12 +14,14 @@ export function expandedEndpointBodyTemplate(path, tag) {
|
|
|
14
14
|
// Filter API Keys that are non-empty and are applicable to the the path
|
|
15
15
|
const nonEmptyApiKeys = this.resolvedSpec.securitySchemes.filter(v => v.finalKeyValue && path.security && path.security.some(ps => ps[v.apiKeyId])) || [];
|
|
16
16
|
const codeSampleTabPanel = path.xCodeSamples ? codeSamplesTemplate.call(this, path.xCodeSamples) : '';
|
|
17
|
-
|
|
17
|
+
const tagSummary = tag !== null && tag !== void 0 && tag.summary ? html`<small style="font-weight:400">- ${tag === null || tag === void 0 ? void 0 : tag.summary}</small>` : '';
|
|
18
|
+
return html` ${this.renderStyle === 'read' ? 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' && tag && tag.name !== 'General ⦂' ? html`<h1 style="display:inline;align-self:center" class="title tag-link" role="heading" aria-level="1" data-content-id="${tag.elementId}" @click="${e => this.scrollToEventTarget(e, false)}"> ${tag === null || tag === void 0 ? void 0 : tag.name} ${tagSummary}</h1>` : ''} <slot name="${tag.elementId}"></slot> <div style="display:flex;justify-content:space-between"> <div style="flex-grow:1"> <h2 style="display:flex;align-items:center"> <div>${path.shortSummary || `${path.method.toUpperCase()} ${path.path}`}</div> <div>${path.deprecated ? html`<div> -<span class="bold-text red-text" style="font-size:var(--font-size-regular)"> ${getI18nText('operations.deprecated')}</span></div>` : ''}</div> </h2> <div class='mono-font part="section-operation-url" regular-font-size' style="padding:8px 0;color:var(--fg3)"> ${path.isWebhook ? html`<span style="color:var(--primary-color)">${getI18nText('operations.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 ? html`<div class="m-markdown" style="margin-top:2rem;margin-bottom:.5rem;max-width:300px"> ${unsafeHTML(toMarkdown(path.externalDocs.description || ''))} <a href="${getSanitizedUrl(path.externalDocs.url)}">Navigate to documentation ↗</a> </div>` : ''} </div> <div class="m-markdown" style="margin-right:2rem"> ${unsafeHTML(toMarkdown(path.description || ''))}</div> <slot name="${path.elementId}"></slot> <slot name="path-details" data-method="${path.method}" data-path="${path.path}"></slot> ${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.displaySchemaAsTree ? 'tree' : 'table'}" 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.call(this, path.callbacks) : ''} <api-response class="response-panel" .responses="${path.responses}" display-nulls="${!!this.includeNulls}" render-style="${this.renderStyle}" schema-style="${this.displaySchemaAsTree ? 'tree' : 'table'}" 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>`;
|
|
18
19
|
}
|
|
19
20
|
export function expandedTagTemplate(tagId, subsectionFullId) {
|
|
20
21
|
const tag = (this.resolvedSpec.tags || []).find(t => t.elementId === tagId);
|
|
21
22
|
const subsectionId = subsectionFullId.replace(`${tagId}--`, '');
|
|
22
|
-
|
|
23
|
+
const tagSummary = tag.summary ? html`<h2 style="font-weight:400">${tag.summary}</h2>` : '';
|
|
24
|
+
return html` <section id="${tag.elementId}" part="section-tag" class="regular-font section-gap--read-mode observe-me" style=""> <h1 class="title tag" part="label-tag-title" role="heading" aria-level="1">${tag.name}</h1> ${tagSummary} <slot name="${tag.elementId}--subsection--${subsectionId}"> <div class="regular-font-size"> ${unsafeHTML(`
|
|
23
25
|
<div class="m-markdown regular-font">
|
|
24
26
|
${toMarkdown(tag.description || '')}
|
|
25
27
|
</div>`)} </div> </slot> <slot name="${tag.elementId}--body"></slot> <br> <strong>Operations</strong> <div class="nav-bar-paths-under-tag" style="max-width:300px"> ${tag.paths.map(p => html` <div class="nav-bar-path ${this.usePathInNavBar ? 'small-font' : ''}" role="link" tabindex="0" data-content-id="${p.elementId}" id="link-${p.elementId}" @click="${e => {
|
|
@@ -3,6 +3,7 @@ import OpenApiResolver from 'openapi-resolver/dist/openapi-resolver.browser.js';
|
|
|
3
3
|
import { marked } from 'marked';
|
|
4
4
|
import { invalidCharsRegEx } from './common-utils.js';
|
|
5
5
|
import cloneDeep from 'lodash.clonedeep';
|
|
6
|
+
import toposort from 'toposort';
|
|
6
7
|
export default async function ProcessSpec(specUrlOrObject, serverUrl = '') {
|
|
7
8
|
var _jsonParsedSpec$info, _jsonParsedSpec$compo;
|
|
8
9
|
const inputSpecIsAUrl = typeof specUrlOrObject === 'string' && specUrlOrObject.match(/^http/) || typeof specUrlOrObject === 'object' && typeof specUrlOrObject.href === 'string';
|
|
@@ -154,17 +155,27 @@ function getComponents(openApiSpec) {
|
|
|
154
155
|
}
|
|
155
156
|
function groupByTags(openApiSpec) {
|
|
156
157
|
const supportedMethods = ['get', 'query', 'put', 'post', 'patch', 'delete', 'head', 'options']; // this is also used for ordering endpoints by methods
|
|
157
|
-
const
|
|
158
|
+
const rawTags = openApiSpec.tags && Array.isArray(openApiSpec.tags) ? openApiSpec.tags : [];
|
|
159
|
+
const unsortedTags = rawTags
|
|
160
|
+
// Only support nav tags in grouping, because these tags will be used for navigation.
|
|
161
|
+
.filter(t => !t.kind || t.kind === 'nav').map(t => {
|
|
158
162
|
const name = typeof t === 'string' ? t : t.name;
|
|
159
163
|
return {
|
|
160
164
|
elementId: `tag--${name.replace(invalidCharsRegEx, '-')}`,
|
|
161
165
|
name: name,
|
|
166
|
+
summary: t.summary,
|
|
162
167
|
description: t.description || '',
|
|
163
168
|
headers: t.description ? getHeadersFromMarkdown(t.description) : [],
|
|
164
169
|
paths: [],
|
|
165
170
|
expanded: true
|
|
166
171
|
};
|
|
167
|
-
})
|
|
172
|
+
});
|
|
173
|
+
const tagMap = unsortedTags.reduce((acc, t) => ({
|
|
174
|
+
...acc,
|
|
175
|
+
[t.name]: t
|
|
176
|
+
}), {});
|
|
177
|
+
const tagDependencies = rawTags.map(t => t.parent && [t.parent, t.name] || [t.name, 'null']);
|
|
178
|
+
const tags = toposort(tagDependencies).map(tagName => tagMap[tagName]).filter(t => t);
|
|
168
179
|
const pathsAndWebhooks = openApiSpec.paths || {};
|
|
169
180
|
if (openApiSpec.webhooks) {
|
|
170
181
|
for (const [key, value] of Object.entries(openApiSpec.webhooks)) {
|
|
@@ -14,7 +14,7 @@ var _requestFormTable = _interopRequireDefault(require("./request-form-table.js"
|
|
|
14
14
|
require("./tag-input.js");
|
|
15
15
|
require("./syntax-highlighter.js");
|
|
16
16
|
var _json = _interopRequireDefault(require("json5"));
|
|
17
|
-
function _interopRequireDefault(
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
18
|
const textFileRegex = RegExp('^font/|tar$|zip$|7z$|rtf$|msword$|excel$|/pdf$|/octet-stream$|^application/vnd.');
|
|
19
19
|
const mediaFileRegex = RegExp('^audio/|^image/|^video/');
|
|
20
20
|
class ApiRequest extends _lit.LitElement {
|
|
@@ -18,7 +18,7 @@ var _prismStyles = _interopRequireDefault(require("../styles/prism-styles.js"));
|
|
|
18
18
|
require("./schema-tree.js");
|
|
19
19
|
require("./schema-table.js");
|
|
20
20
|
require("./syntax-highlighter.js");
|
|
21
|
-
function _interopRequireDefault(
|
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
22
|
class ApiResponse extends _lit.LitElement {
|
|
23
23
|
constructor() {
|
|
24
24
|
super();
|
|
@@ -7,7 +7,7 @@ var _fontStyles = _interopRequireDefault(require("../styles/font-styles.js"));
|
|
|
7
7
|
var _borderStyles = _interopRequireDefault(require("../styles/border-styles.js"));
|
|
8
8
|
var _inputStyles = _interopRequireDefault(require("../styles/input-styles.js"));
|
|
9
9
|
var _keyFrameStyles = _interopRequireDefault(require("../styles/key-frame-styles.js"));
|
|
10
|
-
function _interopRequireDefault(
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
class JsonTree extends _lit.LitElement {
|
|
12
12
|
static get properties() {
|
|
13
13
|
return {
|
|
@@ -8,7 +8,7 @@ var _unsafeHtml = require("lit/directives/unsafe-html.js");
|
|
|
8
8
|
var _fontStyles = _interopRequireDefault(require("../styles/font-styles.js"));
|
|
9
9
|
var _schemaStyles = _interopRequireDefault(require("../styles/schema-styles.js"));
|
|
10
10
|
var _keyFrameStyles = _interopRequireDefault(require("../styles/key-frame-styles.js"));
|
|
11
|
-
function _interopRequireDefault(
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
const tablePadding = 16;
|
|
13
13
|
const firstColumnInitialPadding = tablePadding * 2;
|
|
14
14
|
class SchemaTable extends _lit.LitElement {
|
|
@@ -10,7 +10,7 @@ var _fontStyles = _interopRequireDefault(require("../styles/font-styles.js"));
|
|
|
10
10
|
var _schemaStyles = _interopRequireDefault(require("../styles/schema-styles.js"));
|
|
11
11
|
var _borderStyles = _interopRequireDefault(require("../styles/border-styles.js"));
|
|
12
12
|
var _keyFrameStyles = _interopRequireDefault(require("../styles/key-frame-styles.js"));
|
|
13
|
-
function _interopRequireDefault(
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
class SchemaTree extends _lit.LitElement {
|
|
15
15
|
static get properties() {
|
|
16
16
|
return {
|
|
@@ -23,7 +23,7 @@ var _fontStyles = _interopRequireDefault(require("../styles/font-styles.js"));
|
|
|
23
23
|
var _inputStyles = _interopRequireDefault(require("../styles/input-styles.js"));
|
|
24
24
|
var _index = require("../languages/index.js");
|
|
25
25
|
var _commonUtils = require("../utils/common-utils.js");
|
|
26
|
-
function _interopRequireDefault(
|
|
26
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27
27
|
/**
|
|
28
28
|
* Mapping mime-type => prism language
|
|
29
29
|
*/
|
|
@@ -6,7 +6,7 @@ exports.initI18n = initI18n;
|
|
|
6
6
|
var _i18next = _interopRequireDefault(require("i18next"));
|
|
7
7
|
var _en = _interopRequireDefault(require("./en.js"));
|
|
8
8
|
var _fr = _interopRequireDefault(require("./fr.js"));
|
|
9
|
-
function _interopRequireDefault(
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
async function initI18n(resolvedSpecLanguage) {
|
|
11
11
|
const initLang = (resolvedSpecLanguage || window.navigator.language).substring(0, 2);
|
|
12
12
|
await _i18next.default.init({
|
|
@@ -25,7 +25,7 @@ var _apiRequestStyles = _interopRequireDefault(require("./styles/api-request-sty
|
|
|
25
25
|
var _securitySchemeTemplate = require("./templates/security-scheme-template.js");
|
|
26
26
|
require("./components/syntax-highlighter.js");
|
|
27
27
|
require("./openapi-explorer-oauth-handler.js");
|
|
28
|
-
function _interopRequireDefault(
|
|
28
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
29
29
|
// Styles
|
|
30
30
|
|
|
31
31
|
class OpenApiExplorer extends _lit.LitElement {
|
|
@@ -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)`.hover-bg:hover{background:var(--bg3)}::selection{background:var(--selection-bg);color:var(--selection-fg)}.regular-font{font-family:var(--font-regular)}.mono-font{font-family:var(--font-mono)}.title{font-size:calc(var(--font-size-small) + 1rem);font-weight:400}.sub-title{font-size:20px}.req-res-title{font-family:var(--font-regular);font-size:calc(var(--font-size-small) + 4px);font-weight:700}.tiny-title{font-size:calc(var(--font-size-small) + 1px);font-weight:700}.regular-font-size{font-size:var(--font-size-regular)}.small-font-size{font-size:var(--font-size-small)}.upper{text-transform:uppercase}.primary-text{color:var(--primary-color)}.bold-text{font-weight:700}.gray-text{color:var(--light-fg)}.red-text{color:var(--red)}.blue-text{color:var(--blue)}.multiline{overflow:scroll;max-height:var(--resp-area-height,300px);color:var(--fg3)}.method-fg.put{color:var(--orange)}.method-fg.post{color:var(--green)}.method-fg.get,.method-fg.head{color:var(--blue)}.method-fg.delete{color:var(--red)}.method-fg.query{color:var(--purple)}.method-fg.trace{color:var(--purple)}.method-fg.options{color:var(--gray)}.method-fg.patch{color:var(--yellow)}h1{font-family:var(--font-regular);font-size:28px;padding-top:10px;letter-spacing:normal;font-weight:400}h2{font-family:var(--font-regular);font-size:24px;padding-top:10px;letter-spacing:normal;font-weight:400}h3{font-family:var(--font-regular);font-size:18px;padding-top:10px;letter-spacing:normal;font-weight:400}h4{font-family:var(--font-regular);font-size:16px;padding-top:10px;letter-spacing:normal;font-weight:400}h5{font-family:var(--font-regular);font-size:14px;padding-top:10px;letter-spacing:normal;font-weight:400}h6{font-family:var(--font-regular);font-size:14px;padding-top:10px;letter-spacing:normal;font-weight:400}h1,h2,h3,h4,h5{margin-block-end:.2em;margin-block-start:.5em}h3{margin-top:0}p{margin-block-start:.5em}a{color:var(--blue);cursor:pointer}a.inactive-link{color:var(--fg);text-decoration:none;cursor:text}code,pre,syntax-highlighter{margin:0;font-family:var(--font-mono);font-size:var(--font-size-mono)}.m-markdown syntax-highlighter{display:block}.m-markdown,.m-markdown-small{display:block}.m-markdown a,.m-markdown li,.m-markdown p,.m-markdown span{font-size:var(--font-size-regular);line-height:calc(var(--font-size-regular) + 6px)}.m-markdown-small a,.m-markdown-small li,.m-markdown-small p,.m-markdown-small span{font-size:var(--font-size-small);line-height:calc(var(--font-size-small) + 6px)}.m-markdown p:not(:first-child){margin-block-start:12px}.m-markdown-small p:not(:first-child){margin-block-start:12px}.m-markdown :first-child,.m-markdown-small :first-child{margin-block-start:0}.m-markdown p,.m-markdown-small p{margin-block-end:0;overflow-wrap:anywhere}.toolbar .m-markdown p,.toolbar .m-markdown-small p{margin-block-start:0}.m-markdown code span{font-size:var(--font-size-mono)}.m-markdown code,.m-markdown syntax-highlighter,.m-markdown-small code{padding:1px 6px;border-radius:2px;color:var(--inline-code-fg);background-color:var(--bg3);font-size:calc(var(--font-size-mono));line-height:1.2}.m-markdown-small code,.m-markdown-small syntax-highlighter{font-size:var(--font-size-mono)}.m-markdown pre,.m-markdown syntax-highlighter,.m-markdown-small pre{white-space:pre-wrap;overflow-x:auto;line-height:normal;border-radius:2px;border:1px solid var(--code-border-color)}.m-markdown pre,.m-markdown syntax-highlighter{padding:8px;background-color:var(--bg2);color:var(--code-fg)}.m-markdown-small pre,.m-markdown-small syntax-highlighter{margin-top:4px;padding:2px 4px;background-color:var(--bg3);color:var(--fg2)}.m-markdown pre code,.m-markdown-small pre code{border:none;padding:0}.m-markdown pre code{color:var(--code-fg);background-color:var(--bg2);background-color:transparent}.m-markdown-small pre code,.m-markdown-small syntax-highlighter{color:var(--fg2);background-color:var(--bg3)}.m-markdown ol,.m-markdown ul{padding-inline-start:30px}.m-markdown-small ol,.m-markdown-small ul{padding-inline-start:20px}.m-markdown a,.m-markdown-small a{color:var(--blue)}.m-markdown img,.m-markdown-small img{max-width:100%}.m-markdown table,.m-markdown-small table{border-spacing:0;margin:10px 0;border-collapse:separate;border:1px solid var(--border-color);border-radius:var(--border-radius);font-size:calc(var(--font-size-small) + 1px);line-height:calc(var(--font-size-small) + 4px);max-width:100%}.m-markdown-small table{font-size:var(--font-size-small);line-height:calc(var(--font-size-small) + 2px);margin:8px 0}.m-markdown td,.m-markdown th,.m-markdown-small td,.m-markdown-small th{vertical-align:top;border-top:1px solid var(--border-color);line-height:calc(var(--font-size-small) + 4px)}.m-markdown tr:first-child th,.m-markdown-small tr:first-child th{border-top:0 none}.m-markdown td,.m-markdown th{padding:10px 12px}.m-markdown-small td,.m-markdown-small th{padding:8px 8px}.m-markdown th,.m-markdown-small th{font-weight:600;background-color:var(--bg2);vertical-align:middle}.m-markdown-small table code{font-size:calc(var(--font-size-mono) - 1px)}.m-markdown table code{font-size:var(--font-size-mono)}.m-markdown blockquote,.m-markdown-small blockquote{margin-inline-start:0;margin-inline-end:0;border-left:3px solid var(--border-color);padding:6px 0 6px 6px}`;
|
|
6
|
+
var _default = exports.default = (0, _lit.css)`.hover-bg:hover{background:var(--bg3)}::selection{background:var(--selection-bg);color:var(--selection-fg)}.regular-font{font-family:var(--font-regular)}.mono-font{font-family:var(--font-mono)}.title{font-size:calc(var(--font-size-small) + 1rem);font-weight:400}.sub-title{font-size:20px}.req-res-title{font-family:var(--font-regular);font-size:calc(var(--font-size-small) + 4px);font-weight:700}.tiny-title{font-size:calc(var(--font-size-small) + 1px);font-weight:700}.regular-font-size{font-size:var(--font-size-regular)}.small-font-size{font-size:var(--font-size-small)}.upper{text-transform:uppercase}.primary-text{color:var(--primary-color)}.bold-text{font-weight:700}.gray-text{color:var(--light-fg)}.red-text{color:var(--red)}.blue-text{color:var(--blue)}.multiline{overflow:scroll;max-height:var(--resp-area-height,300px);color:var(--fg3)}.method-fg.put{color:var(--orange)}.method-fg.post{color:var(--green)}.method-fg.get,.method-fg.head{color:var(--blue)}.method-fg.delete{color:var(--red)}.method-fg.query{color:var(--purple)}.method-fg.trace{color:var(--purple)}.method-fg.options{color:var(--gray)}.method-fg.patch{color:var(--yellow)}h1{font-family:var(--font-regular);font-size:28px;padding-top:10px;letter-spacing:normal;font-weight:400}h2{font-family:var(--font-regular);font-size:24px;padding-top:10px;letter-spacing:normal;font-weight:400}h3{font-family:var(--font-regular);font-size:18px;padding-top:10px;letter-spacing:normal;font-weight:400}h4{font-family:var(--font-regular);font-size:16px;padding-top:10px;letter-spacing:normal;font-weight:400}h5{font-family:var(--font-regular);font-size:14px;padding-top:10px;letter-spacing:normal;font-weight:400}h6{font-family:var(--font-regular);font-size:14px;padding-top:10px;letter-spacing:normal;font-weight:400}h1,h2,h3,h4,h5{margin-block-end:.2em;margin-block-start:.5em;padding-top:0}h3{margin-top:0}p{margin-block-start:.5em}a{color:var(--blue);cursor:pointer}a.inactive-link{color:var(--fg);text-decoration:none;cursor:text}code,pre,syntax-highlighter{margin:0;font-family:var(--font-mono);font-size:var(--font-size-mono)}.m-markdown syntax-highlighter{display:block}.m-markdown,.m-markdown-small{display:block}.m-markdown a,.m-markdown li,.m-markdown p,.m-markdown span{font-size:var(--font-size-regular);line-height:calc(var(--font-size-regular) + 6px)}.m-markdown-small a,.m-markdown-small li,.m-markdown-small p,.m-markdown-small span{font-size:var(--font-size-small);line-height:calc(var(--font-size-small) + 6px)}.m-markdown p:not(:first-child){margin-block-start:12px}.m-markdown-small p:not(:first-child){margin-block-start:12px}.m-markdown :first-child,.m-markdown-small :first-child{margin-block-start:0}.m-markdown p,.m-markdown-small p{margin-block-end:0;overflow-wrap:anywhere}.toolbar .m-markdown p,.toolbar .m-markdown-small p{margin-block-start:0}.m-markdown code span{font-size:var(--font-size-mono)}.m-markdown code,.m-markdown syntax-highlighter,.m-markdown-small code{padding:1px 6px;border-radius:2px;color:var(--inline-code-fg);background-color:var(--bg3);font-size:calc(var(--font-size-mono));line-height:1.2}.m-markdown-small code,.m-markdown-small syntax-highlighter{font-size:var(--font-size-mono)}.m-markdown pre,.m-markdown syntax-highlighter,.m-markdown-small pre{white-space:pre-wrap;overflow-x:auto;line-height:normal;border-radius:2px;border:1px solid var(--code-border-color)}.m-markdown pre,.m-markdown syntax-highlighter{padding:8px;background-color:var(--bg2);color:var(--code-fg)}.m-markdown-small pre,.m-markdown-small syntax-highlighter{margin-top:4px;padding:2px 4px;background-color:var(--bg3);color:var(--fg2)}.m-markdown pre code,.m-markdown-small pre code{border:none;padding:0}.m-markdown pre code{color:var(--code-fg);background-color:var(--bg2);background-color:transparent}.m-markdown-small pre code,.m-markdown-small syntax-highlighter{color:var(--fg2);background-color:var(--bg3)}.m-markdown ol,.m-markdown ul{padding-inline-start:30px}.m-markdown-small ol,.m-markdown-small ul{padding-inline-start:20px}.m-markdown a,.m-markdown-small a{color:var(--blue)}.m-markdown img,.m-markdown-small img{max-width:100%}.m-markdown table,.m-markdown-small table{border-spacing:0;margin:10px 0;border-collapse:separate;border:1px solid var(--border-color);border-radius:var(--border-radius);font-size:calc(var(--font-size-small) + 1px);line-height:calc(var(--font-size-small) + 4px);max-width:100%}.m-markdown-small table{font-size:var(--font-size-small);line-height:calc(var(--font-size-small) + 2px);margin:8px 0}.m-markdown td,.m-markdown th,.m-markdown-small td,.m-markdown-small th{vertical-align:top;border-top:1px solid var(--border-color);line-height:calc(var(--font-size-small) + 4px)}.m-markdown tr:first-child th,.m-markdown-small tr:first-child th{border-top:0 none}.m-markdown td,.m-markdown th{padding:10px 12px}.m-markdown-small td,.m-markdown-small th{padding:8px 8px}.m-markdown th,.m-markdown-small th{font-weight:600;background-color:var(--bg2);vertical-align:middle}.m-markdown-small table code{font-size:calc(var(--font-size-mono) - 1px)}.m-markdown table code{font-size:var(--font-size-mono)}.m-markdown blockquote,.m-markdown-small blockquote{margin-inline-start:0;margin-inline-end:0;border-left:3px solid var(--border-color);padding:6px 0 6px 6px}`;
|
|
@@ -13,7 +13,7 @@ var _callbackTemplate = _interopRequireDefault(require("./callback-template.js")
|
|
|
13
13
|
var _securitySchemeTemplate = require("./security-scheme-template.js");
|
|
14
14
|
var _commonUtils = require("../utils/common-utils.js");
|
|
15
15
|
var _index = require("../languages/index.js");
|
|
16
|
-
function _interopRequireDefault(
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
17
|
function toggleExpand(path) {
|
|
18
18
|
if (path.expanded) {
|
|
19
19
|
path.expanded = false;
|
|
@@ -12,19 +12,21 @@ var _callbackTemplate = _interopRequireDefault(require("./callback-template.js")
|
|
|
12
12
|
var _index = require("../languages/index.js");
|
|
13
13
|
require("../components/api-request.js");
|
|
14
14
|
require("../components/api-response.js");
|
|
15
|
-
function _interopRequireDefault(
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
/* eslint-disable indent */
|
|
17
17
|
function expandedEndpointBodyTemplate(path, tag) {
|
|
18
18
|
var _path$servers, _path$servers$, _this$selectedServer;
|
|
19
19
|
// Filter API Keys that are non-empty and are applicable to the the path
|
|
20
20
|
const nonEmptyApiKeys = this.resolvedSpec.securitySchemes.filter(v => v.finalKeyValue && path.security && path.security.some(ps => ps[v.apiKeyId])) || [];
|
|
21
21
|
const codeSampleTabPanel = path.xCodeSamples ? _codeSamplesTemplate.default.call(this, path.xCodeSamples) : '';
|
|
22
|
-
|
|
22
|
+
const tagSummary = tag !== null && tag !== void 0 && tag.summary ? (0, _lit.html)`<small style="font-weight:400">- ${tag === null || tag === void 0 ? void 0 : tag.summary}</small>` : '';
|
|
23
|
+
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' && tag && tag.name !== 'General ⦂' ? (0, _lit.html)`<h1 style="display:inline;align-self:center" class="title tag-link" role="heading" aria-level="1" data-content-id="${tag.elementId}" @click="${e => this.scrollToEventTarget(e, false)}"> ${tag === null || tag === void 0 ? void 0 : tag.name} ${tagSummary}</h1>` : ''} <slot name="${tag.elementId}"></slot> <div style="display:flex;justify-content:space-between"> <div style="flex-grow:1"> <h2 style="display:flex;align-items:center"> <div>${path.shortSummary || `${path.method.toUpperCase()} ${path.path}`}</div> <div>${path.deprecated ? (0, _lit.html)`<div> -<span class="bold-text red-text" style="font-size:var(--font-size-regular)"> ${(0, _index.getI18nText)('operations.deprecated')}</span></div>` : ''}</div> </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)">${(0, _index.getI18nText)('operations.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, _commonUtils.toMarkdown)(path.externalDocs.description || ''))} <a href="${(0, _commonUtils.getSanitizedUrl)(path.externalDocs.url)}">Navigate to documentation ↗</a> </div>` : ''} </div> <div class="m-markdown" style="margin-right:2rem"> ${(0, _unsafeHtml.unsafeHTML)((0, _commonUtils.toMarkdown)(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.displaySchemaAsTree ? 'tree' : 'table'}" 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.displaySchemaAsTree ? 'tree' : 'table'}" 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>`;
|
|
23
24
|
}
|
|
24
25
|
function expandedTagTemplate(tagId, subsectionFullId) {
|
|
25
26
|
const tag = (this.resolvedSpec.tags || []).find(t => t.elementId === tagId);
|
|
26
27
|
const subsectionId = subsectionFullId.replace(`${tagId}--`, '');
|
|
27
|
-
|
|
28
|
+
const tagSummary = tag.summary ? (0, _lit.html)`<h2 style="font-weight:400">${tag.summary}</h2>` : '';
|
|
29
|
+
return (0, _lit.html)` <section id="${tag.elementId}" part="section-tag" class="regular-font section-gap--read-mode observe-me" style=""> <h1 class="title tag" part="label-tag-title" role="heading" aria-level="1">${tag.name}</h1> ${tagSummary} <slot name="${tag.elementId}--subsection--${subsectionId}"> <div class="regular-font-size"> ${(0, _unsafeHtml.unsafeHTML)(`
|
|
28
30
|
<div class="m-markdown regular-font">
|
|
29
31
|
${(0, _commonUtils.toMarkdown)(tag.description || '')}
|
|
30
32
|
</div>`)} </div> </slot> <slot name="${tag.elementId}--body"></slot> <br> <strong>Operations</strong> <div class="nav-bar-paths-under-tag" style="max-width:300px"> ${tag.paths.map(p => (0, _lit.html)` <div class="nav-bar-path ${this.usePathInNavBar ? 'small-font' : ''}" role="link" tabindex="0" data-content-id="${p.elementId}" id="link-${p.elementId}" @click="${e => {
|
|
@@ -10,7 +10,7 @@ var _componentsTemplate = _interopRequireDefault(require("./components-template.
|
|
|
10
10
|
var _overviewTemplate = _interopRequireDefault(require("./overview-template.js"));
|
|
11
11
|
var _serverTemplate = _interopRequireDefault(require("./server-template.js"));
|
|
12
12
|
var _securitySchemeTemplate = _interopRequireDefault(require("./security-scheme-template.js"));
|
|
13
|
-
function _interopRequireDefault(
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
function wrapFocusedTemplate(templateToWrap) {
|
|
15
15
|
return (0, _lit.html)` <div class="regular-font section-gap--focused-mode" part="section-operations-in-tag"> ${templateToWrap} </div>`;
|
|
16
16
|
}
|
|
@@ -12,7 +12,7 @@ var _navbarTemplate = _interopRequireDefault(require("./navbar-template.js"));
|
|
|
12
12
|
var _advanceSearchTemplate = _interopRequireDefault(require("./advance-search-template.js"));
|
|
13
13
|
var _theme = _interopRequireDefault(require("../utils/theme.js"));
|
|
14
14
|
var _colorUtils = _interopRequireDefault(require("../utils/color-utils.js"));
|
|
15
|
-
function _interopRequireDefault(
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
// Templates
|
|
17
17
|
|
|
18
18
|
function mainBodyTemplate() {
|
|
@@ -9,7 +9,7 @@ var _unsafeHtml = require("lit/directives/unsafe-html.js");
|
|
|
9
9
|
var _commonUtils = require("../utils/common-utils.js");
|
|
10
10
|
var _base64url = _interopRequireDefault(require("base64url"));
|
|
11
11
|
var _index = require("../languages/index.js");
|
|
12
|
-
function _interopRequireDefault(
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
function onUserEnteredNewApiKeyValue(apiKeyId, e) {
|
|
14
14
|
e.preventDefault();
|
|
15
15
|
let apiKeyValue = '';
|
|
@@ -11,7 +11,7 @@ var _lodash = _interopRequireDefault(require("lodash.clonedeep"));
|
|
|
11
11
|
var _lodash2 = _interopRequireDefault(require("lodash.merge"));
|
|
12
12
|
var _randexp = _interopRequireDefault(require("randexp"));
|
|
13
13
|
var _xml = _interopRequireDefault(require("./xml/xml.js"));
|
|
14
|
-
function _interopRequireDefault(
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
// When the type is not known for a property set the displayed type to be this:
|
|
16
16
|
const IS_MISSING_TYPE_INFO_TYPE = '';
|
|
17
17
|
const EXAMPLE_VALUE_FOR_MISSING_TYPE = '';
|
|
@@ -6,7 +6,8 @@ var _openapiResolverBrowser = _interopRequireDefault(require("openapi-resolver/d
|
|
|
6
6
|
var _marked = require("marked");
|
|
7
7
|
var _commonUtils = require("./common-utils.js");
|
|
8
8
|
var _lodash = _interopRequireDefault(require("lodash.clonedeep"));
|
|
9
|
-
|
|
9
|
+
var _toposort = _interopRequireDefault(require("toposort"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
11
|
// To inline test changes to the OpenAPiResolver, it must be copied into the node_modules directory. The builder for this package will not work across repositories.
|
|
11
12
|
|
|
12
13
|
async function ProcessSpec(specUrlOrObject, serverUrl = '') {
|
|
@@ -160,17 +161,27 @@ function getComponents(openApiSpec) {
|
|
|
160
161
|
}
|
|
161
162
|
function groupByTags(openApiSpec) {
|
|
162
163
|
const supportedMethods = ['get', 'query', 'put', 'post', 'patch', 'delete', 'head', 'options']; // this is also used for ordering endpoints by methods
|
|
163
|
-
const
|
|
164
|
+
const rawTags = openApiSpec.tags && Array.isArray(openApiSpec.tags) ? openApiSpec.tags : [];
|
|
165
|
+
const unsortedTags = rawTags
|
|
166
|
+
// Only support nav tags in grouping, because these tags will be used for navigation.
|
|
167
|
+
.filter(t => !t.kind || t.kind === 'nav').map(t => {
|
|
164
168
|
const name = typeof t === 'string' ? t : t.name;
|
|
165
169
|
return {
|
|
166
170
|
elementId: `tag--${name.replace(_commonUtils.invalidCharsRegEx, '-')}`,
|
|
167
171
|
name: name,
|
|
172
|
+
summary: t.summary,
|
|
168
173
|
description: t.description || '',
|
|
169
174
|
headers: t.description ? getHeadersFromMarkdown(t.description) : [],
|
|
170
175
|
paths: [],
|
|
171
176
|
expanded: true
|
|
172
177
|
};
|
|
173
|
-
})
|
|
178
|
+
});
|
|
179
|
+
const tagMap = unsortedTags.reduce((acc, t) => ({
|
|
180
|
+
...acc,
|
|
181
|
+
[t.name]: t
|
|
182
|
+
}), {});
|
|
183
|
+
const tagDependencies = rawTags.map(t => t.parent && [t.parent, t.name] || [t.name, 'null']);
|
|
184
|
+
const tags = (0, _toposort.default)(tagDependencies).map(tagName => tagMap[tagName]).filter(t => t);
|
|
174
185
|
const pathsAndWebhooks = openApiSpec.paths || {};
|
|
175
186
|
if (openApiSpec.webhooks) {
|
|
176
187
|
for (const [key, value] of Object.entries(openApiSpec.webhooks)) {
|
package/dist/lib/utils/theme.js
CHANGED
|
@@ -5,7 +5,7 @@ exports.default = setTheme;
|
|
|
5
5
|
var _lit = require("lit");
|
|
6
6
|
var _color = _interopRequireDefault(require("color"));
|
|
7
7
|
var _colorUtils = _interopRequireDefault(require("./color-utils.js"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
/* Generates an schema object containing type and constraint info */
|
|
10
10
|
|
|
11
11
|
// TODO: possible drive theme from:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-explorer",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.783",
|
|
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",
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
"base64url": "^3.0.1",
|
|
55
55
|
"buffer": "^6.0.3",
|
|
56
56
|
"color": "^4.2.3",
|
|
57
|
-
"create-hash": "^1.2.0",
|
|
58
57
|
"i18next": "^21.9.0",
|
|
59
58
|
"json5": "^2.2.3",
|
|
60
59
|
"lit": "^2.3.1",
|
|
@@ -118,10 +117,11 @@
|
|
|
118
117
|
"sinon-chai": "^3.3.0",
|
|
119
118
|
"style-loader": "^2.0.0",
|
|
120
119
|
"terser-webpack-plugin": "^5.1.1",
|
|
121
|
-
"
|
|
122
|
-
"webpack
|
|
123
|
-
"webpack-
|
|
124
|
-
"webpack-
|
|
120
|
+
"toposort": "^2.0.2",
|
|
121
|
+
"webpack": "^5.103.0",
|
|
122
|
+
"webpack-bundle-analyzer": "^5.0.1",
|
|
123
|
+
"webpack-cli": "^6.0.1",
|
|
124
|
+
"webpack-dev-server": "^5.2.2"
|
|
125
125
|
},
|
|
126
126
|
"engines": {
|
|
127
127
|
"node": ">=16"
|