OpenAPITools / OpenAPITools/openapi-generator
[REQ] C Handle openapi polymorphism better
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 have an API which uses polymorphism. If status code is 200 i get back the defined result and the generated C code returns a struct with all the data i need. (this is fine)
But in case of an error (code 4xx) my API returns an error with status code, error strings etc.
The problem is, via apiClient_t i can only get the status code but not dataReceived, as this is freed while the received data is parsed. So in case of an error my returned struct is NULL and i can only check the status code
Describe the solution you'd like
Leave dataReceived intact so when i get an status code 4xx i can use the received data in apiClient_t ->dataReceived and parse it manually to get the status messages etc
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 generated C client's apiClient_t handling and the dataReceived lifecycle described in the issue. Identify where response data is freed for 4xx responses; done means callers can access the received error payload through apiClient_t->dataReceived while successful response parsing remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, openapi
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100