Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a few issues with the C generator (part 3) #20269

Merged
merged 6 commits into from
Dec 10, 2024

Conversation

eafer
Copy link
Contributor

@eafer eafer commented Dec 6, 2024

Four more patches from the original pull request at #14379. The first three patches are for runtime issues; they are already covered by the current test schemas, but the tests pass anyway. I do include updated schemas for the fourth patch, which allows api calls to return integers and binary strings.

@wing328 @ityuhui @zhemant @michelealbano

As usual, thank you for taking the trouble of dealing with my patches, and I'll be happy to make any changes you require.

eafer added 6 commits December 5, 2024 17:10
Before making an api call, reset apiClient->response_code to zero. That
will protect us from checking stale values if the curl request fails.
Check early on that the arguments are not null, to prevent crashes on
strdup() calls.
Check if the api call returned an error before attempting to parse the
reply as the expected type.
@wing328 wing328 added this to the 7.11.0 milestone Dec 7, 2024
@wing328
Copy link
Member

wing328 commented Dec 7, 2024

thanks for the PR

if no feedback from anyone, i'll merge it next week

@wing328 wing328 merged commit f4271fa into OpenAPITools:master Dec 10, 2024
19 checks passed
jorgeferdz pushed a commit to jorgeferdz/openapi-generator that referenced this pull request Dec 10, 2024
* [C] Clear the response code from previous api calls

Before making an api call, reset apiClient->response_code to zero. That
will protect us from checking stale values if the curl request fails.

* [C] Check that string arguments are not null

Check early on that the arguments are not null, to prevent crashes on
strdup() calls.

* [C] Don't attempt to fill in a type with error info

Check if the api call returned an error before attempting to parse the
reply as the expected type.

* [C] Handle binary and integer return types

* [C] Update test schemas with binary and integer return types

* Update samples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants