TomEE 8.0.4 和 OpenApi 扩展的奇怪问题 (Swagger-UI 1.0.3)
Strange issue with TomEE 8.0.4 and OpenApi extension (Swagger-UI 1.0.3)
我正在使用 TomEE microprofile 并以这种方式定义我的其余应用程序路径:
@ApplicationPath("api")
public class RestConfiguration extends Application {
}
部署应用程序时,tomee 日志显示对生成的前端资源的访问url:
Service URI: http://localhost:8080/api/openapi-ui/
访问 url 时在 swagger-ui 网页中收到此消息:
Fetch error undefined /openapi
如果我将应用程序路径更改为空:
@ApplicationPath("")
然后一切正常,swagger 显示所有服务方法定义。
那么,我应该怎么做才能将“api”添加到 ApplicationPath 注释?
尝试使用“/api”,但也不行。
我这里是用Tomee-8.0.4测试的,按照配置,假设你用的是JAR。
在你的pom.xml中使用依赖项:
<dependency>
<groupId>org.microprofile-ext.openapi-ext</groupId>
<artifactId>openapi-ui</artifactId>
<version>1.1.3</version>
</dependency>
<build>
<finalName>tomee-demo</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomee.maven</groupId>
<artifactId>tomee-maven-plugin</artifactId>
<version>${tomee.version}</version>
<executions>
<execution>
<id>executable-jar</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<context>ROOT</context>
<tomeeClassifier>microprofile</tomeeClassifier>
</configuration>
</plugin>
</plugins>
</build>
在microprofile-config.properties中使用:
mp.openapi.servers=http://localhost:8080/api
openapi.ui.yamlUrl=/api/openapi
openapi.ui.serverVisibility=visible
又 运行 你的项目。
test performed
参考:
https://github.com/microprofile-extensions/openapi-ext/tree/master/openapi-ui
我正在使用 TomEE microprofile 并以这种方式定义我的其余应用程序路径:
@ApplicationPath("api")
public class RestConfiguration extends Application {
}
部署应用程序时,tomee 日志显示对生成的前端资源的访问url:
Service URI: http://localhost:8080/api/openapi-ui/
访问 url 时在 swagger-ui 网页中收到此消息:
Fetch error undefined /openapi
如果我将应用程序路径更改为空:
@ApplicationPath("")
然后一切正常,swagger 显示所有服务方法定义。
那么,我应该怎么做才能将“api”添加到 ApplicationPath 注释?
尝试使用“/api”,但也不行。
我这里是用Tomee-8.0.4测试的,按照配置,假设你用的是JAR。
在你的pom.xml中使用依赖项:
<dependency>
<groupId>org.microprofile-ext.openapi-ext</groupId>
<artifactId>openapi-ui</artifactId>
<version>1.1.3</version>
</dependency>
<build>
<finalName>tomee-demo</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomee.maven</groupId>
<artifactId>tomee-maven-plugin</artifactId>
<version>${tomee.version}</version>
<executions>
<execution>
<id>executable-jar</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<context>ROOT</context>
<tomeeClassifier>microprofile</tomeeClassifier>
</configuration>
</plugin>
</plugins>
</build>
在microprofile-config.properties中使用:
mp.openapi.servers=http://localhost:8080/api
openapi.ui.yamlUrl=/api/openapi
openapi.ui.serverVisibility=visible
又 运行 你的项目。
test performed
参考: https://github.com/microprofile-extensions/openapi-ext/tree/master/openapi-ui