File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -6,13 +6,17 @@ window.addEventListener('load', async () => {
6
6
const res = await fetch ( url ) ;
7
7
const spec = await res . json ( ) ;
8
8
9
- // Make the page's protocol be at the top of the schemes list
10
- const proto = window . location . protocol . slice ( 0 , - 1 ) ;
11
- spec . schemes . sort ( ( a , b ) => {
12
- if ( a === proto ) return - 1 ;
13
- if ( b === proto ) return 1 ;
14
- return 0 ;
15
- } ) ;
9
+ // This code is shared for our own spec as well as user-defined specs, this
10
+ // section is for our own spec
11
+ if ( url . endsWith ( '/swagger.v1.json' ) ) {
12
+ // Make the page's protocol be at the top of the schemes list
13
+ const proto = window . location . protocol . slice ( 0 , - 1 ) ;
14
+ spec . schemes . sort ( ( a , b ) => {
15
+ if ( a === proto ) return - 1 ;
16
+ if ( b === proto ) return 1 ;
17
+ return 0 ;
18
+ } ) ;
19
+ }
16
20
17
21
const ui = SwaggerUI ( {
18
22
spec,
You can’t perform that action at this time.
0 commit comments