swagger-api / swagger-api/swagger-codegen-generators
OpenAPI 3 Model with Named Type "Schema" creates issues for Java Codegen
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 299
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Description
Issue Description
Open API spec with named model type "Schema" results in an issue that cannot be resolved by customizing templates due to the forced import of io.swagger.v3.oas.annotations.media.Schema. The actual usages of this import can be fixed via mustache templates with fully qualified names (can't use short name since it is the classname), but the import is generated via code and thus requires a fork of the repo to be able to get around.
Expected behavior
Codegen should be able to handle shortname overlap for Java imports.
Suggestions
Either add checks in code for short name overlap for required imports or just always use fully qualified names in the template files to avoid issues with imports (requires removal of a bunch of import setup code as well).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the Java code-generation path that adds required imports and the Mustache template files involved in generated model usage. Reproduce an OpenAPI spec with a model named "Schema" and compare the generated imports and references; done means the generated Java code handles the name overlap without requiring a repository fork.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100