You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importSwaggerUIfrom“swagger-ui-local”constdefaults={// we have the `dom_id` prop for legacy reasonsdom_id: "#swagger-editor",// eslint-disable-line camelcaselayout: "EditorLayout",presets: [SwaggerUI.presets.apis],plugins: [
...Object.values(plugins),()=>({components: { EditorLayout }}),SwaggerUI.plugins.SafeRender({fullOverride: true,componentList: ["StandaloneLayout","EditorLayout","Topbar","EditorContainer",],})],showExtensions: true,swagger2GeneratorUrl: "https://generator.swagger.io/api/swagger.json",oas3GeneratorUrl: "https://generator3.swagger.io/openapi.json",swagger2ConverterUrl: "https://converter.swagger.io/api/convert",}exportdefaultfunctionSwaggerEditor(options){letmergedOptions=deepMerge(defaults,options)mergedOptions.presets=defaults.presets.concat(options.presets||[])mergedOptions.plugins=defaults.plugins.concat(options.plugins||[])returnSwaggerUI(mergedOptions)}SwaggerEditor.plugins=plugins
Screenshots
How can we help?
I am unable to use a local version of Swagger-UI in place of the npm package swagger-ui with the default configuration. I get this error: TypeError Cannot set properties of undefined (setting 'runtime').
In the console I also see Uncaught TypeError: SwaggerEditorBundle is not a function at window.onload, here is the implementation that error is coming from (this was not changed, it is the default):
window.onload=function(){// Webpack outputs library variables with file-names-like-thiswindow["SwaggerEditorBundle"]=window["SwaggerEditorBundle"]||window["swagger-editor-bundle"]window["SwaggerEditorStandalonePreset"]=window["SwaggerEditorStandalonePreset"]||window["swagger-editor-standalone-preset"]// Build a systemconsteditor=SwaggerEditorBundle({dom_id: '#swagger-editor',layout: 'StandaloneLayout',presets: [SwaggerEditorStandalonePreset],plugins: [SwaggerEditorStandalonePreset.plugins.TopbarNewEditorButton,],queryConfigEnabled: true,})
The text was updated successfully, but these errors were encountered:
Reopening because this is still an issue for the repo generally, even if I'm not dealing with it anymore. I do have a PR now that fixes it though! See above ^^
Q&A (please complete the following information)
npm run build
Content & configuration
src/index.js is unmodified:
Screenshots
How can we help?
I am unable to use a local version of Swagger-UI in place of the npm package
swagger-ui
with the default configuration. I get this error:TypeError Cannot set properties of undefined (setting 'runtime')
.In the console I also see
Uncaught TypeError: SwaggerEditorBundle is not a function at window.onload
, here is the implementation that error is coming from (this was not changed, it is the default):The text was updated successfully, but these errors were encountered: