Skip to content

Commit ee37e30

Browse files
committed
Remove config filtering
1 parent 8bbe706 commit ee37e30

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

src/core/index.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ import System from "core/system"
44
import win from "core/window"
55
import ApisPreset from "core/presets/apis"
66
import * as AllPlugins from "core/plugins/all"
7-
import { parseSeach, filterConfigs } from "core/utils"
8-
9-
const CONFIGS = [ "url", "urls", "urls.primaryName", "spec", "validatorUrl", "onComplete", "onFailure", "authorizations", "docExpansion",
10-
"apisSorter", "operationsSorter", "supportedSubmitMethods", "dom_id", "defaultModelRendering", "oauth2RedirectUrl",
11-
"showRequestHeaders", "custom", "modelPropertyMacro", "parameterMacro", "displayOperationId" , "displayRequestDuration"]
7+
import { parseSearch } from "core/utils"
128

139
// eslint-disable-next-line no-undef
1410
const { GIT_DIRTY, GIT_COMMIT, PACKAGE_VERSION } = buildInfo
@@ -80,7 +76,7 @@ module.exports = function SwaggerUI(opts) {
8076
store.register([constructorConfig.plugins, inlinePlugin])
8177

8278
var system = store.getSystem()
83-
let queryConfig = parseSeach()
79+
let queryConfig = parseSearch()
8480

8581
system.initOAuth = system.authActions.configureAuth
8682

@@ -91,7 +87,7 @@ module.exports = function SwaggerUI(opts) {
9187

9288
let localConfig = system.specSelectors.getLocalConfig ? system.specSelectors.getLocalConfig() : {}
9389
let mergedConfig = deepExtend({}, localConfig, constructorConfig, fetchedConfig || {}, queryConfig)
94-
store.setConfigs(filterConfigs(mergedConfig, CONFIGS))
90+
store.setConfigs(mergedConfig)
9591

9692
if (fetchedConfig !== null) {
9793
if (!queryConfig.url && typeof mergedConfig.spec === "object" && Object.keys(mergedConfig.spec).length) {

src/core/utils.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ export const getSampleSchema = (schema, contentType="", config={}) => {
531531
return JSON.stringify(memoizedSampleFromSchema(schema, config), null, 2)
532532
}
533533

534-
export const parseSeach = () => {
534+
export const parseSearch = () => {
535535
let map = {}
536536
let search = window.location.search
537537

@@ -578,18 +578,6 @@ export const buildFormData = (data) => {
578578
return formArr.join("&")
579579
}
580580

581-
export const filterConfigs = (configs, allowed) => {
582-
let i, filteredConfigs = {}
583-
584-
for (i in configs) {
585-
if (allowed.indexOf(i) !== -1) {
586-
filteredConfigs[i] = configs[i]
587-
}
588-
}
589-
590-
return filteredConfigs
591-
}
592-
593581
// Is this really required as a helper? Perhaps. TODO: expose the system of presets.apis in docs, so we know what is supported
594582
export const shallowEqualKeys = (a,b, keys) => {
595583
return !!find(keys, (key) => {

0 commit comments

Comments
 (0)