openapi-explorer 0.8.295 → 0.8.298
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/CHANGELOG.md +1 -0
- package/dist/openapi-explorer.min.js +3 -3
- package/dist/openapi-explorer.min.js.LICENSE.txt +1 -1
- package/dist/openapi-explorer.min.js.LICENSE.txt.gz +0 -0
- package/dist/openapi-explorer.min.js.gz +0 -0
- package/dist/report.html +2 -2
- package/package.json +1 -1
- package/src/openapi-explorer.js +21 -32
- package/src/styles/nav-styles.js +1 -2
- package/src/templates/server-template.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-explorer",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.298",
|
|
4
4
|
"description": "OpenAPI Explorer - API viewer with dynamically generated components, documentation, and interaction console",
|
|
5
5
|
"author": "Rhosys Developers <developers@rhosys.ch>",
|
|
6
6
|
"repository": {
|
package/src/openapi-explorer.js
CHANGED
|
@@ -517,6 +517,7 @@ export default class OpenApiExplorer extends LitElement {
|
|
|
517
517
|
if (!this.serverUrl) {
|
|
518
518
|
this.serverUrl = spec.servers[0].computedUrl || spec.servers[0].url;
|
|
519
519
|
}
|
|
520
|
+
this.selectedServer = spec.servers.find((s) => s.url === this.serverUrl || !this.serverUrl) || spec.servers[0];
|
|
520
521
|
this.afterSpecParsedAndValidated(spec);
|
|
521
522
|
} catch (err) {
|
|
522
523
|
this.loading = false;
|
|
@@ -554,30 +555,22 @@ export default class OpenApiExplorer extends LitElement {
|
|
|
554
555
|
this.requestUpdate();
|
|
555
556
|
}
|
|
556
557
|
|
|
557
|
-
|
|
558
|
+
afterSpecParsedAndValidated(spec) {
|
|
558
559
|
this.resolvedSpec = spec;
|
|
559
|
-
|
|
560
|
+
|
|
560
561
|
this.dispatchEvent(new CustomEvent('spec-loaded', { detail: spec }));
|
|
561
562
|
this.requestUpdate();
|
|
562
563
|
|
|
563
564
|
// Initiate IntersectionObserver and put it at the end of event loop, to allow loading all the child elements (must for larger specs)
|
|
564
565
|
this.intersectionObserver.disconnect();
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
this.
|
|
566
|
+
|
|
567
|
+
if (this.renderStyle === 'focused') {
|
|
568
|
+
const defaultElementId = this.showInfo ? 'overview' : this.resolvedSpec.tags && this.resolvedSpec.tags[0] && this.resolvedSpec.tags[0].paths[0];
|
|
569
|
+
this.scrollTo(this.explorerLocation || defaultElementId);
|
|
568
570
|
}
|
|
569
571
|
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
if (locationHash) {
|
|
573
|
-
if (this.renderStyle === 'view') {
|
|
574
|
-
this.expandAndGotoOperation(locationHash);
|
|
575
|
-
} else if (this.renderStyle === 'focused') {
|
|
576
|
-
this.scrollTo(locationHash);
|
|
577
|
-
}
|
|
578
|
-
} else if (this.renderStyle === 'focused') {
|
|
579
|
-
const defaultElementId = this.showInfo ? 'overview' : this.resolvedSpec.tags[0] && this.resolvedSpec.tags[0].paths[0];
|
|
580
|
-
this.scrollTo(defaultElementId);
|
|
572
|
+
if (this.renderStyle === 'view' && this.explorerLocation) {
|
|
573
|
+
this.expandAndGotoOperation(this.explorerLocation);
|
|
581
574
|
}
|
|
582
575
|
}
|
|
583
576
|
|
|
@@ -702,11 +695,9 @@ export default class OpenApiExplorer extends LitElement {
|
|
|
702
695
|
return;
|
|
703
696
|
}
|
|
704
697
|
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
await sleep(0);
|
|
709
|
-
}
|
|
698
|
+
// explorerLocation will get validated in the focused-endpoint-template
|
|
699
|
+
this.explorerLocation = elementId;
|
|
700
|
+
await sleep(0);
|
|
710
701
|
|
|
711
702
|
const contentEl = this.shadowRoot.getElementById(elementId);
|
|
712
703
|
if (!contentEl) {
|
|
@@ -714,22 +705,20 @@ export default class OpenApiExplorer extends LitElement {
|
|
|
714
705
|
}
|
|
715
706
|
|
|
716
707
|
// For focused APIs, always scroll to the top of the component
|
|
717
|
-
if (
|
|
708
|
+
if (!elementId.match('cmp--')) {
|
|
718
709
|
this.shadowRoot.getElementById('operations-root').scrollIntoView({ behavior: 'auto', block: 'start' });
|
|
719
710
|
} else {
|
|
720
711
|
contentEl.scrollIntoView({ behavior: 'auto', block: 'start' });
|
|
721
712
|
}
|
|
722
713
|
|
|
723
714
|
// for focused style it is important to reset request-body-selection and response selection which maintains the state for in case of multiple req-body or multiple response mime-type
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
responseEl.resetSelection();
|
|
732
|
-
}
|
|
715
|
+
const requestEl = this.shadowRoot.querySelector('api-request');
|
|
716
|
+
if (requestEl) {
|
|
717
|
+
requestEl.resetRequestBodySelection();
|
|
718
|
+
}
|
|
719
|
+
const responseEl = this.shadowRoot.querySelector('api-response');
|
|
720
|
+
if (responseEl) {
|
|
721
|
+
responseEl.resetSelection();
|
|
733
722
|
}
|
|
734
723
|
|
|
735
724
|
// Update Location Hash
|
|
@@ -761,7 +750,7 @@ export default class OpenApiExplorer extends LitElement {
|
|
|
761
750
|
node.classList.remove('active');
|
|
762
751
|
});
|
|
763
752
|
newNavEl.classList.add('active'); // must add the class after scrolling
|
|
764
|
-
|
|
753
|
+
this.requestUpdate();
|
|
765
754
|
}
|
|
766
755
|
|
|
767
756
|
// Event handler for Advanced Search text-inputs and checkboxes
|
package/src/styles/nav-styles.js
CHANGED
|
@@ -22,7 +22,6 @@ function onApiServerVarChange(e, serverObj) {
|
|
|
22
22
|
|
|
23
23
|
/* eslint-disable indent */
|
|
24
24
|
function serverVarsTemplate() {
|
|
25
|
-
// const selectedServerObj = this.resolvedSpec.servers.find((v) => (v.url === this.selectedServer));
|
|
26
25
|
return this.selectedServer && this.selectedServer.variables
|
|
27
26
|
? html`
|
|
28
27
|
<div class="table-title"> SERVER VARIABLES</div>
|