openapi-explorer 0.9.346 → 0.9.348

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.
@@ -644,14 +644,23 @@ export default class OpenApiExplorer extends LitElement {
644
644
  return;
645
645
  }
646
646
 
647
- let repeatedElementIndex;
647
+ this.isIntersectionObserverActive = false;
648
+ this.scrollTo(navEl.dataset.contentId, scrollNavItemToView);
649
+ setTimeout(() => {
650
+ this.isIntersectionObserverActive = true;
651
+ }, 300);
652
+ }
648
653
 
649
- if (navEl.dataset.contentId === 'section') {
650
- const navSectionSlot = this.shadowRoot.querySelector('slot.custom-nav-section');
651
- const assignedNodes = navSectionSlot && navSectionSlot.assignedNodes();
652
- repeatedElementIndex = assignedNodes && [].findIndex.call(assignedNodes, slot => slot === event.target);
654
+ scrollToCustomNavSectionTarget(event, scrollNavItemToView = true) {
655
+ const navEl = event.currentTarget;
656
+
657
+ if (!navEl.dataset.contentId) {
658
+ return;
653
659
  }
654
660
 
661
+ const navSectionSlot = this.shadowRoot.querySelector('slot.custom-nav-section');
662
+ const assignedNodes = navSectionSlot === null || navSectionSlot === void 0 ? void 0 : navSectionSlot.assignedNodes();
663
+ const repeatedElementIndex = assignedNodes && [].findIndex.call(assignedNodes, slot => slot === event.target);
655
664
  this.isIntersectionObserverActive = false;
656
665
  this.scrollTo(navEl.dataset.contentId, scrollNavItemToView, repeatedElementIndex);
657
666
  setTimeout(() => {
@@ -674,7 +683,7 @@ export default class OpenApiExplorer extends LitElement {
674
683
  this.explorerLocation = elementId; // Convert to Async and to the background, so that we can be sure that the operation has been expanded and put into view before trying to directly scroll to it (or it won't be found in the next line and even if it is, it might not be able to be scrolled into view)
675
684
 
676
685
  await sleep(0);
677
- const contentEl = this.shadowRoot.getElementById(elementId);
686
+ const contentEl = this.shadowRoot.getElementById(elementId !== null && elementId !== void 0 && elementId.startsWith('section') ? 'section' : elementId);
678
687
 
679
688
  if (!contentEl) {
680
689
  return;
@@ -704,17 +713,21 @@ export default class OpenApiExplorer extends LitElement {
704
713
 
705
714
  if (responseEl) {
706
715
  responseEl.resetSelection();
707
- } // Update Location Hash
716
+ } // Update NavBar View and Styles
708
717
 
709
718
 
710
- replaceState(elementId); // Update NavBar View and Styles
711
-
712
719
  let newNavEl = this.shadowRoot.getElementById(`link-${elementId}`);
713
720
 
714
- if (elementId === 'section') {
721
+ if (elementId !== null && elementId !== void 0 && elementId.startsWith('section')) {
715
722
  const navSectionSlot = this.shadowRoot.querySelector('slot.custom-nav-section');
716
- const assignedNodes = navSectionSlot && navSectionSlot.assignedNodes();
717
- newNavEl = assignedNodes && assignedNodes[repeatedElementIndex || 0];
723
+ const assignedNodes = navSectionSlot === null || navSectionSlot === void 0 ? void 0 : navSectionSlot.assignedNodes();
724
+ const customSectionRepeatedElementIndex = (elementId.replace('section--', '') || 1) - 1;
725
+ newNavEl = assignedNodes === null || assignedNodes === void 0 ? void 0 : assignedNodes[customSectionRepeatedElementIndex || repeatedElementIndex || 0]; // Update Location Hash
726
+
727
+ replaceState(`section--${repeatedElementIndex + 1 || 1}`);
728
+ } else {
729
+ // Update Location Hash
730
+ replaceState(elementId);
718
731
  }
719
732
 
720
733
  if (!newNavEl) {
@@ -736,7 +749,7 @@ export default class OpenApiExplorer extends LitElement {
736
749
  }
737
750
 
738
751
  const navSectionSlot = this.shadowRoot.querySelector('slot.custom-nav-section');
739
- const assignedNodes = navSectionSlot && navSectionSlot.assignedNodes();
752
+ const assignedNodes = navSectionSlot === null || navSectionSlot === void 0 ? void 0 : navSectionSlot.assignedNodes();
740
753
  (assignedNodes || []).filter((n, nodeIndex) => nodeIndex !== repeatedElementIndex).forEach(node => {
741
754
  node.classList.remove('active');
742
755
  });
@@ -45,7 +45,7 @@ export default function focusedEndpointTemplate() {
45
45
  focusedTemplate = securitySchemeTemplate.call(this);
46
46
  } else if (focusElId === 'servers' && this.allowServerSelection === 'true') {
47
47
  focusedTemplate = serverTemplate.call(this);
48
- } else if (focusElId === 'section') {
48
+ } else if (focusElId.startsWith('section')) {
49
49
  focusedTemplate = html` <section id="section" class="observe-me"> <slot name="custom-section"></slot> </section>`;
50
50
  } else if (focusElId.startsWith('cmp--') && !this.hideComponents) {
51
51
  focusedTemplate = componentsTemplate.call(this);
@@ -38,7 +38,7 @@ export function expandCollapseAllComponents() {
38
38
  export default function navbarTemplate() {
39
39
  var _this$resolvedSpec$co;
40
40
 
41
- return html` <nav class="nav-bar ${this.renderStyle}" part="section-navbar"> ${this.allowSearch === 'false' && this.allowAdvancedSearch === 'false' ? '' : html` <div style="display:flex;flex-direction:row;justify-content:center;align-items:center;padding:24px;${this.allowAdvancedSearch === 'false' ? 'border-bottom: 1px solid var(--nav-hover-bg-color)' : ''}"> ${this.allowSearch === 'false' ? '' : html` <div style="display:flex;flex:1;line-height:22px"> <input id="nav-bar-search" part="textbox textbox-nav-filter" style="width:100%;padding-right:20px;color:var(--nav-hover-text-color);border-color:var(--secondary-color);background-color:var(--nav-hover-bg-color)" type="text" placeholder="Filter" @change="${this.onSearchChange}" spellcheck="false"> <div style="margin:6px 5px 0 -24px;font-size:var(--font-size-regular);cursor:pointer">&#x21a9;</div> </div> ${this.matchPaths ? html` <div @click="${this.onClearSearch}" style="margin-left:5px;cursor:pointer;align-self:center;color:var(--nav-text-color)" class="small-font-size primary-text bold-text"> CLEAR </div>` : ''} `} ${this.allowAdvancedSearch === 'false' || this.matchPaths ? '' : html` <button class="m-btn primary" part="btn btn-fill btn-search" style="margin-left:5px" @click="${this.onShowSearchModalClicked}"> Search </button> `} </div> `} ${html`<nav class="nav-scroll" part="navbar-scroll"> ${this.showInfo === 'false' || !this.resolvedSpec.info ? '' : html`<div class="nav-bar-info" id="link-overview" data-content-id="overview" @click="${e => this.scrollToEventTarget(e, false)}"> ${this.isV1 && this.resolvedSpec.info.title || 'Overview'} </div>`} ${this.allowServerSelection === 'false' ? '' : html`<div class="nav-bar-info" id="link-servers" data-content-id="servers" @click="${e => this.scrollToEventTarget(e, false)}"> API Servers </div>`} ${this.allowAuthentication === 'false' || !this.resolvedSpec.securitySchemes ? '' : html`<div class="nav-bar-info" id="link-auth" data-content-id="auth" @click="${e => this.scrollToEventTarget(e, false)}"> Authentication </div>`} <slot name="nav-section" class="custom-nav-section" data-content-id="section" @click="${e => this.scrollToEventTarget(e, false)}"></slot> <div class="sticky-scroll-element"> <div class="nav-bar-section" part="navbar-operations-header"> <slot name="operations-header"> <div class="nav-bar-section-title">OPERATIONS</div> </slot> <div style="" part="navbar-operations-header-collapse"> ${this.resolvedSpec.tags.length > 1 && this.resolvedSpec.tags.some(tag => tag.paths.some(path => pathIsInSearch(this.matchPaths, path))) ? html` ${this.operationsCollapsed ? html`<div @click="${() => {
41
+ return html` <nav class="nav-bar ${this.renderStyle}" part="section-navbar"> ${this.allowSearch === 'false' && this.allowAdvancedSearch === 'false' ? '' : html` <div style="display:flex;flex-direction:row;justify-content:center;align-items:center;padding:24px;${this.allowAdvancedSearch === 'false' ? 'border-bottom: 1px solid var(--nav-hover-bg-color)' : ''}"> ${this.allowSearch === 'false' ? '' : html` <div style="display:flex;flex:1;line-height:22px"> <input id="nav-bar-search" part="textbox textbox-nav-filter" style="width:100%;padding-right:20px;color:var(--nav-hover-text-color);border-color:var(--secondary-color);background-color:var(--nav-hover-bg-color)" type="text" placeholder="Filter" @change="${this.onSearchChange}" spellcheck="false"> <div style="margin:6px 5px 0 -24px;font-size:var(--font-size-regular);cursor:pointer">&#x21a9;</div> </div> ${this.matchPaths ? html` <div @click="${this.onClearSearch}" style="margin-left:5px;cursor:pointer;align-self:center;color:var(--nav-text-color)" class="small-font-size primary-text bold-text"> CLEAR </div>` : ''} `} ${this.allowAdvancedSearch === 'false' || this.matchPaths ? '' : html` <button class="m-btn primary" part="btn btn-fill btn-search" style="margin-left:5px" @click="${this.onShowSearchModalClicked}"> Search </button> `} </div> `} ${html`<nav class="nav-scroll" part="navbar-scroll"> ${this.showInfo === 'false' || !this.resolvedSpec.info ? '' : html`<div class="nav-bar-info" id="link-overview" data-content-id="overview" @click="${e => this.scrollToEventTarget(e, false)}"> ${this.isV1 && this.resolvedSpec.info.title || 'Overview'} </div>`} ${this.allowServerSelection === 'false' ? '' : html`<div class="nav-bar-info" id="link-servers" data-content-id="servers" @click="${e => this.scrollToEventTarget(e, false)}"> API Servers </div>`} ${this.allowAuthentication === 'false' || !this.resolvedSpec.securitySchemes ? '' : html`<div class="nav-bar-info" id="link-auth" data-content-id="auth" @click="${e => this.scrollToEventTarget(e, false)}"> Authentication </div>`} <slot name="nav-section" class="custom-nav-section" data-content-id="section" @click="${e => this.scrollToCustomNavSectionTarget(e, false)}"></slot> <div class="sticky-scroll-element"> <div class="nav-bar-section" part="navbar-operations-header"> <slot name="operations-header"> <div class="nav-bar-section-title">OPERATIONS</div> </slot> <div style="" part="navbar-operations-header-collapse"> ${this.resolvedSpec.tags.length > 1 && this.resolvedSpec.tags.some(tag => tag.paths.some(path => pathIsInSearch(this.matchPaths, path))) ? html` ${this.operationsCollapsed ? html`<div @click="${() => {
42
42
  expandCollapseAll.call(this);
43
43
  }}" style="font-size:16px;transform:rotate(0);cursor:pointer">▸</div>` : html`<div @click="${() => {
44
44
  expandCollapseAll.call(this);
@@ -1,6 +1,7 @@
1
1
  import OpenApiResolver from 'openapi-resolver/dist/openapi-resolver.browser';
2
2
  import { marked } from 'marked';
3
3
  import { invalidCharsRegEx } from './common-utils';
4
+ import cloneDeep from 'lodash.clonedeep';
4
5
  export default async function ProcessSpec(specUrlOrObject, serverUrl = '') {
5
6
  const inputSpecIsAUrl = typeof specUrlOrObject === 'string' && specUrlOrObject.match(/^http/) || typeof specUrlOrObject === 'object' && typeof specUrlOrObject.href === 'string';
6
7
  let jsonParsedSpec;
@@ -237,14 +238,12 @@ function groupByTags(openApiSpec) {
237
238
 
238
239
 
239
240
  for (const pathOrHookName in pathsAndWebhooks) {
240
- const commonParams = pathsAndWebhooks[pathOrHookName].parameters;
241
- const commonPathProp = {
242
- servers: pathsAndWebhooks[pathOrHookName].servers || [],
243
- parameters: pathsAndWebhooks[pathOrHookName].parameters || []
244
- };
241
+ const commonPathPropServers = pathsAndWebhooks[pathOrHookName].servers || [];
245
242
  const isWebhook = pathsAndWebhooks[pathOrHookName]._type === 'webhook'; // eslint-disable-line no-underscore-dangle
246
243
 
247
244
  supportedMethods.forEach(methodName => {
245
+ const commonParams = cloneDeep(pathsAndWebhooks[pathOrHookName].parameters);
246
+
248
247
  if (pathsAndWebhooks[pathOrHookName][methodName]) {
249
248
  const pathOrHookObj = openApiSpec.paths[pathOrHookName][methodName]; // If path.methods are tagged, else generate it from path
250
249
 
@@ -327,7 +326,7 @@ function groupByTags(openApiSpec) {
327
326
  path: pathOrHookName,
328
327
  operationId: pathOrHookObj.operationId,
329
328
  elementId: `${methodName}-${pathOrHookName.replace(invalidCharsRegEx, '-')}`,
330
- servers: pathOrHookObj.servers ? commonPathProp.servers.concat(pathOrHookObj.servers) : commonPathProp.servers,
329
+ servers: pathOrHookObj.servers ? commonPathPropServers.concat(pathOrHookObj.servers) : commonPathPropServers,
331
330
  parameters: finalParameters,
332
331
  requestBody: pathOrHookObj.requestBody,
333
332
  responses: pathOrHookObj.responses,
@@ -681,14 +681,23 @@ class OpenApiExplorer extends _litElement.LitElement {
681
681
  return;
682
682
  }
683
683
 
684
- let repeatedElementIndex;
684
+ this.isIntersectionObserverActive = false;
685
+ this.scrollTo(navEl.dataset.contentId, scrollNavItemToView);
686
+ setTimeout(() => {
687
+ this.isIntersectionObserverActive = true;
688
+ }, 300);
689
+ }
685
690
 
686
- if (navEl.dataset.contentId === 'section') {
687
- const navSectionSlot = this.shadowRoot.querySelector('slot.custom-nav-section');
688
- const assignedNodes = navSectionSlot && navSectionSlot.assignedNodes();
689
- repeatedElementIndex = assignedNodes && [].findIndex.call(assignedNodes, slot => slot === event.target);
691
+ scrollToCustomNavSectionTarget(event, scrollNavItemToView = true) {
692
+ const navEl = event.currentTarget;
693
+
694
+ if (!navEl.dataset.contentId) {
695
+ return;
690
696
  }
691
697
 
698
+ const navSectionSlot = this.shadowRoot.querySelector('slot.custom-nav-section');
699
+ const assignedNodes = navSectionSlot === null || navSectionSlot === void 0 ? void 0 : navSectionSlot.assignedNodes();
700
+ const repeatedElementIndex = assignedNodes && [].findIndex.call(assignedNodes, slot => slot === event.target);
692
701
  this.isIntersectionObserverActive = false;
693
702
  this.scrollTo(navEl.dataset.contentId, scrollNavItemToView, repeatedElementIndex);
694
703
  setTimeout(() => {
@@ -711,7 +720,7 @@ class OpenApiExplorer extends _litElement.LitElement {
711
720
  this.explorerLocation = elementId; // Convert to Async and to the background, so that we can be sure that the operation has been expanded and put into view before trying to directly scroll to it (or it won't be found in the next line and even if it is, it might not be able to be scrolled into view)
712
721
 
713
722
  await (0, _commonUtils.sleep)(0);
714
- const contentEl = this.shadowRoot.getElementById(elementId);
723
+ const contentEl = this.shadowRoot.getElementById(elementId !== null && elementId !== void 0 && elementId.startsWith('section') ? 'section' : elementId);
715
724
 
716
725
  if (!contentEl) {
717
726
  return;
@@ -741,17 +750,21 @@ class OpenApiExplorer extends _litElement.LitElement {
741
750
 
742
751
  if (responseEl) {
743
752
  responseEl.resetSelection();
744
- } // Update Location Hash
753
+ } // Update NavBar View and Styles
745
754
 
746
755
 
747
- (0, _commonUtils.replaceState)(elementId); // Update NavBar View and Styles
748
-
749
756
  let newNavEl = this.shadowRoot.getElementById(`link-${elementId}`);
750
757
 
751
- if (elementId === 'section') {
758
+ if (elementId !== null && elementId !== void 0 && elementId.startsWith('section')) {
752
759
  const navSectionSlot = this.shadowRoot.querySelector('slot.custom-nav-section');
753
- const assignedNodes = navSectionSlot && navSectionSlot.assignedNodes();
754
- newNavEl = assignedNodes && assignedNodes[repeatedElementIndex || 0];
760
+ const assignedNodes = navSectionSlot === null || navSectionSlot === void 0 ? void 0 : navSectionSlot.assignedNodes();
761
+ const customSectionRepeatedElementIndex = (elementId.replace('section--', '') || 1) - 1;
762
+ newNavEl = assignedNodes === null || assignedNodes === void 0 ? void 0 : assignedNodes[customSectionRepeatedElementIndex || repeatedElementIndex || 0]; // Update Location Hash
763
+
764
+ (0, _commonUtils.replaceState)(`section--${repeatedElementIndex + 1 || 1}`);
765
+ } else {
766
+ // Update Location Hash
767
+ (0, _commonUtils.replaceState)(elementId);
755
768
  }
756
769
 
757
770
  if (!newNavEl) {
@@ -773,7 +786,7 @@ class OpenApiExplorer extends _litElement.LitElement {
773
786
  }
774
787
 
775
788
  const navSectionSlot = this.shadowRoot.querySelector('slot.custom-nav-section');
776
- const assignedNodes = navSectionSlot && navSectionSlot.assignedNodes();
789
+ const assignedNodes = navSectionSlot === null || navSectionSlot === void 0 ? void 0 : navSectionSlot.assignedNodes();
777
790
  (assignedNodes || []).filter((n, nodeIndex) => nodeIndex !== repeatedElementIndex).forEach(node => {
778
791
  node.classList.remove('active');
779
792
  });
@@ -59,7 +59,7 @@ function focusedEndpointTemplate() {
59
59
  focusedTemplate = _securitySchemeTemplate.default.call(this);
60
60
  } else if (focusElId === 'servers' && this.allowServerSelection === 'true') {
61
61
  focusedTemplate = _serverTemplate.default.call(this);
62
- } else if (focusElId === 'section') {
62
+ } else if (focusElId.startsWith('section')) {
63
63
  focusedTemplate = (0, _litElement.html)` <section id="section" class="observe-me"> <slot name="custom-section"></slot> </section>`;
64
64
  } else if (focusElId.startsWith('cmp--') && !this.hideComponents) {
65
65
  focusedTemplate = _componentsTemplate.default.call(this);
@@ -48,7 +48,7 @@ function expandCollapseAllComponents() {
48
48
  function navbarTemplate() {
49
49
  var _this$resolvedSpec$co;
50
50
 
51
- return (0, _litElement.html)` <nav class="nav-bar ${this.renderStyle}" part="section-navbar"> ${this.allowSearch === 'false' && this.allowAdvancedSearch === 'false' ? '' : (0, _litElement.html)` <div style="display:flex;flex-direction:row;justify-content:center;align-items:center;padding:24px;${this.allowAdvancedSearch === 'false' ? 'border-bottom: 1px solid var(--nav-hover-bg-color)' : ''}"> ${this.allowSearch === 'false' ? '' : (0, _litElement.html)` <div style="display:flex;flex:1;line-height:22px"> <input id="nav-bar-search" part="textbox textbox-nav-filter" style="width:100%;padding-right:20px;color:var(--nav-hover-text-color);border-color:var(--secondary-color);background-color:var(--nav-hover-bg-color)" type="text" placeholder="Filter" @change="${this.onSearchChange}" spellcheck="false"> <div style="margin:6px 5px 0 -24px;font-size:var(--font-size-regular);cursor:pointer">&#x21a9;</div> </div> ${this.matchPaths ? (0, _litElement.html)` <div @click="${this.onClearSearch}" style="margin-left:5px;cursor:pointer;align-self:center;color:var(--nav-text-color)" class="small-font-size primary-text bold-text"> CLEAR </div>` : ''} `} ${this.allowAdvancedSearch === 'false' || this.matchPaths ? '' : (0, _litElement.html)` <button class="m-btn primary" part="btn btn-fill btn-search" style="margin-left:5px" @click="${this.onShowSearchModalClicked}"> Search </button> `} </div> `} ${(0, _litElement.html)`<nav class="nav-scroll" part="navbar-scroll"> ${this.showInfo === 'false' || !this.resolvedSpec.info ? '' : (0, _litElement.html)`<div class="nav-bar-info" id="link-overview" data-content-id="overview" @click="${e => this.scrollToEventTarget(e, false)}"> ${this.isV1 && this.resolvedSpec.info.title || 'Overview'} </div>`} ${this.allowServerSelection === 'false' ? '' : (0, _litElement.html)`<div class="nav-bar-info" id="link-servers" data-content-id="servers" @click="${e => this.scrollToEventTarget(e, false)}"> API Servers </div>`} ${this.allowAuthentication === 'false' || !this.resolvedSpec.securitySchemes ? '' : (0, _litElement.html)`<div class="nav-bar-info" id="link-auth" data-content-id="auth" @click="${e => this.scrollToEventTarget(e, false)}"> Authentication </div>`} <slot name="nav-section" class="custom-nav-section" data-content-id="section" @click="${e => this.scrollToEventTarget(e, false)}"></slot> <div class="sticky-scroll-element"> <div class="nav-bar-section" part="navbar-operations-header"> <slot name="operations-header"> <div class="nav-bar-section-title">OPERATIONS</div> </slot> <div style="" part="navbar-operations-header-collapse"> ${this.resolvedSpec.tags.length > 1 && this.resolvedSpec.tags.some(tag => tag.paths.some(path => (0, _commonUtils.pathIsInSearch)(this.matchPaths, path))) ? (0, _litElement.html)` ${this.operationsCollapsed ? (0, _litElement.html)`<div @click="${() => {
51
+ return (0, _litElement.html)` <nav class="nav-bar ${this.renderStyle}" part="section-navbar"> ${this.allowSearch === 'false' && this.allowAdvancedSearch === 'false' ? '' : (0, _litElement.html)` <div style="display:flex;flex-direction:row;justify-content:center;align-items:center;padding:24px;${this.allowAdvancedSearch === 'false' ? 'border-bottom: 1px solid var(--nav-hover-bg-color)' : ''}"> ${this.allowSearch === 'false' ? '' : (0, _litElement.html)` <div style="display:flex;flex:1;line-height:22px"> <input id="nav-bar-search" part="textbox textbox-nav-filter" style="width:100%;padding-right:20px;color:var(--nav-hover-text-color);border-color:var(--secondary-color);background-color:var(--nav-hover-bg-color)" type="text" placeholder="Filter" @change="${this.onSearchChange}" spellcheck="false"> <div style="margin:6px 5px 0 -24px;font-size:var(--font-size-regular);cursor:pointer">&#x21a9;</div> </div> ${this.matchPaths ? (0, _litElement.html)` <div @click="${this.onClearSearch}" style="margin-left:5px;cursor:pointer;align-self:center;color:var(--nav-text-color)" class="small-font-size primary-text bold-text"> CLEAR </div>` : ''} `} ${this.allowAdvancedSearch === 'false' || this.matchPaths ? '' : (0, _litElement.html)` <button class="m-btn primary" part="btn btn-fill btn-search" style="margin-left:5px" @click="${this.onShowSearchModalClicked}"> Search </button> `} </div> `} ${(0, _litElement.html)`<nav class="nav-scroll" part="navbar-scroll"> ${this.showInfo === 'false' || !this.resolvedSpec.info ? '' : (0, _litElement.html)`<div class="nav-bar-info" id="link-overview" data-content-id="overview" @click="${e => this.scrollToEventTarget(e, false)}"> ${this.isV1 && this.resolvedSpec.info.title || 'Overview'} </div>`} ${this.allowServerSelection === 'false' ? '' : (0, _litElement.html)`<div class="nav-bar-info" id="link-servers" data-content-id="servers" @click="${e => this.scrollToEventTarget(e, false)}"> API Servers </div>`} ${this.allowAuthentication === 'false' || !this.resolvedSpec.securitySchemes ? '' : (0, _litElement.html)`<div class="nav-bar-info" id="link-auth" data-content-id="auth" @click="${e => this.scrollToEventTarget(e, false)}"> Authentication </div>`} <slot name="nav-section" class="custom-nav-section" data-content-id="section" @click="${e => this.scrollToCustomNavSectionTarget(e, false)}"></slot> <div class="sticky-scroll-element"> <div class="nav-bar-section" part="navbar-operations-header"> <slot name="operations-header"> <div class="nav-bar-section-title">OPERATIONS</div> </slot> <div style="" part="navbar-operations-header-collapse"> ${this.resolvedSpec.tags.length > 1 && this.resolvedSpec.tags.some(tag => tag.paths.some(path => (0, _commonUtils.pathIsInSearch)(this.matchPaths, path))) ? (0, _litElement.html)` ${this.operationsCollapsed ? (0, _litElement.html)`<div @click="${() => {
52
52
  expandCollapseAll.call(this);
53
53
  }}" style="font-size:16px;transform:rotate(0);cursor:pointer">▸</div>` : (0, _litElement.html)`<div @click="${() => {
54
54
  expandCollapseAll.call(this);
@@ -9,6 +9,8 @@ var _marked = require("marked");
9
9
 
10
10
  var _commonUtils = require("./common-utils");
11
11
 
12
+ var _lodash = _interopRequireDefault(require("lodash.clonedeep"));
13
+
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
15
 
14
16
  async function ProcessSpec(specUrlOrObject, serverUrl = '') {
@@ -248,14 +250,12 @@ function groupByTags(openApiSpec) {
248
250
 
249
251
 
250
252
  for (const pathOrHookName in pathsAndWebhooks) {
251
- const commonParams = pathsAndWebhooks[pathOrHookName].parameters;
252
- const commonPathProp = {
253
- servers: pathsAndWebhooks[pathOrHookName].servers || [],
254
- parameters: pathsAndWebhooks[pathOrHookName].parameters || []
255
- };
253
+ const commonPathPropServers = pathsAndWebhooks[pathOrHookName].servers || [];
256
254
  const isWebhook = pathsAndWebhooks[pathOrHookName]._type === 'webhook'; // eslint-disable-line no-underscore-dangle
257
255
 
258
256
  supportedMethods.forEach(methodName => {
257
+ const commonParams = (0, _lodash.default)(pathsAndWebhooks[pathOrHookName].parameters);
258
+
259
259
  if (pathsAndWebhooks[pathOrHookName][methodName]) {
260
260
  const pathOrHookObj = openApiSpec.paths[pathOrHookName][methodName]; // If path.methods are tagged, else generate it from path
261
261
 
@@ -338,7 +338,7 @@ function groupByTags(openApiSpec) {
338
338
  path: pathOrHookName,
339
339
  operationId: pathOrHookObj.operationId,
340
340
  elementId: `${methodName}-${pathOrHookName.replace(_commonUtils.invalidCharsRegEx, '-')}`,
341
- servers: pathOrHookObj.servers ? commonPathProp.servers.concat(pathOrHookObj.servers) : commonPathProp.servers,
341
+ servers: pathOrHookObj.servers ? commonPathPropServers.concat(pathOrHookObj.servers) : commonPathPropServers,
342
342
  parameters: finalParameters,
343
343
  requestBody: pathOrHookObj.requestBody,
344
344
  responses: pathOrHookObj.responses,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-explorer",
3
- "version": "0.9.346",
3
+ "version": "0.9.348",
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": {