OpenAPITools / OpenAPITools/openapi-generator
[REQ] Add a way to Update model names based on the Type ( response | request )
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 had a lot of problems when trying to update the model names based on requests or responses.
The main goal was : If request add Request to the name
if Response add Response to the Name
One big issue i ran into was when i was overriding the preprocessOpenAPI function and going through the paths to update the refs and then getting a mapping of names and then passing through the schemas to update the names, the modelJson and JsonSchema properties would not get updated (i think it has to do with the 3.1 OpenAPI creating empty schemas and filling them using the modelKeys Supplier that you can't override) and so i would need to redo the work in the processAllModels function
Describe the solution you'd like
One solution I already applied was going through the OpenAPI and updating refs recursively. in preprocessOpenAPI
And then go over the CodegenModels and do it again in processAllModels
Describe alternatives you've considered
A better alternative pointed out to me by William Cheng was to do that in the Normalizer (I m not sure if it would work though due to the same Normalize3.1 spec rule) but i am looking into (it would also involve overriding all normalizeX functions in the Normalizer
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 preprocessOpenAPI and processAllModels entry points, then compare them with the Normalizer and its normalizeX functions, especially around modelKeys, modelJson, and JsonSchema. Done should mean request and response schemas receive distinct names while references and generated model metadata remain consistent for OpenAPI 3.1.
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