From dcd9983ce862bfbea3c82e3727895c9b3bfa822a Mon Sep 17 00:00:00 2001
From: Roman Hotsiy
+ Download OpenAPI (fka Swagger) specification: + Download +
diff --git a/lib/components/ApiInfo/api-info.js b/lib/components/ApiInfo/api-info.js index d179dae9..8fd9391c 100644 --- a/lib/components/ApiInfo/api-info.js +++ b/lib/components/ApiInfo/api-info.js @@ -1,18 +1,22 @@ 'use strict'; -import {RedocComponent, BaseComponent} from '../base'; +import {SchemaManager, RedocComponent, BaseComponent} from '../base'; +import OptionsManager from '../../options'; @RedocComponent({ selector: 'api-info', styleUrls: ['./lib/components/ApiInfo/api-info.css'], templateUrl: './lib/components/ApiInfo/api-info.html' }) +@Reflect.metadata('parameters', [[SchemaManager], [OptionsManager]]) export default class ApiInfo extends BaseComponent { - constructor(schemaMgr) { + constructor(schemaMgr, optionsMgr) { super(schemaMgr); + this.optionsMgr = optionsMgr; } prepareModel() { this.data = this.componentSchema.info; + this.specUrl = this.optionsMgr.options.specUrl; } } diff --git a/lib/components/Redoc/redoc.js b/lib/components/Redoc/redoc.js index 4faa1353..e1bceb4b 100644 --- a/lib/components/Redoc/redoc.js +++ b/lib/components/Redoc/redoc.js @@ -57,9 +57,10 @@ export default class Redoc extends BaseComponent { }, 400); } - static init(schemaUrl, options) { + static init(specUrl, options) { var optionsMgr = new OptionsManager(); optionsMgr.options = options; + optionsMgr.options.specUrl = optionsMgr.options.specUrl || specUrl; var providers = [ provide(OptionsManager, {useValue: optionsMgr}) ]; @@ -68,7 +69,7 @@ export default class Redoc extends BaseComponent { Redoc.dispose(); } Redoc.showLoadingAnimation(); - return SchemaManager.instance().load(schemaUrl) + return SchemaManager.instance().load(specUrl) .then(() => { if (!_modeLocked && !optionsMgr.options.debugMode) { enableProdMode(); diff --git a/lib/options.js b/lib/options.js index 689310a5..d708b86c 100644 --- a/lib/options.js +++ b/lib/options.js @@ -10,7 +10,7 @@ var defaults = { debugMode: global.redocDebugMode }; -var OPTION_NAMES = new Set(['scrollYOffset', 'disableLazySchemas']); +var OPTION_NAMES = new Set(['scrollYOffset', 'disableLazySchemas', 'specUrl']); @Reflect.metadata('parameters', [[BrowserDomAdapter]]) export default class OptionsManager { From d141f675592494855c8052f79d3500c7ddd291ce Mon Sep 17 00:00:00 2001 From: Roman HotsiyG)lcnm%@+5J{DNH}240j)14m-0lFPMc G)lcnm%@+5J{DNH}240j)14m-0lFPMcps^GH>Uu*Tx}
zCbQ@Jg+(gr*Nm0T8n
z>jl=26`I{=JHw034pcEQF$Aa}M@Pq0VLu@hd=}&Tt0N|z*81teen9;Hc5I1V#wDye
z?~f+z0RZ>()?485Vw&kwZGl*|jE)ZJ;aug`-C=c{W_CIdifSPD22V|EG&_?Y3ChY`
zTkCKrXlX;++XWI56C+|``u3f#QhxelT`;*5GgLk%M7DNF|F*(*r!Md_`G`XW1sCkT
z#bc+JO=-^AS-rKv!$K>SVFly#`HP4SHe!X~2r(X9D{IvSjcj}8G0XTCnd833jKy$t
za`O1shcBkG7sI_a==XGps^GH>Uu*Tx}
zCbQ@Jg+(gr*N