OpenAPI Codegen-Maven-Plugin在生成方法中消除了使用后缀
我正在尝试使用openapi codegen-maven-plugin从yaml文件生成
ResponseEntity<ApicatControl> retrieveRepeatedProductOfferingUsingGET(
@Parameter(name = "category.id", description = "category.id", schema = @Schema(description = "")) @Valid @RequestParam(value = "category.id", required = false) String categoryId,
@Parameter(name = "type", description = "type", schema = @Schema(description = "")) @Valid @RequestParam(value = "type", required = false) String type
);
接口pom.xml。
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>5.4.0</version>
<executions>
<execution>
<id>openapi-codegen-java-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/swagger/swagger.yaml</inputSpec>
<generatorName>spring</generatorName>
<generateApiTests>false</generateApiTests>
<modelPackage>com.groupe.apicat.gu.api.resources.model</modelPackage>
<apiPackage>com.groupe.apicat.gu.api</apiPackage>
<output>${generated-sources-path}</output>
<templateDirectory>src/templates/service</templateDirectory>
<generateSupportingFiles>false</generateSupportingFiles>
<generateModels>true</generateModels>
<configOptions>
<skipDefaultInterface>true</skipDefaultInterface>
<interfaceOnly>true</interfaceOnly>
<sourceFolder>generated-sources</sourceFolder>
<dateLibrary>legacy</dateLibrary>
<returnResponse>true</returnResponse>
<library>spring-boot</library>
<useTags>true</useTags>
<hideGenerationTimestamp>true</hideGenerationTimestamp>
<useSwaggerAnnotations>true</useSwaggerAnnotations>
<serializableModel>true</serializableModel>
<delegatePattern>false</delegatePattern>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
请您有任何解决方案!谢谢
I'm trying to generate interfaces from yaml file with openapi codegen-maven-plugin every thing is good except the generated methods having the suffix UsingGET as you can see in this exemple bellow :
ResponseEntity<ApicatControl> retrieveRepeatedProductOfferingUsingGET(
@Parameter(name = "category.id", description = "category.id", schema = @Schema(description = "")) @Valid @RequestParam(value = "category.id", required = false) String categoryId,
@Parameter(name = "type", description = "type", schema = @Schema(description = "")) @Valid @RequestParam(value = "type", required = false) String type
);
And this is my configuration for codegen-maven-plugin within pom.xml.
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>5.4.0</version>
<executions>
<execution>
<id>openapi-codegen-java-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/swagger/swagger.yaml</inputSpec>
<generatorName>spring</generatorName>
<generateApiTests>false</generateApiTests>
<modelPackage>com.groupe.apicat.gu.api.resources.model</modelPackage>
<apiPackage>com.groupe.apicat.gu.api</apiPackage>
<output>${generated-sources-path}</output>
<templateDirectory>src/templates/service</templateDirectory>
<generateSupportingFiles>false</generateSupportingFiles>
<generateModels>true</generateModels>
<configOptions>
<skipDefaultInterface>true</skipDefaultInterface>
<interfaceOnly>true</interfaceOnly>
<sourceFolder>generated-sources</sourceFolder>
<dateLibrary>legacy</dateLibrary>
<returnResponse>true</returnResponse>
<library>spring-boot</library>
<useTags>true</useTags>
<hideGenerationTimestamp>true</hideGenerationTimestamp>
<useSwaggerAnnotations>true</useSwaggerAnnotations>
<serializableModel>true</serializableModel>
<delegatePattern>false</delegatePattern>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
Please do you have any solutions!! thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
方法名称“ retrieverePeatedProductoductingUsingsget”是在您的Swagger.yaml中创建的。您应该有一个称为“ aperipID”的参数,您可以在其中指定此名称。因此,只需在那里更改并再次构建项目。
The method name "retrieveRepeatedProductOfferingUsingGET" is created within your swagger.yaml. There should be a parameter called "operationId" where you specify this name. So just change it there and build the project again.
您必须使用Spring-Fox来生成规格,因为它们是使用该约定自动为后缀配置为后缀的
OperationBuilderPlugin
。查看此答案来自其中一位维护者,看看如何自己自定义它
You must be using spring-fox to generate the spec as they an
OperationBuilderPlugin
configured automatically to suffix using that convention.Check out this answer from one of the maintainers to see how you can customize it yourself