swagger-api / swagger-api/swagger-codegen

[java-play-framework] Error building the project when config parameters are overridden

Open
#6,867 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted Issue: Bug Server: Java
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

We generated the Source code from swagger.yaml , we also have config.json that overrides certain parameters (mentioned below) , When we try to build the code it fails due to overridden params are not reflecting in "Module.java"

Swagger-codegen version

2.3.0

Swagger declaration file content or url

can try with any swagger file (say petstore.yaml)

Command line used for generation

java -jar swagger-codegen-2.3.0 jar -i petstore.yaml -c config.json -l java-play-framework

in config.json add below line to override
"apiPackage":"com.puppies.store.apis",

Steps to reproduce

This generates the code , when we build it fails , the cause is because
in which Module.java has still older statement

import controllers.*;

ideally , since we overridden "apiPackage" it should be
import com.puppies.store.apis.*;

once we changed this manually , we could build it fine .
so ideally code generator need to be fixed !

Related issues/PRs
Suggest a fix/enhancement

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 java-play-framework generation with petstore.yaml, config.json, and the apiPackage override, then inspect the generated Module.java. Verify whether the generated import reflects the configured package and whether the generated project builds without manual edits.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.