Swagger UI-无法为请求正文启用JSON编辑器

问题描述:

我有一些问题要解决, 根据下面的链接,请求正文的JSON编辑器(默认情况下处于禁用状态).

I have some issue to make it work, according to following link below, the JSON editor for the request body (disabled by default).

https://github.com/jensoleg/swagger-ui

如何启用它?

我找到了解决方案.将以下内容添加到new SwaggerUi({})构造函数中的index.html中:

I found the solution. Add the following into index.html in the new SwaggerUi({}) constructor:

docExpansion: "none",
sorter: "alpha",
jsonEditor: true,
defaultModelRendering: 'schema',
showRequestHeaders: true