swagger-api / swagger-api/swagger-codegen
Support interface and implementation classes for API controllers
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
For auto-generated server code, we want to generated 2 files for each API controller file:
- an interface, which will be overwritten by code generation
- an implementation class, which will not be overwritten by code generation
Java Spring has already implemented this:
https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache
https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache
The goal is to avoid application/business logic being overwritten by code generation so that there's less overhead when adding/deleting/updating endpoint definition.
Other server generators should leverage similar design.
Swagger-codegen version
Latest master
Suggest a Fix
If anyone has suggestions for better design or want to work on this enhancement for a particular server generator, please reply to let us know. Thank you.
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 reviewing the referenced JavaSpring templates, api.mustache and apiController.mustache, to understand how interface and implementation files are separated. Then identify which server generator should be addressed first and inspect its corresponding templates and tests. Done means that generator emits both files while preserving implementation code across regeneration; this issue names no target generator or test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, backend, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100