首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >openapi codegen-maven-plugin消除生成方法中的后缀UsingGET

openapi codegen-maven-plugin消除生成方法中的后缀UsingGET
EN

Stack Overflow用户
提问于 2022-06-10 13:36:15
回答 1查看 331关注 0票数 0

我正在尝试使用openapi codegen-maven-plugin从yaml文件中生成接口,除了生成的方法具有后缀UsingGET外,您可以在下面的示例中看到:

代码语言:javascript
运行
复制
  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中为codegen插件所做的配置。

代码语言:javascript
运行
复制
<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>

请您有什么解决办法吗!!谢谢

EN

回答 1

Stack Overflow用户

发布于 2022-08-09 13:41:59

方法名"retrieveRepeatedProductOfferingUsingGET“是在swagger.yaml中创建的。应该有一个名为"operationId“的参数,您可以在其中指定这个名称。因此,只需在那里改变它,并重新构建项目。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72575226

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档