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 11import SwaggerUI from 'swagger-ui-dist/swagger-ui-es-bundle.js' ;
22import 'swagger-ui-dist/swagger-ui.css' ;
33import { parseUrl } from '../utils.js' ;
4- import { load } from " js-yaml" ;
4+ import { load } from ' js-yaml' ;
55
6+ // This code is shared for our own spec as well as user-defined specs via files in repo
67window . addEventListener ( 'load' , async ( ) => {
78 const url = parseUrl ( document . getElementById ( 'swagger-ui' ) . getAttribute ( 'data-source' ) ) ;
89 const res = await fetch ( url . toString ( ) ) ;
910 const text = await res . text ( ) ;
1011 const spec = / \. y a ? m l $ / i. test ( url . pathname ) ? load ( text ) : JSON . parse ( text ) ;
12+ const isOwnSpec = url . pathname . endsWith ( '/swagger.v1.json' ) ;
1113
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 ) {
1515 // Make the page's protocol be at the top of the schemes list
1616 const proto = window . location . protocol . slice ( 0 , - 1 ) ;
1717 spec . schemes . sort ( ( a , b ) => {
@@ -26,7 +26,6 @@ window.addEventListener('load', async () => {
2626 dom_id : '#swagger-ui' ,
2727 deepLinking : true ,
2828 docExpansion : 'none' ,
29- defaultModelRendering : 'model' , // don't show examples by default, because they may be incomplete
3029 presets : [
3130 SwaggerUI . presets . apis
3231 ] ,
You can’t perform that action at this time.
0 commit comments