File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 1
1
import SwaggerUI from 'swagger-ui-dist/swagger-ui-es-bundle.js' ;
2
2
import 'swagger-ui-dist/swagger-ui.css' ;
3
3
import { parseUrl } from '../utils.js' ;
4
- import { load } from " js-yaml" ;
4
+ import { load } from ' js-yaml' ;
5
5
6
+ // This code is shared for our own spec as well as user-defined specs via files in repo
6
7
window . addEventListener ( 'load' , async ( ) => {
7
8
const url = parseUrl ( document . getElementById ( 'swagger-ui' ) . getAttribute ( 'data-source' ) ) ;
8
9
const res = await fetch ( url . toString ( ) ) ;
9
10
const text = await res . text ( ) ;
10
11
const spec = / \. y a ? m l $ / i. test ( url . pathname ) ? load ( text ) : JSON . parse ( text ) ;
12
+ const isOwnSpec = url . pathname . endsWith ( '/swagger.v1.json' ) ;
11
13
12
- // This code is shared for our own spec as well as user-defined specs, this
13
- // section is for our own spec
14
- if ( url . pathname . endsWith ( '/swagger.v1.json' ) ) {
14
+ if ( isOwnSpec ) {
15
15
// Make the page's protocol be at the top of the schemes list
16
16
const proto = window . location . protocol . slice ( 0 , - 1 ) ;
17
17
spec . schemes . sort ( ( a , b ) => {
@@ -26,7 +26,6 @@ window.addEventListener('load', async () => {
26
26
dom_id : '#swagger-ui' ,
27
27
deepLinking : true ,
28
28
docExpansion : 'none' ,
29
- defaultModelRendering : 'model' , // don't show examples by default, because they may be incomplete
30
29
presets : [
31
30
SwaggerUI . presets . apis
32
31
] ,
You can’t perform that action at this time.
0 commit comments