swagger-api / swagger-api/swagger-codegen-generators
Java: Support configuring package by yaml file
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 299
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Description
If you have multiple APIs that share common API primitives a typical setup would be something like:
com/superorg/openapi/v1/apiA/schema.yaml
com/superorg/openapi/v1/apiB/schem.yaml
com/superorg/openapi/v1/somethingShared/schema.yaml
com/superorg/openapi/v1/somethingElseShared/schema.yaml
Where both apiA and apiB would reference objects from somethingShared and maybe somethingElseShared. Given the current implementation there is no way to place apiA, apiB, somethingShared and somethingElseShared each in different namespaces but make them reference each other.
Right now the only option to place these APIs in different packages is to invoke swagger-codegen on each API separately and set modelPackage/apiPackage accordingly. However, that will duplicate all referenced components of somethingShared and somethingElseShared into every API namespace.
Ideally I would be able to configure the package in which each model is placed by setting a property in the YAML. This would be similar to how protoc handles this for protobuf files.
For example:
x-java-package: "com.superorg.openapi.v1.apiA"
paths:
....
components:
....
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 current modelPackage and apiPackage configuration in swagger-codegen, then compare how package settings are handled for protobuf files. Define how a YAML package property should place API models and shared components in separate namespaces without duplicating referenced components; the issue provides no specific files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, yaml
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100