swagger-api / swagger-api/swagger-codegen

Some important JSON config properties does not work

Open
#9,271 0 comments 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

First of all your documentation does not include JSON config example but only XML. For JSON config shown below only sourceFolder and modelPackage does the job but the other properties still generate everything. For my discovery i even tried "generateModels": false and models were still generated. The other problem is that i only want model classes nothing else and this configuration is also generates other files like VERSION and some gradle project configuration files.

Swagger-codegen version

2.4.2

Swagger declaration file content or url
{
  "sourceFolder": "sdk/kotlin",
  "modelPackage": "com.myproject.models",
  "generateModels": true,
  "generateModelTests": false,
  "generateModelDocumentation": false,
  "generateApis": false,
  "generateSupportingFiles": false,
  "addCompileSourceRoot": false,
  "supportingFilesToGenerate": false
}
Command line used for Kotlin generation
swagger-codegen generate -l kotlin -i swagger.api.yaml -c swagger-codegen-android.config.json
Suggest a fix/enhancement

for generating only models i found only solution by using -D

swagger-codegen generate -l kotlin -Dmodels -DmodelDocs=false -DmodelTests=false -i swagger.api.yaml -c swagger-codegen-android.config.json

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 with the Kotlin generation command and swagger-codegen-android.config.json, then trace how the JSON properties are applied. Reproduce the behavior with the supplied command and verify that only models are generated, with model tests, documentation, APIs, and supporting files disabled; confirm the JSON configuration matches the existing -D behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.