(specUrl)
| 726 | |
| 727 | // Public Method |
| 728 | async loadSpec(specUrl) { |
| 729 | if (!specUrl) { |
| 730 | return; |
| 731 | } |
| 732 | this.searchVal = ''; |
| 733 | try { |
| 734 | this.resolvedSpec = { |
| 735 | specLoadError: false, |
| 736 | isSpecLoading: true, |
| 737 | tags: [], |
| 738 | }; |
| 739 | this.loading = true; |
| 740 | this.loadFailed = false; |
| 741 | const spec = await ProcessSpec.call( |
| 742 | this, |
| 743 | specUrl, |
| 744 | this.generateMissingTags === 'true', |
| 745 | this.sortTags === 'true', |
| 746 | this.sortSchemas === 'true', |
| 747 | this.getAttribute('sort-endpoints-by'), |
| 748 | this.getAttribute('api-key-name'), |
| 749 | this.getAttribute('api-key-location'), |
| 750 | this.getAttribute('api-key-value'), |
| 751 | this.getAttribute('server-url'), |
| 752 | this.matchPaths, |
| 753 | this.matchType, |
| 754 | this.removeEndpointsWithBadgeLabelAs, |
| 755 | ); |
| 756 | this.loading = false; |
| 757 | this.afterSpecParsedAndValidated(spec); |
| 758 | } catch (err) { |
| 759 | this.loading = false; |
| 760 | this.loadFailed = true; |
| 761 | this.resolvedSpec = null; |
| 762 | console.error(`RapiDoc: Unable to resolve the API spec.. ${err.message}`); // eslint-disable-line no-console |
| 763 | } |
| 764 | } |
| 765 | |
| 766 | async afterSpecParsedAndValidated(spec) { |
| 767 | this.resolvedSpec = spec; |
no test coverage detected