openapi-explorer 2.1.635 → 2.1.640
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 +26 -3
- package/dist/es/templates/components-template.js +1 -2
- package/dist/es/templates/endpoint-template.js +4 -0
- package/dist/es/templates/navbar-template.js +5 -3
- package/dist/es/utils/schema-utils.js +6 -6
- package/dist/lib/openapi-explorer.js +26 -3
- package/dist/lib/templates/components-template.js +1 -3
- package/dist/lib/templates/endpoint-template.js +6 -0
- package/dist/lib/templates/navbar-template.js +7 -3
- package/dist/lib/utils/schema-utils.js +6 -6
- package/package.json +1 -1
@@ -706,7 +706,7 @@ export default class OpenApiExplorer extends LitElement {
|
|
706
706
|
|
707
707
|
async scrollTo(elementId, scrollNavItemToView = true, repeatedElementIndex) {
|
708
708
|
try {
|
709
|
-
await this.
|
709
|
+
await this.scrollToOrThrowException(elementId, scrollNavItemToView, repeatedElementIndex);
|
710
710
|
} catch (error) {
|
711
711
|
// There's an issue for lit elements for some browsers which are causing this issue we'll log here and still throw
|
712
712
|
console.error('Failed to scroll to target', elementId, scrollNavItemToView, repeatedElementIndex, error); // eslint-disable-line no-console
|
@@ -715,7 +715,7 @@ export default class OpenApiExplorer extends LitElement {
|
|
715
715
|
}
|
716
716
|
}
|
717
717
|
|
718
|
-
async
|
718
|
+
async scrollToOrThrowException(elementId, scrollNavItemToView = true, forcedRepeatedElementIndex) {
|
719
719
|
if (!this.resolvedSpec) {
|
720
720
|
return;
|
721
721
|
}
|
@@ -746,6 +746,7 @@ export default class OpenApiExplorer extends LitElement {
|
|
746
746
|
|
747
747
|
|
748
748
|
let newNavEl;
|
749
|
+
let waitForComponentToExpand = false;
|
749
750
|
const elementIndex = forcedRepeatedElementIndex || forcedRepeatedElementIndex === 0 ? forcedRepeatedElementIndex : Number(elementId.split('--')[1]) - 1;
|
750
751
|
|
751
752
|
if (elementId.match(/^section/)) {
|
@@ -773,6 +774,21 @@ export default class OpenApiExplorer extends LitElement {
|
|
773
774
|
newNavEl = assignedNodes === null || assignedNodes === void 0 ? void 0 : assignedNodes[elementIndex]; // Update Location Hash
|
774
775
|
|
775
776
|
replaceState(`section--${elementIndex + 1}`);
|
777
|
+
} else if (elementId.match('cmp--')) {
|
778
|
+
const component = this.resolvedSpec.components.find(c => c.subComponents.find(sub => elementId.includes(sub.id)));
|
779
|
+
|
780
|
+
if (component && !component.expanded) {
|
781
|
+
waitForComponentToExpand = true;
|
782
|
+
component.expanded = true;
|
783
|
+
}
|
784
|
+
|
785
|
+
contentEl.scrollIntoView({
|
786
|
+
behavior: 'auto',
|
787
|
+
block: 'start'
|
788
|
+
}); // Update Location Hash
|
789
|
+
|
790
|
+
replaceState(elementId);
|
791
|
+
newNavEl = this.shadowRoot.getElementById(`link-${elementId}`);
|
776
792
|
} else if (!elementId.match('cmp--') && !elementId.match('tag--')) {
|
777
793
|
this.shadowRoot.getElementById('operations-root').scrollIntoView({
|
778
794
|
behavior: 'auto',
|
@@ -813,7 +829,14 @@ export default class OpenApiExplorer extends LitElement {
|
|
813
829
|
newNavEl.scrollIntoView({
|
814
830
|
behavior: 'auto',
|
815
831
|
block: 'center'
|
816
|
-
});
|
832
|
+
}); // Also force it into view again if for some reason it isn't there
|
833
|
+
|
834
|
+
if (waitForComponentToExpand) {
|
835
|
+
setTimeout(() => newNavEl.scrollIntoView({
|
836
|
+
behavior: 'auto',
|
837
|
+
block: 'center'
|
838
|
+
}), 600);
|
839
|
+
}
|
817
840
|
}
|
818
841
|
|
819
842
|
await sleep(0);
|
@@ -4,13 +4,12 @@ import { html } from 'lit';
|
|
4
4
|
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
5
5
|
import { marked } from 'marked';
|
6
6
|
import '../components/schema-tree.js';
|
7
|
-
import { replaceState } from '../utils/common-utils.js';
|
8
7
|
|
9
8
|
function componentBodyTemplate(sComponent) {
|
10
9
|
const formdataPartSchema = schemaInObjectNotation(sComponent.component, {
|
11
10
|
includeNulls: this.includeNulls
|
12
11
|
});
|
13
|
-
return html` <div class="expanded-endpoint-component observe-me ${sComponent.name}" id="cmp--${sComponent.id}" @click="${() =>
|
12
|
+
return html` <div class="expanded-endpoint-component observe-me ${sComponent.name}" id="cmp--${sComponent.id}" @click="${() => this.scrollTo(`cmp--${sComponent.id}`)}"> <h2>${sComponent.name}</h2> <div class="mono-font regular-font-size" style="padding:8px 0;color:var(--fg2)"> ${this.displaySchemaAsTable ? html`<schema-table .data="${formdataPartSchema}" schema-expand-level="${this.schemaExpandLevel}" schema-hide-read-only="false" schema-hide-write-only="false"> </schema-table>` : html`<schema-tree .data="${formdataPartSchema}" schema-expand-level="${this.schemaExpandLevel}" schema-hide-read-only="false" schema-hide-write-only="false"> </schema-tree>`} </div> </div> `;
|
14
13
|
}
|
15
14
|
|
16
15
|
export default function componentsTemplate() {
|
@@ -36,6 +36,10 @@ export function expandCollapseAll(currentElement, expand) {
|
|
36
36
|
this.resolvedSpec.tags.forEach(t => t.expanded = expand);
|
37
37
|
this.requestUpdate();
|
38
38
|
}
|
39
|
+
export function expandCollapseComponent(component) {
|
40
|
+
component.expanded = !component.expanded;
|
41
|
+
this.requestUpdate();
|
42
|
+
}
|
39
43
|
/* eslint-disable indent */
|
40
44
|
|
41
45
|
function endpointHeadTemplate(path) {
|
@@ -2,6 +2,7 @@ import { html } from 'lit';
|
|
2
2
|
import { marked } from 'marked';
|
3
3
|
import { componentIsInSearch, pathIsInSearch } from '../utils/common-utils.js';
|
4
4
|
import { getI18nText } from '../languages/index.js';
|
5
|
+
import { expandCollapseComponent } from './endpoint-template.js';
|
5
6
|
|
6
7
|
function onExpandCollapse(tagId) {
|
7
8
|
const tag = this.resolvedSpec.tags.find(t => t.elementId === tagId);
|
@@ -46,8 +47,9 @@ export default function navbarTemplate() {
|
|
46
47
|
onExpandCollapse.call(this, tag.elementId);
|
47
48
|
}}"> <div style="display:flex;justify-content:space-between;width:100%"> <div style="margin-right:.5rem">${tag.name}</div> <div class="toggle">▾</div> </div> </div> `} <div class="nav-bar-section-wrapper"> <div> ${tag.headers.map(header => html` <div class="nav-bar-h${header.depth}" id="link-${tag.elementId}--${new marked.Slugger().slug(header.text)}" data-content-id="${tag.elementId}--${new marked.Slugger().slug(header.text)}" @click="${e => this.scrollToEventTarget(e, false)}"> ${header.text} </div>`)} </div> <div class="nav-bar-paths-under-tag"> ${tag.paths.filter(v => pathIsInSearch(this.matchPaths, v)).map(p => html` <div class="nav-bar-path ${this.usePathInNavBar ? 'small-font' : ''}" data-content-id="${p.elementId}" id="link-${p.elementId}" @click="${e => {
|
48
49
|
this.scrollToEventTarget(e, false);
|
49
|
-
}}"> <span style="${p.deprecated ? 'filter:opacity(0.5)' : ''}"> ${this.usePathInNavBar ? html`<div class="mono-font" style="display:flex;align-items:center"> <div class="method ${p.method}"><span style="line-height:1">${p.method}</span></div> <div style="display:flex;flex-wrap:wrap">${p.path.split('/').filter(t => t.trim()).map(t => html`<span>/${t}</span>`)}</div> </div>` : p.summary || p.shortSummary} ${p.isWebhook ? '(Webhook)' : ''} </span> </div>`)} </div> </div> </div> </slot> `)} ${(_this$resolvedSpec$co = this.resolvedSpec.components) !== null && _this$resolvedSpec$co !== void 0 && _this$resolvedSpec$co.length && !this.hideComponents ? html` <div class="sticky-scroll-element ${this.
|
50
|
-
|
51
|
-
|
50
|
+
}}"> <span style="${p.deprecated ? 'filter:opacity(0.5)' : ''}"> ${this.usePathInNavBar ? html`<div class="mono-font" style="display:flex;align-items:center"> <div class="method ${p.method}"><span style="line-height:1">${p.method}</span></div> <div style="display:flex;flex-wrap:wrap">${p.path.split('/').filter(t => t.trim()).map(t => html`<span>/${t}</span>`)}</div> </div>` : p.summary || p.shortSummary} ${p.isWebhook ? '(Webhook)' : ''} </span> </div>`)} </div> </div> </div> </slot> `)} ${(_this$resolvedSpec$co = this.resolvedSpec.components) !== null && _this$resolvedSpec$co !== void 0 && _this$resolvedSpec$co.length && !this.hideComponents ? html` <div class="sticky-scroll-element"> <div id="link-components" class="nav-bar-section"> <slot name="components-header"> <div class="nav-bar-section-title">${getI18nText('menu.components')}</div> </slot> </div> </div> ${this.resolvedSpec.components.filter(c => c.subComponents.some(s => componentIsInSearch(this.matchPaths, s))).map(component => html` <div class="nav-bar-tag-and-paths ${component.expanded ? '' : 'collapsed'}"> <div class="nav-bar-tag" data-content-id="cmp--${component.name.toLowerCase()}" id="link-cmp--${component.name.toLowerCase()}" @click="${e => {
|
51
|
+
expandCollapseComponent.call(this, component);
|
52
|
+
this.scrollToEventTarget(e, false);
|
53
|
+
}}"> <div> ${component.name} </div> <div style="" part="navbar-components-header-collapse"> <div class="toggle">▾</div> </div> </div> <div class="nav-bar-section-wrapper"> <div class="nav-bar-paths-under-tag"> ${component.subComponents.filter(s => componentIsInSearch(this.matchPaths, s)).map(p => html` <div class="nav-bar-path" data-content-id="cmp--${p.id}" id="link-cmp--${p.id}" @click="${e => this.scrollToEventTarget(e, false)}"> <span> ${p.name} </span> </div>`)} </div> </div> </div>`)}` : ''} </nav>`} </nav> `;
|
52
54
|
}
|
53
55
|
/* eslint-enable indent */
|
@@ -110,12 +110,12 @@ export function getTypeInfo(schema, options = {
|
|
110
110
|
});
|
111
111
|
return info;
|
112
112
|
}
|
113
|
-
export function getSampleValueByType(schemaObj, fallbackPropertyName,
|
113
|
+
export function getSampleValueByType(schemaObj, fallbackPropertyName, skipExampleIds) {
|
114
114
|
var _Object$values$0$valu, _Object$values$, _schemaObj$type;
|
115
115
|
|
116
116
|
const example = Array.isArray(schemaObj.examples) ? schemaObj.examples[0] : (_Object$values$0$valu = (_Object$values$ = Object.values(schemaObj.examples || {})[0]) === null || _Object$values$ === void 0 ? void 0 : _Object$values$.value) !== null && _Object$values$0$valu !== void 0 ? _Object$values$0$valu : schemaObj.example;
|
117
117
|
|
118
|
-
if (
|
118
|
+
if (skipExampleIds && typeof example === 'string' && fallbackPropertyName.match(/id$/i)) {
|
119
119
|
return '';
|
120
120
|
}
|
121
121
|
|
@@ -161,7 +161,7 @@ export function getSampleValueByType(schemaObj, fallbackPropertyName, skipExampl
|
|
161
161
|
return null;
|
162
162
|
}
|
163
163
|
|
164
|
-
if (
|
164
|
+
if (skipExampleIds && typeValue.match(/^string/g) && fallbackPropertyName.match(/id$/i)) {
|
165
165
|
return '';
|
166
166
|
}
|
167
167
|
|
@@ -382,7 +382,7 @@ function getSimpleValueResult(schema, config, namespace, prefix, xmlAttributes,
|
|
382
382
|
return config.xml ? [xmlTagProperties] : objectExamples;
|
383
383
|
}
|
384
384
|
|
385
|
-
const value = getSampleValueByType(schema, config.propertyName, config.
|
385
|
+
const value = getSampleValueByType(schema, config.propertyName, config.skipExampleIds);
|
386
386
|
return [value];
|
387
387
|
}
|
388
388
|
|
@@ -659,7 +659,7 @@ export function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '
|
|
659
659
|
}
|
660
660
|
/* Create Example object */
|
661
661
|
|
662
|
-
export function generateExample(examples, example, schema, rawMimeType, includeReadOnly = true, includeWriteOnly = true, outputType,
|
662
|
+
export function generateExample(examples, example, schema, rawMimeType, includeReadOnly = true, includeWriteOnly = true, outputType, skipExampleIds = false) {
|
663
663
|
const mimeType = rawMimeType || 'application/json';
|
664
664
|
const finalExamples = []; // First check if examples is provided
|
665
665
|
|
@@ -755,7 +755,7 @@ export function generateExample(examples, example, schema, rawMimeType, includeR
|
|
755
755
|
const config = {
|
756
756
|
includeReadOnly,
|
757
757
|
includeWriteOnly,
|
758
|
-
|
758
|
+
skipExampleIds,
|
759
759
|
xml: mimeType.toLowerCase().includes('xml')
|
760
760
|
};
|
761
761
|
const samples = getExampleValuesFromSchema(schema, config);
|
@@ -736,7 +736,7 @@ class OpenApiExplorer extends _lit.LitElement {
|
|
736
736
|
|
737
737
|
async scrollTo(elementId, scrollNavItemToView = true, repeatedElementIndex) {
|
738
738
|
try {
|
739
|
-
await this.
|
739
|
+
await this.scrollToOrThrowException(elementId, scrollNavItemToView, repeatedElementIndex);
|
740
740
|
} catch (error) {
|
741
741
|
// There's an issue for lit elements for some browsers which are causing this issue we'll log here and still throw
|
742
742
|
console.error('Failed to scroll to target', elementId, scrollNavItemToView, repeatedElementIndex, error); // eslint-disable-line no-console
|
@@ -745,7 +745,7 @@ class OpenApiExplorer extends _lit.LitElement {
|
|
745
745
|
}
|
746
746
|
}
|
747
747
|
|
748
|
-
async
|
748
|
+
async scrollToOrThrowException(elementId, scrollNavItemToView = true, forcedRepeatedElementIndex) {
|
749
749
|
if (!this.resolvedSpec) {
|
750
750
|
return;
|
751
751
|
}
|
@@ -776,6 +776,7 @@ class OpenApiExplorer extends _lit.LitElement {
|
|
776
776
|
|
777
777
|
|
778
778
|
let newNavEl;
|
779
|
+
let waitForComponentToExpand = false;
|
779
780
|
const elementIndex = forcedRepeatedElementIndex || forcedRepeatedElementIndex === 0 ? forcedRepeatedElementIndex : Number(elementId.split('--')[1]) - 1;
|
780
781
|
|
781
782
|
if (elementId.match(/^section/)) {
|
@@ -803,6 +804,21 @@ class OpenApiExplorer extends _lit.LitElement {
|
|
803
804
|
newNavEl = assignedNodes === null || assignedNodes === void 0 ? void 0 : assignedNodes[elementIndex]; // Update Location Hash
|
804
805
|
|
805
806
|
(0, _commonUtils.replaceState)(`section--${elementIndex + 1}`);
|
807
|
+
} else if (elementId.match('cmp--')) {
|
808
|
+
const component = this.resolvedSpec.components.find(c => c.subComponents.find(sub => elementId.includes(sub.id)));
|
809
|
+
|
810
|
+
if (component && !component.expanded) {
|
811
|
+
waitForComponentToExpand = true;
|
812
|
+
component.expanded = true;
|
813
|
+
}
|
814
|
+
|
815
|
+
contentEl.scrollIntoView({
|
816
|
+
behavior: 'auto',
|
817
|
+
block: 'start'
|
818
|
+
}); // Update Location Hash
|
819
|
+
|
820
|
+
(0, _commonUtils.replaceState)(elementId);
|
821
|
+
newNavEl = this.shadowRoot.getElementById(`link-${elementId}`);
|
806
822
|
} else if (!elementId.match('cmp--') && !elementId.match('tag--')) {
|
807
823
|
this.shadowRoot.getElementById('operations-root').scrollIntoView({
|
808
824
|
behavior: 'auto',
|
@@ -843,7 +859,14 @@ class OpenApiExplorer extends _lit.LitElement {
|
|
843
859
|
newNavEl.scrollIntoView({
|
844
860
|
behavior: 'auto',
|
845
861
|
block: 'center'
|
846
|
-
});
|
862
|
+
}); // Also force it into view again if for some reason it isn't there
|
863
|
+
|
864
|
+
if (waitForComponentToExpand) {
|
865
|
+
setTimeout(() => newNavEl.scrollIntoView({
|
866
|
+
behavior: 'auto',
|
867
|
+
block: 'center'
|
868
|
+
}), 600);
|
869
|
+
}
|
847
870
|
}
|
848
871
|
|
849
872
|
await (0, _commonUtils.sleep)(0);
|
@@ -13,14 +13,12 @@ var _marked = require("marked");
|
|
13
13
|
|
14
14
|
require("../components/schema-tree.js");
|
15
15
|
|
16
|
-
var _commonUtils = require("../utils/common-utils.js");
|
17
|
-
|
18
16
|
/* eslint-disable no-console */
|
19
17
|
function componentBodyTemplate(sComponent) {
|
20
18
|
const formdataPartSchema = (0, _schemaUtils.schemaInObjectNotation)(sComponent.component, {
|
21
19
|
includeNulls: this.includeNulls
|
22
20
|
});
|
23
|
-
return (0, _lit.html)` <div class="expanded-endpoint-component observe-me ${sComponent.name}" id="cmp--${sComponent.id}" @click="${() =>
|
21
|
+
return (0, _lit.html)` <div class="expanded-endpoint-component observe-me ${sComponent.name}" id="cmp--${sComponent.id}" @click="${() => this.scrollTo(`cmp--${sComponent.id}`)}"> <h2>${sComponent.name}</h2> <div class="mono-font regular-font-size" style="padding:8px 0;color:var(--fg2)"> ${this.displaySchemaAsTable ? (0, _lit.html)`<schema-table .data="${formdataPartSchema}" schema-expand-level="${this.schemaExpandLevel}" schema-hide-read-only="false" schema-hide-write-only="false"> </schema-table>` : (0, _lit.html)`<schema-tree .data="${formdataPartSchema}" schema-expand-level="${this.schemaExpandLevel}" schema-hide-read-only="false" schema-hide-write-only="false"> </schema-tree>`} </div> </div> `;
|
24
22
|
}
|
25
23
|
|
26
24
|
function componentsTemplate() {
|
@@ -3,6 +3,7 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.default = endpointTemplate;
|
5
5
|
exports.expandCollapseAll = expandCollapseAll;
|
6
|
+
exports.expandCollapseComponent = expandCollapseComponent;
|
6
7
|
|
7
8
|
var _lit = require("lit");
|
8
9
|
|
@@ -52,6 +53,11 @@ function expandCollapseAll(currentElement, expand) {
|
|
52
53
|
this.resolvedSpec.tags.forEach(t => t.expanded = expand);
|
53
54
|
this.requestUpdate();
|
54
55
|
}
|
56
|
+
|
57
|
+
function expandCollapseComponent(component) {
|
58
|
+
component.expanded = !component.expanded;
|
59
|
+
this.requestUpdate();
|
60
|
+
}
|
55
61
|
/* eslint-disable indent */
|
56
62
|
|
57
63
|
|
@@ -13,6 +13,8 @@ var _commonUtils = require("../utils/common-utils.js");
|
|
13
13
|
|
14
14
|
var _index = require("../languages/index.js");
|
15
15
|
|
16
|
+
var _endpointTemplate = require("./endpoint-template.js");
|
17
|
+
|
16
18
|
function onExpandCollapse(tagId) {
|
17
19
|
const tag = this.resolvedSpec.tags.find(t => t.elementId === tagId);
|
18
20
|
|
@@ -58,8 +60,10 @@ function navbarTemplate() {
|
|
58
60
|
onExpandCollapse.call(this, tag.elementId);
|
59
61
|
}}"> <div style="display:flex;justify-content:space-between;width:100%"> <div style="margin-right:.5rem">${tag.name}</div> <div class="toggle">▾</div> </div> </div> `} <div class="nav-bar-section-wrapper"> <div> ${tag.headers.map(header => (0, _lit.html)` <div class="nav-bar-h${header.depth}" id="link-${tag.elementId}--${new _marked.marked.Slugger().slug(header.text)}" data-content-id="${tag.elementId}--${new _marked.marked.Slugger().slug(header.text)}" @click="${e => this.scrollToEventTarget(e, false)}"> ${header.text} </div>`)} </div> <div class="nav-bar-paths-under-tag"> ${tag.paths.filter(v => (0, _commonUtils.pathIsInSearch)(this.matchPaths, v)).map(p => (0, _lit.html)` <div class="nav-bar-path ${this.usePathInNavBar ? 'small-font' : ''}" data-content-id="${p.elementId}" id="link-${p.elementId}" @click="${e => {
|
60
62
|
this.scrollToEventTarget(e, false);
|
61
|
-
}}"> <span style="${p.deprecated ? 'filter:opacity(0.5)' : ''}"> ${this.usePathInNavBar ? (0, _lit.html)`<div class="mono-font" style="display:flex;align-items:center"> <div class="method ${p.method}"><span style="line-height:1">${p.method}</span></div> <div style="display:flex;flex-wrap:wrap">${p.path.split('/').filter(t => t.trim()).map(t => (0, _lit.html)`<span>/${t}</span>`)}</div> </div>` : p.summary || p.shortSummary} ${p.isWebhook ? '(Webhook)' : ''} </span> </div>`)} </div> </div> </div> </slot> `)} ${(_this$resolvedSpec$co = this.resolvedSpec.components) !== null && _this$resolvedSpec$co !== void 0 && _this$resolvedSpec$co.length && !this.hideComponents ? (0, _lit.html)` <div class="sticky-scroll-element ${this.
|
62
|
-
|
63
|
-
|
63
|
+
}}"> <span style="${p.deprecated ? 'filter:opacity(0.5)' : ''}"> ${this.usePathInNavBar ? (0, _lit.html)`<div class="mono-font" style="display:flex;align-items:center"> <div class="method ${p.method}"><span style="line-height:1">${p.method}</span></div> <div style="display:flex;flex-wrap:wrap">${p.path.split('/').filter(t => t.trim()).map(t => (0, _lit.html)`<span>/${t}</span>`)}</div> </div>` : p.summary || p.shortSummary} ${p.isWebhook ? '(Webhook)' : ''} </span> </div>`)} </div> </div> </div> </slot> `)} ${(_this$resolvedSpec$co = this.resolvedSpec.components) !== null && _this$resolvedSpec$co !== void 0 && _this$resolvedSpec$co.length && !this.hideComponents ? (0, _lit.html)` <div class="sticky-scroll-element"> <div id="link-components" class="nav-bar-section"> <slot name="components-header"> <div class="nav-bar-section-title">${(0, _index.getI18nText)('menu.components')}</div> </slot> </div> </div> ${this.resolvedSpec.components.filter(c => c.subComponents.some(s => (0, _commonUtils.componentIsInSearch)(this.matchPaths, s))).map(component => (0, _lit.html)` <div class="nav-bar-tag-and-paths ${component.expanded ? '' : 'collapsed'}"> <div class="nav-bar-tag" data-content-id="cmp--${component.name.toLowerCase()}" id="link-cmp--${component.name.toLowerCase()}" @click="${e => {
|
64
|
+
_endpointTemplate.expandCollapseComponent.call(this, component);
|
65
|
+
|
66
|
+
this.scrollToEventTarget(e, false);
|
67
|
+
}}"> <div> ${component.name} </div> <div style="" part="navbar-components-header-collapse"> <div class="toggle">▾</div> </div> </div> <div class="nav-bar-section-wrapper"> <div class="nav-bar-paths-under-tag"> ${component.subComponents.filter(s => (0, _commonUtils.componentIsInSearch)(this.matchPaths, s)).map(p => (0, _lit.html)` <div class="nav-bar-path" data-content-id="cmp--${p.id}" id="link-cmp--${p.id}" @click="${e => this.scrollToEventTarget(e, false)}"> <span> ${p.name} </span> </div>`)} </div> </div> </div>`)}` : ''} </nav>`} </nav> `;
|
64
68
|
}
|
65
69
|
/* eslint-enable indent */
|
@@ -127,12 +127,12 @@ function getTypeInfo(schema, options = {
|
|
127
127
|
return info;
|
128
128
|
}
|
129
129
|
|
130
|
-
function getSampleValueByType(schemaObj, fallbackPropertyName,
|
130
|
+
function getSampleValueByType(schemaObj, fallbackPropertyName, skipExampleIds) {
|
131
131
|
var _Object$values$0$valu, _Object$values$, _schemaObj$type;
|
132
132
|
|
133
133
|
const example = Array.isArray(schemaObj.examples) ? schemaObj.examples[0] : (_Object$values$0$valu = (_Object$values$ = Object.values(schemaObj.examples || {})[0]) === null || _Object$values$ === void 0 ? void 0 : _Object$values$.value) !== null && _Object$values$0$valu !== void 0 ? _Object$values$0$valu : schemaObj.example;
|
134
134
|
|
135
|
-
if (
|
135
|
+
if (skipExampleIds && typeof example === 'string' && fallbackPropertyName.match(/id$/i)) {
|
136
136
|
return '';
|
137
137
|
}
|
138
138
|
|
@@ -178,7 +178,7 @@ function getSampleValueByType(schemaObj, fallbackPropertyName, skipExampleString
|
|
178
178
|
return null;
|
179
179
|
}
|
180
180
|
|
181
|
-
if (
|
181
|
+
if (skipExampleIds && typeValue.match(/^string/g) && fallbackPropertyName.match(/id$/i)) {
|
182
182
|
return '';
|
183
183
|
}
|
184
184
|
|
@@ -400,7 +400,7 @@ function getSimpleValueResult(schema, config, namespace, prefix, xmlAttributes,
|
|
400
400
|
return config.xml ? [xmlTagProperties] : objectExamples;
|
401
401
|
}
|
402
402
|
|
403
|
-
const value = getSampleValueByType(schema, config.propertyName, config.
|
403
|
+
const value = getSampleValueByType(schema, config.propertyName, config.skipExampleIds);
|
404
404
|
return [value];
|
405
405
|
}
|
406
406
|
|
@@ -679,7 +679,7 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
|
|
679
679
|
/* Create Example object */
|
680
680
|
|
681
681
|
|
682
|
-
function generateExample(examples, example, schema, rawMimeType, includeReadOnly = true, includeWriteOnly = true, outputType,
|
682
|
+
function generateExample(examples, example, schema, rawMimeType, includeReadOnly = true, includeWriteOnly = true, outputType, skipExampleIds = false) {
|
683
683
|
const mimeType = rawMimeType || 'application/json';
|
684
684
|
const finalExamples = []; // First check if examples is provided
|
685
685
|
|
@@ -775,7 +775,7 @@ function generateExample(examples, example, schema, rawMimeType, includeReadOnly
|
|
775
775
|
const config = {
|
776
776
|
includeReadOnly,
|
777
777
|
includeWriteOnly,
|
778
|
-
|
778
|
+
skipExampleIds,
|
779
779
|
xml: mimeType.toLowerCase().includes('xml')
|
780
780
|
};
|
781
781
|
const samples = getExampleValuesFromSchema(schema, config);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "openapi-explorer",
|
3
|
-
"version": "2.1.
|
3
|
+
"version": "2.1.640",
|
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",
|