@@ -9,6 +9,7 @@ const defaultOptions = Object.freeze({
|
||||
spec: {},
|
||||
url: "",
|
||||
urls: null,
|
||||
configUrl: null,
|
||||
layout: "BaseLayout",
|
||||
docExpansion: "list",
|
||||
maxDisplayedTags: -1,
|
||||
|
||||
@@ -13,7 +13,10 @@ const optionsFromQuery = () => (options) => {
|
||||
const urlSearchParams = options.queryConfigEnabled ? parseSearch() : {}
|
||||
|
||||
return Object.entries(urlSearchParams).reduce((acc, [key, value]) => {
|
||||
if (key === "urls.primaryName") {
|
||||
// TODO(oliwia.rogala@smartbear.com): drop support for `config` in the next major release
|
||||
if (key === "config") {
|
||||
acc["configUrl"] = value
|
||||
} else if (key === "urls.primaryName") {
|
||||
acc[key] = value
|
||||
} else {
|
||||
acc = set(acc, key, value)
|
||||
|
||||
@@ -15,7 +15,7 @@ import undefinedStringTypeCaster from "./type-casters/undefined-string"
|
||||
import defaultOptions from "../defaults"
|
||||
|
||||
const typeCasters = {
|
||||
configUrl: { typeCaster: stringTypeCaster },
|
||||
configUrl: { typeCaster: nullableStringTypeCaster },
|
||||
deepLinking: {
|
||||
typeCaster: booleanTypeCaster,
|
||||
defaultValue: defaultOptions.deepLinking,
|
||||
|
||||
@@ -51,10 +51,9 @@ export default function SwaggerUI(userOptions) {
|
||||
store.register([mergedOptions.plugins, InlinePlugin])
|
||||
const system = store.getSystem()
|
||||
|
||||
const configURL = queryOptions.config ?? mergedOptions.configUrl
|
||||
const systemOptions = optionsFromSystem({ system })(mergedOptions)
|
||||
|
||||
optionsFromURL({ url: configURL, system })(mergedOptions)
|
||||
optionsFromURL({ url: mergedOptions.configUrl, system })(mergedOptions)
|
||||
.then((urlOptions) => {
|
||||
const urlOptionsFailedToFetch = urlOptions === null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user