我正在使用SpringDoc 1.4.3招摇。
我添加了以下配置以禁用中的petstoreURLapplication.yml
配置
springdoc:
swagger-ui:
disable-swagger-default-url: true
tags-sorter: alpha
operations-sorter: alpha
doc-expansion: none
Run Code Online (Sandbox Code Playgroud)
但是当我在探索文本框中点击https://petstore.swagger.io/v2/swagger.json时,它仍然显示如下图所示的 petsore URL。
招摇形象
swagger-ui openapi springdoc springdoc-ui springdoc-openapi-ui
我正在尝试创建springdocswagger 文档,并且我想Map<String, Object>以更好的客户端可读方式表示具有数据类型的请求正文。但是当我声明@io.swagger.v3.oas.annotations.parameters.RequestBody(content = @Content(schema = @Schema(implementation = Map.class)架构如下String(附有下面的屏幕截图)
方法声明
@Operation(security = {@SecurityRequirement(name = "bearer-key")}, summary = "Create Data", operationId = "createData", description = "Create createData for the **`type`**. ")
@ApiResponses(value = {
@ApiResponse(responseCode = "201", description = "Data created", content = @Content(schema = @Schema(implementation = Map.class),
examples = {@ExampleObject(value = "{\n" +
" \"id\": \"927d810c-3ac5-4584-ba58-7c11befabf54\",\n" +
"}")})),
@ApiResponse(responseCode = "400", description = "BAD Request")})
@PostMapping(value = "/data/type", produces = APPLICATION_JSON_VALUE, consumes …Run Code Online (Sandbox Code Playgroud) 尝试在 Spring Cloud 网关级别为我的微服务实现 spring 文档。
遇到了这两个依赖项。想知道有什么区别
"springdoc-openapi-ui" vs "springdoc-openapi-webmvc-core"
Run Code Online (Sandbox Code Playgroud)
和
"springdoc-openapi-ui" vs "springdoc-openapi-ui"
Run Code Online (Sandbox Code Playgroud)
更喜欢哪个依赖项?
我springdoc-openapi-ui在一个简单的 spring-boot 项目中使用1.4.0 版本(通过 Maven)中的 Java 库,没有任何自定义。
Swagger 页面在https://my-url.com/my-context-path/swagger-ui/index.html下生成
和https://my-url.com/my-context-path/v3/api-docs/下的 api-docs
这两个都有效,我可以联系到他们。到现在为止还挺好!
当简单地导航到https://my-url.com/my-context-path/swagger-ui.html 时,我得到一个 HTTP 状态 302 和一个location在响应头中设置的属性,它应该将我重定向到 swagger 页面从上面(我假设)。
但是,location属性中的 URL缺少上下文路径!它看起来像这样:https :
//my-url.com/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config
它重定向到一个不存在的页面,我收到 404 错误代码。请注意,configUrl 似乎也缺少上下文路径。
任何想法为什么会发生这种情况以及如何解决?
这个 Github 问题似乎是同样的问题,但最后声明问题已解决:https : //github.com/springdoc/springdoc-openapi/issues/37,这是针对比我更早的版本。
swagger swagger-ui springdoc springdoc-ui springdoc-openapi-ui
我想对Schemas为我的实体类生成的 DTO 类进行排序Springdoc ui。
我能够对文件中的tags和operations进行以下配置,yml但我的模式不是按排序顺序排列的。
springdoc:
swagger-ui:
disable-swagger-default-url: true
tags-sorter: alpha
operations-sorter: alpha
doc-expansion: none
Run Code Online (Sandbox Code Playgroud)
我怎样才能对我的模式进行排序。
谢谢。
网络上没有关于如何使用 springdocs-openapi 库 (1.5.7) 获取以下输出的好示例。我希望获得以下输出:
[
"A", "B", "C"
]
Run Code Online (Sandbox Code Playgroud)
这是基于所提供示例的代码。
@Operation(summary = "")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "OK",
content = {@Content(mediaType = "application/json",
array = @ArraySchema(schema = @Schema(implementation = String.class)),
examples = {@ExampleObject("A"), @ExampleObject("B"), @ExampleObject("C")}
)})
Run Code Online (Sandbox Code Playgroud)
这会产生以下输出
[
"string"
]
Run Code Online (Sandbox Code Playgroud)
上面列出的输出 ["A","B","C"] 如何通过 springdocs-openapi 库实现?
spring-boot springdoc springdoc-ui springdoc-openui springdoc-openapi-ui
我有一个 Spring Boot 2.7.6 应用程序,Spring Security 5.7.5 运行没有问题:身份验证有效,我根据角色浏览不同的页面,Swagger UI 可用等。我没有针对您的不推荐使用的警告信息。
\n我迁移到 Spring Boot 3.0.0,因此迁移到 Spring Security 6.0.0。我按照迁移指南进行操作,服务器启动没有错误。但我的网址不再有效。我的状态是 401。
\n问题#1:GET http://localhost:8080/swagger-ui/index.html导致客户端出现 401 错误。
在日志中我有一个 404:
\nDEBUG o.s.web.servlet.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler [classpath [static/]]\nDEBUG o.s.web.servlet.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler [classpath [static/]]\nDEBUG o.s.web.servlet.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler [classpath [static/]]\nDEBUG o.s.web.servlet.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler [classpath [static/]]\nDEBUG org.springframework.web.servlet.DispatcherServlet : GET "/swagger-ui/index.html", parameters={}\nDEBUG o.s.web.servlet.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler [classpath [static/]]\nDEBUG o.s.w.servlet.resource.ResourceHttpRequestHandler : Resource not found\nDEBUG org.springframework.web.servlet.DispatcherServlet : Completed 404 …Run Code Online (Sandbox Code Playgroud) 我正在研究Spring Boot v2.2.2.RELEASE and SpringDoc UI and Open API Specification OAS3,我在这里发现了非常相关的问题:https ://github.com/springdoc/springdoc-openapi/issues/201 。
我有 4 个配置文件,分别是 Dev、Stage、UAT 和 Prod,并表示我有 Student API、Employee API 和 Department API。
我想要 UAT 和 Prod 配置文件,我想隐藏 Department API。怎能不呢?
springdoc-ui ×8
springdoc ×6
spring-boot ×4
swagger-ui ×3
swagger ×2
java ×1
migration ×1
openapi ×1