生成包含所有TagApi文件的唯一TagApi.java文件

时间:2019-05-16 14:54:47

标签: swagger-codegen openapi-generator swagger-codegen-maven-plugin

我正在使用以下maven插件配置运行Java / resttemplate客户端生成

        <plugin>
            <groupId>io.swagger.codegen.v3</groupId>
            <artifactId>swagger-codegen-maven-plugin</artifactId>
            <version>3.0.8</version>
            <executions>
                <execution>
                    <id>api</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <inputSpec>${maven.multiModuleProjectDirectory}/api/target/generated/swagger-api-spec/swagger.json</inputSpec>  
                        <language>java</language>
                        <library>resttemplate</library>
                        <modelPackage>com.company.springapi.model</modelPackage>
                        <apiPackage>com.company.springapi.api</apiPackage>
                        <invokerPackage>com.company.springapi.invoker</invokerPackage>
                        <generateSupportingFiles>true</generateSupportingFiles>
                        <supportingFilesToGenerate>
                            ApiClient.java,OAuth.java,ApiKeyAuth.java,Authentication.java,HttpBasicAuth.java,RFC3339DateFormat.java
                        </supportingFilesToGenerate>
                        <configOptions>
                            <java8>true</java8>
                            <dateLibrary>java8</dateLibrary>
                            <interfaceOnly>true</interfaceOnly>
                            <groupId>com.company.provider</groupId>
                            <artifactId>${project.artifactId}</artifactId>
                            <artifactVersion>${project.version}</artifactVersion>
                        </configOptions>
                    </configuration>
                </execution>
            </executions>
        </plugin>

,并且它为每个标记的控制器生成单独的TagApi.java文件,例如Tag1Api.java,Tag2Api.java,Tag3Api.java ...(加上ApiClient.java以及支持文件)。


答案似乎在这里:https://github.com/swagger-api/swagger-codegen/blob/05db33c135d5e8c8220a4b3771d79c40cd94bcd5/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java#L454

0 个答案:

没有答案