swagger-api / swagger-api/swagger-codegen

Selective generation problem

Open
#8,495 1 comment 3 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

The use of the selective generation seems doesn't work properly.
For example using the directive "-Dmodels=User,Pet" generates only User and not Pet.

Swagger-codegen version

swagger-codegen-cli-2.3.1

Command line used for generation

example for java, but I think it is a common problem.

java -jar swagger-codegen-cli-2.3.1.jar generate --input-spec myoas.yaml --output c:\Users/clients/java --lang java --group-id com.mygroup --artifact-id logging --artifact-version 1.0.0-SNAPSHOT --api-package com.mygroup.logging.api --invoker-package com.mygroup.logging.invoker --model-package com.mygroup.logging.models -Djava8=true -DdateLibrary=java8 -DhideGenerationTimestamp=true -Dmodels=User,Pet

Suggest a fix/enhancement

Probably the problem is in OptionUtils.parseCommaSeparatedTuples() that for the -Dmodels=User,Pet produces a list with 2 entries:
1- models->User
2- Pet->""

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 in OptionUtils.parseCommaSeparatedTuples(), identified in the issue, and reproduce the behavior with the supplied Java CLI command using -Dmodels=User,Pet. Verify that selective generation produces both User and Pet rather than only User.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.