我正在使用SwaggerUI来记录用Java编写的应用程序的REST API。不幸的是,“试用”功能无法正常工作,因为生成的URL缺少路径的一部分。
设置:
<myHost:port>/myApplication/swagger-ui <-- web fronted of the Swagger UI
<myHost:port>/myApplication/rest/<customRestCall> <-- base URL of the documented REST API
文档是使用Swagger版本3生成的,即Gradle从mvnrepository下载的io.swagger.v3.jaxrs2.integration.resources.OpenApiResource
:
// https://mvnrepository.com/artifact/io.swagger.codegen.v3/swagger-codegen-generators
implementation group: 'io.swagger.codegen.v3', name: 'swagger-codegen-generators', version: '1.0.+'
// https://mvnrepository.com/artifact/io.swagger.core.v3/swagger-jaxrs2
implementation group:'io.swagger.core.v3', name:'swagger-jaxrs2', version:'2.0.+'
// https://mvnrepository.com/artifact/io.swagger.core.v3/swagger-jaxrs2-servlet-initializer
implementation group:'io.swagger.core.v3', name:'swagger-jaxrs2-servlet-initializer', version:'2.0.+'
目前<myHost:port>/<customRestCall>
之后的Swaggers试用功能调用URL。
如何将Java中的文档生成(在myApplication.war中导致)配置为生成/调用<myHost:port>/myApplication/rest/<customRestCall>
呢? ({<myHost:port>
不应是配置的固定路径,因为存在用于测试/集成/生产的不同主机)
感谢您的支持!