OpenAPITools / OpenAPITools/openapi-generator
[BUG] [cpp-restsdk] Cannot generate "accept header" in client sdk correctly.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Use sample yaml to reproduce the issue:
We defined a new accept header "application/ABC+json:" to replace old "application/json:" in response content type
(paths: /pets/post/responses/'200'/content/application/ABC+json).
For cpp-restsdk, it does not work.
For csharp-netcore, it works well.
openapi-generator version
5.3.0
OpenAPI declaration file content or url
Here is the yaml file (petstore.yaml): (Line 28 for application/ABC+json)
https://gist.github.com/oneiric/1ded544a13b561d9a586789b5919e5a7
Generation Details
Steps to reproduce
Wrong results in cpp-restsdk output:
openapi-generator-cli generate -i petstore.yaml -g cpp-restsdk -o ./CppClientSDK
See line 57~ line 78 in PetApi.cpp, it always throws exceptions. And new accept type "application/ABC+json" is not handled.
https://gist.github.com/oneiric/e17ef85c02007abe5c61ecd652091162
Correct results in csharp-netcore output:
openapi-generator-cli generate -i petstore.yaml -g csharp-netcore -o ./CSharpClientSDK
See line 295 ~ line 304 in PetApi.cs, new accept type "application/ABC+json" can work well.
https://gist.github.com/oneiric/f216527a08300bfb3b67dd7494c02f72
Expected output:
cpp-resksdk can work well like csharp.
Related issues/PRs
Suggest a fix
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
Use the linked petstore.yaml and run the cpp-restsdk generation command first, then inspect the generated PetApi.cpp around lines 57-78. Compare its handling of the application/ABC+json accept type with the csharp-netcore output in PetApi.cs around lines 295-304. Done means the generated C++ client handles the custom accept type without always throwing exceptions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100