openapi-explorer 2.1.660 → 2.1.663
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/openapi-explorer.js +5 -4
- package/dist/es/styles/main-body-styles.js +2 -0
- package/dist/es/templates/mainBodyTemplate.js +2 -2
- package/dist/es/utils/spec-parser.js +2 -1
- package/dist/lib/openapi-explorer.js +4 -3
- package/dist/lib/styles/main-body-styles.js +6 -0
- package/dist/lib/templates/mainBodyTemplate.js +2 -2
- package/dist/lib/utils/spec-parser.js +3 -1
- package/package.json +2 -2
@@ -1,4 +1,4 @@
|
|
1
|
-
import { LitElement
|
1
|
+
import { LitElement } from 'lit';
|
2
2
|
|
3
3
|
// Styles
|
4
4
|
import FontStyles from './styles/font-styles.js';
|
@@ -14,6 +14,7 @@ import TabStyles from './styles/tab-styles.js';
|
|
14
14
|
import NavStyles from './styles/nav-styles.js';
|
15
15
|
import InfoStyles from './styles/info-styles.js';
|
16
16
|
import advancedSearchStyles from './styles/advanced-search-styles.js';
|
17
|
+
import MainBodyStyles from './styles/main-body-styles.js';
|
17
18
|
import { advancedSearch, getCurrentElement, replaceState, sleep } from './utils/common-utils.js';
|
18
19
|
import { initI18n } from './languages/index.js';
|
19
20
|
import ProcessSpec from './utils/spec-parser.js';
|
@@ -235,7 +236,7 @@ export default class OpenApiExplorer extends LitElement {
|
|
235
236
|
};
|
236
237
|
}
|
237
238
|
static finalizeStyles() {
|
238
|
-
return [FontStyles, SchemaStyles, InputStyles, FlexStyles, TableStyles, KeyFrameStyles, EndpointStyles, PrismStyles, TabStyles, NavStyles, InfoStyles, TagInputStyles, advancedSearchStyles, apiRequestStyles,
|
239
|
+
return [FontStyles, SchemaStyles, InputStyles, FlexStyles, TableStyles, KeyFrameStyles, EndpointStyles, PrismStyles, TabStyles, NavStyles, InfoStyles, TagInputStyles, advancedSearchStyles, apiRequestStyles, MainBodyStyles];
|
239
240
|
}
|
240
241
|
|
241
242
|
// Startup
|
@@ -399,7 +400,7 @@ export default class OpenApiExplorer extends LitElement {
|
|
399
400
|
var _spec$info;
|
400
401
|
this.resolvedSpec = null;
|
401
402
|
this.loading = true;
|
402
|
-
this.
|
403
|
+
this.loadingFailedError = null;
|
403
404
|
const spec = await ProcessSpec(specUrlOrObject, this.serverUrl);
|
404
405
|
this.loading = false;
|
405
406
|
if (spec === undefined || spec === null) {
|
@@ -415,7 +416,7 @@ export default class OpenApiExplorer extends LitElement {
|
|
415
416
|
this.afterSpecParsedAndValidated(spec);
|
416
417
|
} catch (err) {
|
417
418
|
this.loading = false;
|
418
|
-
this.
|
419
|
+
this.loadingFailedError = err.message;
|
419
420
|
this.resolvedSpec = null;
|
420
421
|
console.error('OpenAPI Explorer: Unable to resolve the API spec..', err); // eslint-disable-line no-console
|
421
422
|
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import { css } from 'lit';
|
2
|
+
export default css`:not(:defined){display:none}:host{display:flex;flex-direction:column;width:100%;height:100%;margin:0;padding:0;overflow:hidden;letter-spacing:normal;color:var(--fg);background-color:var(--bg);font-family:var(--font-regular)}.body{display:flex;height:100%;width:100%;overflow:hidden}a{text-decoration:none}.main-content{margin:0;padding:0;display:block;flex:1;height:100%;overflow-y:overlay;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:var(--border-color) transparent}.main-content::-webkit-scrollbar{width:8px;height:8px}.main-content::-webkit-scrollbar-track{background:0 0}.main-content::-webkit-scrollbar-thumb{background-color:var(--border-color)}.section-gap.section-tag{border-bottom:1px solid var(--border-color)}.method-section-gap{margin:0;padding:0 8px 0 4px;border-bottom:1px solid var(--border-color)}.section-gap{padding:24px 0 0}.section-tag-header{position:relative;cursor:n-resize;padding:12px 0}.collapsed .section-tag-header:hover{cursor:s-resize}.section-tag-header:hover{background-image:linear-gradient(to right,rgba(0,0,0,0),var(--border-color),rgba(0,0,0,0))}.collapsed .section-tag-header:hover::after{color:var(--primary-color)}.collapsed .section-tag-body{display:none}.logo{height:36px;width:36px;margin-left:5px}.only-large-screen,.only-large-screen-flex{display:none}.header-title{font-size:calc(var(--font-size-regular) + 8px);padding:0 8px}.tag.title{text-transform:uppercase}.header{background-color:var(--header-bg);color:var(--header-fg);width:100%}input.header-input{background:var(--header-color-darker);color:var(--header-fg);border:1px solid var(--header-color-border);flex:1;padding-right:24px;border-radius:3px}input.header-input::placeholder{opacity:.4}input:disabled{cursor:not-allowed}.loader{margin:16px auto 16px auto;border:4px solid var(--bg3);border-radius:50%;border-top:4px solid var(--primary-color);width:36px;height:36px;animation:spin 2s linear infinite}.expanded-endpoint-body,.expanded-endpoint-component{position:relative;padding:6px 0}.divider{border-top:2px solid var(--border-color);margin:24px 0;width:100%}.security-tooltip{border:1px solid var(--border-color);border-left-width:4px;margin-left:2px}.security-tooltip a{color:var(--fg2);text-decoration:none}.tooltip-text{color:var(--fg2);background-color:var(--bg2);visibility:hidden;overflow-wrap:break-word}.tooltip:hover{color:var(--primary-color);border-color:var(--primary-color)}.tooltip-replace:hover{visibility:hidden}.tooltip:hover a:hover{color:var(--primary-color)}.tooltip:hover .tooltip-text{visibility:visible;cursor:text;opacity:1}@media only screen and (max-width:767.98px){.section-padding{margin:1rem}.sub-title.tag{margin-left:1rem}.section-tag-body .description{margin-left:1rem;margin-right:1rem}}@media only screen and (min-width:768px){.nav-bar{width:260px;display:flex}.only-large-screen{display:block}.only-large-screen-flex{display:flex}.section-gap{padding:24px 24px}.section-gap--read-mode{padding:24px 8px}.section-gap--focused-mode{padding:1.5rem}.endpoint-body{position:relative;padding:36px 0 48px 0}}@media only screen and (min-width:1024px){.nav-bar{width:330px;display:flex}.section-gap--read-mode{padding:24px 24px 12px}.main-content-inner{padding:24px}}`;
|
@@ -25,8 +25,8 @@ export default function mainBodyTemplate() {
|
|
25
25
|
};
|
26
26
|
|
27
27
|
/* eslint-disable indent */
|
28
|
-
return html` ${SetTheme.call(this, newTheme)} ${this.hideSearch ? '' : advancedSearchTemplate.call(this)} <div id="the-main-body" class="body"> ${this.renderStyle === 'focused' && this.resolvedSpec ? navbarTemplate.call(this) : ''} ${this.loading === true ? html`<slot name="loader"><div class="loader"></div></slot>` : html` <main class="main-content regular-font" part="section-main-content"> <
|
28
|
+
return html` ${SetTheme.call(this, newTheme)} ${this.hideSearch ? '' : advancedSearchTemplate.call(this)} <div id="the-main-body" class="body"> ${this.renderStyle === 'focused' && this.resolvedSpec ? navbarTemplate.call(this) : ''} ${this.loading === true ? html`<slot name="loader"><div class="loader"></div></slot>` : html` <main class="main-content regular-font" part="section-main-content"> <div id="operations-root" class="main-content-inner"> ${this.loadingFailedError ? html` <div style="text-align:center;margin:16px"> Unable to load the Spec${this.specUrl ? ': ' : ''} <strong>${this.specUrl}</strong> <br><br> <div> ${this.loadingFailedError} </div> </div>` : html` <div class="operations-root" @click="${e => {
|
29
29
|
this.handleHref(e);
|
30
|
-
}}"> ${this.renderStyle === 'focused' ? html`${focusedEndpointTemplate.call(this)}` : html` ${!this.hideInfo ? overviewTemplate.call(this) : ''} ${!this.hideServerSelection ? serverTemplate.call(this) : ''} ${!this.hideAuthentication ? securitySchemeTemplate.call(this) : ''} <section id="section" class="observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> <slot name="custom-section"></slot> </section> ${endpointTemplate.call(this)}`} </div>
|
30
|
+
}}"> ${this.renderStyle === 'focused' ? html`${focusedEndpointTemplate.call(this)}` : html` ${!this.hideInfo ? overviewTemplate.call(this) : ''} ${!this.hideServerSelection ? serverTemplate.call(this) : ''} ${!this.hideAuthentication ? securitySchemeTemplate.call(this) : ''} <section id="section" class="observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> <slot name="custom-section"></slot> </section> ${endpointTemplate.call(this)}`} </div>`} </div> </main>`} </div> `;
|
31
31
|
}
|
32
32
|
/* eslint-enable indent */
|
@@ -1,3 +1,4 @@
|
|
1
|
+
// 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.
|
1
2
|
import OpenApiResolver from 'openapi-resolver/dist/openapi-resolver.browser.js';
|
2
3
|
import { marked } from 'marked';
|
3
4
|
import { invalidCharsRegEx } from './common-utils.js';
|
@@ -11,7 +12,7 @@ export default async function ProcessSpec(specUrlOrObject, serverUrl = '') {
|
|
11
12
|
} catch (error) {
|
12
13
|
// eslint-disable-next-line no-console
|
13
14
|
console.error('Error parsing specification', error);
|
14
|
-
throw Error(
|
15
|
+
throw Error(`Failed to resolve the spec: ${error.message}`);
|
15
16
|
}
|
16
17
|
if (!jsonParsedSpec) {
|
17
18
|
throw Error('SpecificationNotFound');
|
@@ -16,6 +16,7 @@ var _tabStyles = _interopRequireDefault(require("./styles/tab-styles.js"));
|
|
16
16
|
var _navStyles = _interopRequireDefault(require("./styles/nav-styles.js"));
|
17
17
|
var _infoStyles = _interopRequireDefault(require("./styles/info-styles.js"));
|
18
18
|
var _advancedSearchStyles = _interopRequireDefault(require("./styles/advanced-search-styles.js"));
|
19
|
+
var _mainBodyStyles = _interopRequireDefault(require("./styles/main-body-styles.js"));
|
19
20
|
var _commonUtils = require("./utils/common-utils.js");
|
20
21
|
var _index = require("./languages/index.js");
|
21
22
|
var _specParser = _interopRequireDefault(require("./utils/spec-parser.js"));
|
@@ -241,7 +242,7 @@ class OpenApiExplorer extends _lit.LitElement {
|
|
241
242
|
};
|
242
243
|
}
|
243
244
|
static finalizeStyles() {
|
244
|
-
return [_fontStyles.default, _schemaStyles.default, _inputStyles.default, _flexStyles.default, _tableStyles.default, _keyFrameStyles.default, _endpointStyles.default, _prismStyles.default, _tabStyles.default, _navStyles.default, _infoStyles.default, _tagInputStyles.default, _advancedSearchStyles.default, _apiRequestStyles.default,
|
245
|
+
return [_fontStyles.default, _schemaStyles.default, _inputStyles.default, _flexStyles.default, _tableStyles.default, _keyFrameStyles.default, _endpointStyles.default, _prismStyles.default, _tabStyles.default, _navStyles.default, _infoStyles.default, _tagInputStyles.default, _advancedSearchStyles.default, _apiRequestStyles.default, _mainBodyStyles.default];
|
245
246
|
}
|
246
247
|
|
247
248
|
// Startup
|
@@ -405,7 +406,7 @@ class OpenApiExplorer extends _lit.LitElement {
|
|
405
406
|
var _spec$info;
|
406
407
|
this.resolvedSpec = null;
|
407
408
|
this.loading = true;
|
408
|
-
this.
|
409
|
+
this.loadingFailedError = null;
|
409
410
|
const spec = await (0, _specParser.default)(specUrlOrObject, this.serverUrl);
|
410
411
|
this.loading = false;
|
411
412
|
if (spec === undefined || spec === null) {
|
@@ -421,7 +422,7 @@ class OpenApiExplorer extends _lit.LitElement {
|
|
421
422
|
this.afterSpecParsedAndValidated(spec);
|
422
423
|
} catch (err) {
|
423
424
|
this.loading = false;
|
424
|
-
this.
|
425
|
+
this.loadingFailedError = err.message;
|
425
426
|
this.resolvedSpec = null;
|
426
427
|
console.error('OpenAPI Explorer: Unable to resolve the API spec..', err); // eslint-disable-line no-console
|
427
428
|
}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
exports.default = void 0;
|
5
|
+
var _lit = require("lit");
|
6
|
+
var _default = exports.default = (0, _lit.css)`:not(:defined){display:none}:host{display:flex;flex-direction:column;width:100%;height:100%;margin:0;padding:0;overflow:hidden;letter-spacing:normal;color:var(--fg);background-color:var(--bg);font-family:var(--font-regular)}.body{display:flex;height:100%;width:100%;overflow:hidden}a{text-decoration:none}.main-content{margin:0;padding:0;display:block;flex:1;height:100%;overflow-y:overlay;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:var(--border-color) transparent}.main-content::-webkit-scrollbar{width:8px;height:8px}.main-content::-webkit-scrollbar-track{background:0 0}.main-content::-webkit-scrollbar-thumb{background-color:var(--border-color)}.section-gap.section-tag{border-bottom:1px solid var(--border-color)}.method-section-gap{margin:0;padding:0 8px 0 4px;border-bottom:1px solid var(--border-color)}.section-gap{padding:24px 0 0}.section-tag-header{position:relative;cursor:n-resize;padding:12px 0}.collapsed .section-tag-header:hover{cursor:s-resize}.section-tag-header:hover{background-image:linear-gradient(to right,rgba(0,0,0,0),var(--border-color),rgba(0,0,0,0))}.collapsed .section-tag-header:hover::after{color:var(--primary-color)}.collapsed .section-tag-body{display:none}.logo{height:36px;width:36px;margin-left:5px}.only-large-screen,.only-large-screen-flex{display:none}.header-title{font-size:calc(var(--font-size-regular) + 8px);padding:0 8px}.tag.title{text-transform:uppercase}.header{background-color:var(--header-bg);color:var(--header-fg);width:100%}input.header-input{background:var(--header-color-darker);color:var(--header-fg);border:1px solid var(--header-color-border);flex:1;padding-right:24px;border-radius:3px}input.header-input::placeholder{opacity:.4}input:disabled{cursor:not-allowed}.loader{margin:16px auto 16px auto;border:4px solid var(--bg3);border-radius:50%;border-top:4px solid var(--primary-color);width:36px;height:36px;animation:spin 2s linear infinite}.expanded-endpoint-body,.expanded-endpoint-component{position:relative;padding:6px 0}.divider{border-top:2px solid var(--border-color);margin:24px 0;width:100%}.security-tooltip{border:1px solid var(--border-color);border-left-width:4px;margin-left:2px}.security-tooltip a{color:var(--fg2);text-decoration:none}.tooltip-text{color:var(--fg2);background-color:var(--bg2);visibility:hidden;overflow-wrap:break-word}.tooltip:hover{color:var(--primary-color);border-color:var(--primary-color)}.tooltip-replace:hover{visibility:hidden}.tooltip:hover a:hover{color:var(--primary-color)}.tooltip:hover .tooltip-text{visibility:visible;cursor:text;opacity:1}@media only screen and (max-width:767.98px){.section-padding{margin:1rem}.sub-title.tag{margin-left:1rem}.section-tag-body .description{margin-left:1rem;margin-right:1rem}}@media only screen and (min-width:768px){.nav-bar{width:260px;display:flex}.only-large-screen{display:block}.only-large-screen-flex{display:flex}.section-gap{padding:24px 24px}.section-gap--read-mode{padding:24px 8px}.section-gap--focused-mode{padding:1.5rem}.endpoint-body{position:relative;padding:36px 0 48px 0}}@media only screen and (min-width:1024px){.nav-bar{width:330px;display:flex}.section-gap--read-mode{padding:24px 24px 12px}.main-content-inner{padding:24px}}`;
|
@@ -30,8 +30,8 @@ function mainBodyTemplate() {
|
|
30
30
|
};
|
31
31
|
|
32
32
|
/* eslint-disable indent */
|
33
|
-
return (0, _lit.html)` ${_theme.default.call(this, newTheme)} ${this.hideSearch ? '' : _advanceSearchTemplate.default.call(this)} <div id="the-main-body" class="body"> ${this.renderStyle === 'focused' && this.resolvedSpec ? _navbarTemplate.default.call(this) : ''} ${this.loading === true ? (0, _lit.html)`<slot name="loader"><div class="loader"></div></slot>` : (0, _lit.html)` <main class="main-content regular-font" part="section-main-content"> <
|
33
|
+
return (0, _lit.html)` ${_theme.default.call(this, newTheme)} ${this.hideSearch ? '' : _advanceSearchTemplate.default.call(this)} <div id="the-main-body" class="body"> ${this.renderStyle === 'focused' && this.resolvedSpec ? _navbarTemplate.default.call(this) : ''} ${this.loading === true ? (0, _lit.html)`<slot name="loader"><div class="loader"></div></slot>` : (0, _lit.html)` <main class="main-content regular-font" part="section-main-content"> <div id="operations-root" class="main-content-inner"> ${this.loadingFailedError ? (0, _lit.html)` <div style="text-align:center;margin:16px"> Unable to load the Spec${this.specUrl ? ': ' : ''} <strong>${this.specUrl}</strong> <br><br> <div> ${this.loadingFailedError} </div> </div>` : (0, _lit.html)` <div class="operations-root" @click="${e => {
|
34
34
|
this.handleHref(e);
|
35
|
-
}}"> ${this.renderStyle === 'focused' ? (0, _lit.html)`${_focusedEndpointTemplate.default.call(this)}` : (0, _lit.html)` ${!this.hideInfo ? _overviewTemplate.default.call(this) : ''} ${!this.hideServerSelection ? _serverTemplate.default.call(this) : ''} ${!this.hideAuthentication ? _securitySchemeTemplate.default.call(this) : ''} <section id="section" class="observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> <slot name="custom-section"></slot> </section> ${_endpointTemplate.default.call(this)}`} </div>
|
35
|
+
}}"> ${this.renderStyle === 'focused' ? (0, _lit.html)`${_focusedEndpointTemplate.default.call(this)}` : (0, _lit.html)` ${!this.hideInfo ? _overviewTemplate.default.call(this) : ''} ${!this.hideServerSelection ? _serverTemplate.default.call(this) : ''} ${!this.hideAuthentication ? _securitySchemeTemplate.default.call(this) : ''} <section id="section" class="observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> <slot name="custom-section"></slot> </section> ${_endpointTemplate.default.call(this)}`} </div>`} </div> </main>`} </div> `;
|
36
36
|
}
|
37
37
|
/* eslint-enable indent */
|
@@ -7,6 +7,8 @@ var _marked = require("marked");
|
|
7
7
|
var _commonUtils = require("./common-utils.js");
|
8
8
|
var _lodash = _interopRequireDefault(require("lodash.clonedeep"));
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10
|
+
// 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
|
+
|
10
12
|
async function ProcessSpec(specUrlOrObject, serverUrl = '') {
|
11
13
|
var _jsonParsedSpec$info, _jsonParsedSpec$compo;
|
12
14
|
const inputSpecIsAUrl = typeof specUrlOrObject === 'string' && specUrlOrObject.match(/^http/) || typeof specUrlOrObject === 'object' && typeof specUrlOrObject.href === 'string';
|
@@ -16,7 +18,7 @@ async function ProcessSpec(specUrlOrObject, serverUrl = '') {
|
|
16
18
|
} catch (error) {
|
17
19
|
// eslint-disable-next-line no-console
|
18
20
|
console.error('Error parsing specification', error);
|
19
|
-
throw Error(
|
21
|
+
throw Error(`Failed to resolve the spec: ${error.message}`);
|
20
22
|
}
|
21
23
|
if (!jsonParsedSpec) {
|
22
24
|
throw Error('SpecificationNotFound');
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "openapi-explorer",
|
3
|
-
"version": "2.1.
|
3
|
+
"version": "2.1.663",
|
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",
|
@@ -62,7 +62,7 @@
|
|
62
62
|
"lodash.merge": "^4.6.2",
|
63
63
|
"marked": "^4.0.16",
|
64
64
|
"openapi-data-validator": "^2.0.40",
|
65
|
-
"openapi-resolver": "^4.1.
|
65
|
+
"openapi-resolver": "^4.1.53",
|
66
66
|
"prismjs": "^1.29.0",
|
67
67
|
"randexp": "^0.5.3",
|
68
68
|
"xml-but-prettier": "^1.0.1"
|