Skip to content

[JavaJaxRS] ServiceImpl and ServiceFactory classes should not be overwritten #4230

Open
@willgorman

Description

@willgorman
Description

Prior to #4074, all generated *ServiceImpl and *ServiceFactory classes would never be overwritten due to io.swagger.codegen.languages.AbstractJavaJAXRSServerCodegen#shouldOverwrite which was removed in the previously mentioned issue. I believe that the previous behavior was correct because those classes are intended to contain user-written code and are also written to a different directory than the rest of the generated classes. There's no reason to allow them to be overwritten and this change breaks anyone that relied on this.

Swagger-codegen version

2.2.2-SNAPSHOT

Swagger declaration file content or url
Command line used for generation
<plugin>
    <groupId>io.swagger</groupId>
    <artifactId>swagger-codegen-maven-plugin</artifactId>
    <version>2.2.2-SNAPSHOT</version>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <inputSpec>${project.basedir}/src/main/resources/api.yml</inputSpec>
                <language>jaxrs</language>
                <output>${project.basedir}</output>
                <modelPackage>com.foo.model</modelPackage>
                <apiPackage>com.foo.api</apiPackage>
                <configOptions>
                    <dateLibrary>java8</dateLibrary>
                    <sourceFolder>src/generated/java</sourceFolder>
                </configOptions>
                <environmentVariables>
                    <hideGenerationTimestamp/>
                    <models/>
                    <apis/>
                    <supportingFiles>
                     ApiException.java,ApiOriginFilter.java,ApiResponseMessage.java,JacksonJsonProvider.java,NotFoundException.java,StringUtil.java,RFC3339DateFormat.java
                    </supportingFiles>
                </environmentVariables>
                <addCompileSourceRoot>false</addCompileSourceRoot>
            </configuration>
        </execution>
    </executions>
</plugin>
Steps to reproduce
Related issues
Suggest a Fix

Restore https://github.com/swagger-api/swagger-codegen/pull/4074/files#diff-c48b6e5f92076a98e3f2b0e940fd5eecL205

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions