Clarify variable names for configs

This commit is contained in:
Kyle Shockey
2017-03-19 18:20:14 -07:00
parent b41c92f15a
commit 62be80741e
2 changed files with 14 additions and 14 deletions

2
dist/swagger-ui.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -36,45 +36,45 @@ module.exports = function SwaggerUI(opts) {
store: { }, store: { },
} }
const config = deepExtend({}, defaults, opts) const constructorConfig = deepExtend({}, defaults, opts)
const storeConfigs = deepExtend({}, config.store, { const storeConfigs = deepExtend({}, constructorConfig.store, {
system: { system: {
configs: config.configs configs: constructorConfig.configs
}, },
plugins: config.presets, plugins: constructorConfig.presets,
state: { state: {
layout: { layout: {
layout: config.layout layout: constructorConfig.layout
}, },
spec: { spec: {
spec: "", spec: "",
url: config.url url: constructorConfig.url
} }
} }
}) })
let inlinePlugin = ()=> { let inlinePlugin = ()=> {
return { return {
fn: config.fn, fn: constructorConfig.fn,
components: config.components, components: constructorConfig.components,
state: config.state, state: constructorConfig.state,
} }
} }
var store = new System(storeConfigs) var store = new System(storeConfigs)
store.register([config.plugins, inlinePlugin]) store.register([constructorConfig.plugins, inlinePlugin])
var system = store.getSystem() var system = store.getSystem()
let queryConfig = parseSeach() let queryConfig = parseSeach()
const downloadSpec = (configs) => { const downloadSpec = (configs) => {
if(typeof config !== "object") { if(typeof constructorConfig !== "object") {
return system return system
} }
let localConfig = system.specSelectors.getLocalConfig ? system.specSelectors.getLocalConfig() : {} let localConfig = system.specSelectors.getLocalConfig ? system.specSelectors.getLocalConfig() : {}
let mergedConfig = deepExtend({}, config, localConfig, configs, queryConfig) let mergedConfig = deepExtend({}, constructorConfig, localConfig, queryConfig)
store.setConfigs(filterConfigs(mergedConfig)) store.setConfigs(filterConfigs(mergedConfig))
if(!queryConfig.url && typeof mergedConfig.spec === "object" && Object.keys(mergedConfig.spec).length) { if(!queryConfig.url && typeof mergedConfig.spec === "object" && Object.keys(mergedConfig.spec).length) {
@@ -96,7 +96,7 @@ module.exports = function SwaggerUI(opts) {
} }
if (!system.specActions.getConfigByUrl || system.specActions.getConfigByUrl && !system.specActions.getConfigByUrl(downloadSpec)) { if (!system.specActions.getConfigByUrl || system.specActions.getConfigByUrl && !system.specActions.getConfigByUrl(downloadSpec)) {
return downloadSpec(config) return downloadSpec(constructorConfig)
} }
} }