swagger-api / swagger-api/swagger-codegen

The script new.sh generates a wrong package for test classes

Open
#9,022 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

The script new.sh creates test classes with a wrong package if the generator name contains dashes.

openapi-generator version

Since the new.sh was introduced.

Command line used for generation

./new.sh -n java-something -s -t

Steps to reproduce

Execute:
./new.sh -n java-something -s -t

The script generates the class:
modules/openapi-generator/src/test/java/org/openapitools/codegen/java-something/JavaSomethingServerCodegenModelTest.java

that has an invalid character in its package.

Suggest a fix

Ideally, the script should generate the classes in the package

modules/openapi-generator/src/test/java/org/openapitools/codegen/java/something

or, at least, it should state that, with the current implementation, a dash in the generator name is not supported by this script.

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 new.sh and reproduce the issue using ./new.sh -n java-something -s -t. Inspect how the generator name becomes the test package, then verify that the generated Java test class has a valid package path without the dash, or that the script clearly reports the limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, shell
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.