gpt4 book ai didi

java - Microprofile 在构建时生成 Open-Api 文件

转载 作者:行者123 更新时间:2023-12-01 23:23:45 26 4
gpt4 key购买 nike

在使用 Eclipse Microprofile 之前,我们已经通过 io.openapitools.swagger:swagger-maven-plugin 生成了 open-api 文件。该插件依赖于 io.swagger.core.v3:swagger-annotations maven 依赖项。

尽管 Eclipse Microprofile 带有不同的依赖项,但它似乎不足以满足 openapitools 插件的要求,因此生成的 open-api 文件不包含注释中提供的任何描述和其他数据。

您知道如何使用 microprofile 依赖项生成 open-api 定义文件吗?

以下是openapitools swagger插件的配置。

<plugin>
<groupId>io.openapitools.swagger</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>2.1.0</version>
<executions>
<execution>
<id>default</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<inherited>true</inherited>
<configuration>
<useResourcePackagesChildren>true</useResourcePackagesChildren>
<outputDirectory>${project.build.directory}/open-api/</outputDirectory>
<outputFormats>JSON,YAML</outputFormats>
<prettyPrint>false</prettyPrint>

<resourcePackages>
<resourcePackage>...</resourcePackage>
</resourcePackages>
<outputFilename>...</outputFilename>
</configuration>
</execution>
</executions>

最佳答案

到目前为止我发现的唯一的就是 Apache Geronimo 的插件项目创建:Geronimo OpenAPI Maven plugin 。他们的 GitHub 页面上的示例展示了如何使用它。

<plugin>
<groupId>org.apache.geronimo</groupId>
<artifactId>geronimo-openapi-maven-plugin</artifactId>
<version>${openapi.version}</version>
<executions>
<execution>
<id>generate-openapi.json</id>
<goals>
<goal>openapi.json</goal>
</goals>
<configuration>
<application>com.test.MyApp</application>
<endpointClasses>
<endpointClass>com.test.SomeEndpoint</endpointClass>
<endpointClass>com.test.SomeOtherEndpoint</endpointClass>
</endpointClasses>
<info>
<version>1</version>
<title>My Title</title>
<description>Bla Bla</description>
</info>
</configuration>
</execution>
</executions>
</plugin>

不幸的是documentation是比较薄的。根据依赖项列表,看起来它也支持 YAML 格式。

关于java - Microprofile 在构建时生成 Open-Api 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58317084/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com