OpenAPITools / OpenAPITools/openapi-generator
[BUG][C#][Client: C-Sharp] Calling xHttpWithInfo methods do not return headers when 4xx responses are returned
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
Calling a xHttpWithInfo method that returns a response in the 200 range returns an ApiResponse containing the domain model and the returned headers
However, if a response in the 400 range is received no headers are returned, only an ApiException.
This becomes an issue when a 429 response is received and Retry-After header is returned as there is no way to obtain this (see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After)
openapi-generator version
4.0.3
OpenAPI declaration file content or url
https://fbn-prd.lusid.com/api/swagger/v0/swagger.json
Command line used for generation
java -jar openapi-generator-cli.jar generate -g csharp -c config_file
{
"packageName": "Lusid.Sdk",
"sourceFolder": ".",
"targetFramework": "v5.0",
"useDateTimeOffset": true,
"netCoreProjectFile": true,
"returnICollection": true,
"packageVersion": "0.10.841"
}
Related issues/PRs
https://github.com/OpenAPITools/openapi-generator/issues/3473
Suggest a fix
- Return an
ApiResponsewith theApiExceptionin theDatafield
or
- Return the headers in the
ApiException
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# xHttpWithInfo methods and ApiException handling, then inspect the C# generator templates used by the command in the issue. Verify how 4xx response headers, especially Retry-After, are exposed and confirm the chosen ApiResponse or ApiException behavior against the reported case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100