Remove config filtering
This commit is contained in:
@@ -4,11 +4,7 @@ import System from "core/system"
|
|||||||
import win from "core/window"
|
import win from "core/window"
|
||||||
import ApisPreset from "core/presets/apis"
|
import ApisPreset from "core/presets/apis"
|
||||||
import * as AllPlugins from "core/plugins/all"
|
import * as AllPlugins from "core/plugins/all"
|
||||||
import { parseSeach, filterConfigs } from "core/utils"
|
import { parseSearch } from "core/utils"
|
||||||
|
|
||||||
const CONFIGS = [ "url", "urls", "urls.primaryName", "spec", "validatorUrl", "onComplete", "onFailure", "authorizations", "docExpansion",
|
|
||||||
"apisSorter", "operationsSorter", "supportedSubmitMethods", "dom_id", "defaultModelRendering", "oauth2RedirectUrl",
|
|
||||||
"showRequestHeaders", "custom", "modelPropertyMacro", "parameterMacro", "displayOperationId" , "displayRequestDuration"]
|
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
const { GIT_DIRTY, GIT_COMMIT, PACKAGE_VERSION } = buildInfo
|
const { GIT_DIRTY, GIT_COMMIT, PACKAGE_VERSION } = buildInfo
|
||||||
@@ -80,7 +76,7 @@ module.exports = function SwaggerUI(opts) {
|
|||||||
store.register([constructorConfig.plugins, inlinePlugin])
|
store.register([constructorConfig.plugins, inlinePlugin])
|
||||||
|
|
||||||
var system = store.getSystem()
|
var system = store.getSystem()
|
||||||
let queryConfig = parseSeach()
|
let queryConfig = parseSearch()
|
||||||
|
|
||||||
system.initOAuth = system.authActions.configureAuth
|
system.initOAuth = system.authActions.configureAuth
|
||||||
|
|
||||||
@@ -91,7 +87,7 @@ module.exports = function SwaggerUI(opts) {
|
|||||||
|
|
||||||
let localConfig = system.specSelectors.getLocalConfig ? system.specSelectors.getLocalConfig() : {}
|
let localConfig = system.specSelectors.getLocalConfig ? system.specSelectors.getLocalConfig() : {}
|
||||||
let mergedConfig = deepExtend({}, localConfig, constructorConfig, fetchedConfig || {}, queryConfig)
|
let mergedConfig = deepExtend({}, localConfig, constructorConfig, fetchedConfig || {}, queryConfig)
|
||||||
store.setConfigs(filterConfigs(mergedConfig, CONFIGS))
|
store.setConfigs(mergedConfig)
|
||||||
|
|
||||||
if (fetchedConfig !== null) {
|
if (fetchedConfig !== null) {
|
||||||
if (!queryConfig.url && typeof mergedConfig.spec === "object" && Object.keys(mergedConfig.spec).length) {
|
if (!queryConfig.url && typeof mergedConfig.spec === "object" && Object.keys(mergedConfig.spec).length) {
|
||||||
|
|||||||
@@ -531,7 +531,7 @@ export const getSampleSchema = (schema, contentType="", config={}) => {
|
|||||||
return JSON.stringify(memoizedSampleFromSchema(schema, config), null, 2)
|
return JSON.stringify(memoizedSampleFromSchema(schema, config), null, 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const parseSeach = () => {
|
export const parseSearch = () => {
|
||||||
let map = {}
|
let map = {}
|
||||||
let search = window.location.search
|
let search = window.location.search
|
||||||
|
|
||||||
@@ -578,18 +578,6 @@ export const buildFormData = (data) => {
|
|||||||
return formArr.join("&")
|
return formArr.join("&")
|
||||||
}
|
}
|
||||||
|
|
||||||
export const filterConfigs = (configs, allowed) => {
|
|
||||||
let i, filteredConfigs = {}
|
|
||||||
|
|
||||||
for (i in configs) {
|
|
||||||
if (allowed.indexOf(i) !== -1) {
|
|
||||||
filteredConfigs[i] = configs[i]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return filteredConfigs
|
|
||||||
}
|
|
||||||
|
|
||||||
// Is this really required as a helper? Perhaps. TODO: expose the system of presets.apis in docs, so we know what is supported
|
// Is this really required as a helper? Perhaps. TODO: expose the system of presets.apis in docs, so we know what is supported
|
||||||
export const shallowEqualKeys = (a,b, keys) => {
|
export const shallowEqualKeys = (a,b, keys) => {
|
||||||
return !!find(keys, (key) => {
|
return !!find(keys, (key) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user