OpenAPITools / OpenAPITools/openapi-generator
[REQ] Name inline object types based on context instead of `InlineResponseDefault*`
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.
I am using either the jaxrs-cxf-client or the java generators. When, an OpenApi specification has inline definition for a request / response type a Java class name is generated based on an ordinal number. Example:
public InlineResponseDefault22 doSomethingAwesome(InlineObject21 body);
Describe the solution you'd like
I'd like inline objects to be named based on context (the operationId or endpoint name) prefixed with their function like DoSomethingAwesomeRequest instead of InlineObject21 and DoSomethingAwesomeResponseOK instead of InlineObject21.
Describe alternatives you've considered
Anything predictable would be fine, because the current method breaks any references if the API gets some additions (even endpoints added - a non-breaking change - can move ordinal numbers around).
Additional context
Generally I want the code generation repeated any time (to follow upstream API changes). If existing references to InlineObject21 break, updating will be an hurdle.
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 inspecting the java and jaxrs-cxf-client generators and how they currently assign names such as InlineObject21 and InlineResponseDefault22. Trace the naming path for inline request and response schemas, then define how operation context and response status produce stable names like DoSomethingAwesomeRequest and DoSomethingAwesomeResponseOK. Done means generated names are predictable and do not shift when unrelated endpoints are added.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100