diff --git a/src/core/index.js b/src/core/index.js index 8a94c97e..15f0e798 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -92,6 +92,20 @@ module.exports = function SwaggerUI(opts) { }, constructorConfig.initialState) } + if(constructorConfig.initialState) { + // if the user sets a key as `undefined`, that signals to us that we + // should delete the key entirely. + // known usage: Swagger-Editor validate plugin tests + for (var key in constructorConfig.initialState) { + if( + constructorConfig.initialState.hasOwnProperty(key) + && constructorConfig.initialState[key] === undefined + ) { + delete storeConfigs.state[key] + } + } + } + let inlinePlugin = ()=> { return { fn: constructorConfig.fn,