OpenAPITools / OpenAPITools/openapi-generator
[REQ] [kotlin-server] [jaxrs-spec] Top level `@Path` annotations should consist of the most common path in the resource
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
The kotlin-server jaxrs-spec generator generates all resource classes with the root path @Path("/") as the top level path for that resource. Due to the way JAX-RS is specified, resource classes are matched to URIs by selecting only classes whose top level path matches maximally with the supplied URI. So, if two resource classes with top level annotations @Path("/") and @Path("/v1") are present in the same project, a URI of /v1/foo/bar will only be matched against the latter resource class, even if the former has a method that would match that URI.
Describe the solution you'd like
The Java JAX-RS server interface generator has logic for determining the common path between resource methods in a generated class. It would be helpful to port this functionality to the kotlin-server jax-rs generator.
Describe alternatives you've considered
Using the Java generator is the alternative our team is rocking with at the moment.
Additional context
N/A
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 comparing the Java JAX-RS template at modules/openapi-generator/src/main/resources/JavaJaxRS/api.mustache, especially its common-path logic, with the Kotlin server jax-rs templates. Identify where Kotlin resource classes receive their top-level @Path and make the generated paths use the common resource path; verify the result with the generator's existing Kotlin JAX-RS tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin, openapi
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100