swagger-api / swagger-api/swagger-codegen

swagger-codegen-maven-plugin generate interface implementation even if option interfaceOnly = true is used

Open
#10,037 3 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

I want to generate JAX-RS server stubs for my API using the swagger-codegen-maven plugin 3.0.16 , but I want to use my own service implementation class, instead of the one generated. In my config , I have specify config option interfaceOnly = true but it does not work (the implementation is generated anyway)

Swagger-codegen version 3.0.16

Command line used for generation
<plugin>
        <groupId>io.swagger.codegen.v3</groupId>
        <artifactId>swagger-codegen-maven-plugin</artifactId>
        <version>3.0.16</version>
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <inputSpec>${project.basedir}/src/main/resources/META-INF/swagger.yaml</inputSpec>
              <language>jaxrs-resteasy-eap</language>
              <output>${project.basedir}</output>
              <configOptions>
                <sourceFolder>src/main/java</sourceFolder>
                <apiPackage>zzz.xxx.api</apiPackage>
                <modelPackage>zzz.xxx.representations</modelPackage>
                <serializableModel>true</serializableModel>
                <useBeanValidation>true</useBeanValidation>
                <dateLibrary>java8</dateLibrary>
                <interfaceOnly>true</interfaceOnly>
                <returnResponse>true</returnResponse>
                <generateAdditionalProperties>true</generateAdditionalProperties>
                <customPatchAnnotation>zzz</customPatchAnnotation>
                <excludeVendorExtensions>xx</excludeVendorExtensions>
              </configOptions>
              <generateSupportingFiles>false</generateSupportingFiles>
            </configuration>
          </execution>
        </executions>
        <dependencies>
      </plugin>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the provided swagger-codegen-maven-plugin 3.0.16 configuration and the jaxrs-resteasy-eap generator. Inspect the generator entry point and its templates to trace how configOptions.interfaceOnly is handled. Done means generation produces the JAX-RS interfaces and models without the service implementation class.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.