gpt4 book ai didi

java - 带有 springdoc-openapi-ui 的 swagger-codegen-maven-plugin

转载 作者:行者123 更新时间:2023-12-05 05:08:28 25 4
gpt4 key购买 nike

我想在带有 swagger-codegen-maven-plugin 的生成服务中使用 springdoc-openapi-ui,但是生成的 API 使用了错误的包,它使用 io.swagger.annotations 而不是 io.swagger.v3.oas。注释

我能为此做什么?

import io.swagger.annotations.*;
import ...
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2019-10-07T13:17:04.413+02:00[Europe/Madrid]")
@Api(value = "randomPet", description = "the randomPet API")
public interface RandomPetApi {
...
}
<plugin>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>3.0.11</version>
<executions>
<execution>
<id>generate-swagger-spring-boot</id>
<phase>none</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${swagger-codegen.api.spec}</inputSpec>
<language>spring</language>
<apiPackage>${project.groupId}.web.api</apiPackage>
<modelPackage>${project.groupId}.web.api.model</modelPackage>
<generateApiDocumentation>false</generateApiDocumentation>
<generateModelTests>false</generateModelTests>
<generateModelDocumentation>false</generateModelDocumentation>
<additionalProperties>
<java8>true</java8>
<additionalProperty>jackson=true</additionalProperty>
</additionalProperties>
<library>jersey2</library>
<addCompileSourceRoot>true</addCompileSourceRoot>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<configOptions>
<sourceFolder>.</sourceFolder>
<useBeanValidation>true</useBeanValidation>
<performBeanValidation>true</performBeanValidation>
<dateLibrary>java8</dateLibrary>
<delegatePattern>true</delegatePattern>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>

最佳答案

我有同样的问题导致我阅读文档:https://openapi-generator.tech/docs/plugins

通过在我的 build.gradle 中添加以下行解决了这个问题:

    implementation group: 'io.swagger.parser.v3', name: 'swagger-parser', version: '2.0.20'

希望对大家有帮助...

关于java - 带有 springdoc-openapi-ui 的 swagger-codegen-maven-plugin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58268682/

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