在 Swagger 编辑器中禁用 "Generate Server/Client"
Disable "Generate Server/Client" inside Swagger Editor
每次启动 Swagger Editor 后,javascript api 会向
发送两个 HTTP 请求
呈现导航部分 Generate server
和 Generate clients
。
因为只是内部使用,我不需要生成服务端和客户端的函数
如何禁用两个导航部分的请求和呈现?
index.html
<script src="./dist/swagger-editor-bundle.js"> </script>
<script src="./dist/swagger-editor-standalone-preset.js"> </script>
<script src="./dist/spec.js"> </script>
<script>
window.onload = function() {
const editor = SwaggerEditorBundle({
spec: spec,
dom_id: '#swagger-editor',
layout: 'StandaloneLayout',
presets: [
SwaggerEditorStandalonePreset
]
})
window.editor = editor
}
</script>
将swagger2GeneratorUrl: null
和oas3GeneratorUrl: null
添加到SwaggerEditorBundle
初始化代码中:
const editor = SwaggerEditorBundle({
spec: spec,
dom_id: '#swagger-editor',
layout: 'StandaloneLayout',
presets: [
SwaggerEditorStandalonePreset
],
swagger2GeneratorUrl: null, // <-----
oas3GeneratorUrl: null // <-----
})
每次启动 Swagger Editor 后,javascript api 会向
发送两个 HTTP 请求呈现导航部分 Generate server
和 Generate clients
。
因为只是内部使用,我不需要生成服务端和客户端的函数
如何禁用两个导航部分的请求和呈现?
index.html
<script src="./dist/swagger-editor-bundle.js"> </script>
<script src="./dist/swagger-editor-standalone-preset.js"> </script>
<script src="./dist/spec.js"> </script>
<script>
window.onload = function() {
const editor = SwaggerEditorBundle({
spec: spec,
dom_id: '#swagger-editor',
layout: 'StandaloneLayout',
presets: [
SwaggerEditorStandalonePreset
]
})
window.editor = editor
}
</script>
将swagger2GeneratorUrl: null
和oas3GeneratorUrl: null
添加到SwaggerEditorBundle
初始化代码中:
const editor = SwaggerEditorBundle({
spec: spec,
dom_id: '#swagger-editor',
layout: 'StandaloneLayout',
presets: [
SwaggerEditorStandalonePreset
],
swagger2GeneratorUrl: null, // <-----
oas3GeneratorUrl: null // <-----
})