swagger-api / swagger-api/swagger-codegen

[JAVA] Bug generating models only

Open
#9,939 1 comment 0 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

Description

Setting the <generateApis> configProperty to false does not prevent the client code from being generated. This requires that a <library> be imported for generated code that isn't desired or used.

Swagger-codegen version

3.0.14

Swagger declaration file content or url
---
swagger: "2.0"
definitions:
  Order:
    type: "object"
    properties:
      id:
        type: "integer"
        format: "int64"
    xml:
      name: "Order"
<plugin>
    <groupId>io.swagger.codegen.v3</groupId>
    <artifactId>swagger-codegen-maven-plugin</artifactId>
    <version>${swagger-codegen-maven-plugin.version}</version>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <inputSpec>swagger.yaml</inputSpec>
                <language>java</language>
                <generateApis>false</generateApis>
                <generateApiTests>false</generateApiTests>
                <generateApiDocumentation>false</generateApiDocumentation>
                <configOptions>
                    <generateApis>false</generateApis>
                    <generateApiTests>false</generateApiTests>
                    <generateApiDocumentation>false</generateApiDocumentation>
                    <useOas2>true</useOas2>
                    <java8>true</java8>
                    <dateLibrary>java8</dateLibrary>
                </configOptions>
                <library>jersey2</library>
            </configuration>
        </execution>
    </executions>
</plugin>
Command line used for generation

mvn clean compile

Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

The suggestion in 8562 did not work for me. I've tried putting <generateApis>false</generateApis> under <configuration> as well as <configOptions>. I've tried setting it under both as well, but no dice

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

Start by reproducing the issue with the shown Maven plugin configuration and Swagger definition using mvn clean compile. Trace how the Java generator handles generateApis=false while generating the Order model, and compare the generated output with the requested configuration. Done means client API code is omitted while model generation still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, tooling
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.