We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have a problem with C# generator. Version 13.6.2 is the latest one what works. Code generated with that version looks like this:
if (status_ == "200") { return; } else if (status_ != "200" && status_ != "204") {
As of version 13.7.0, generated code thwors exception instead of default value in case 204 status code is returned:
int status_ = (int) response_.StatusCode; if (status_ == 200) { ... } else {
I added attributes on controller method to inform generator that it can result with 204, and the code generated is also not okay:
var status_ = (int)response_.StatusCode; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync<GetRealizationRepartitionAppDto>(response_, headers_, cancellationToken).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ == 204) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("No Content", status_, responseText_, headers_, null); }
swagger.json looks more or less like this (after applying attributes):
"responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { "$ref": "#/components/schemas/AppDto" } }, "application/json": { "schema": { "$ref": "#/components/schemas/AppDto" } }, "text/json": { "schema": { "$ref": "#/components/schemas/AppDto" } }, "application/xml": { "schema": { "$ref": "#/components/schemas/AppDto" } }, "text/xml": { "schema": { "$ref": "#/components/schemas/AppDto" } } } }, "204": { "description": "No Content" } }
@RicoSuter What should I do to get correct 204 status code handling.
The text was updated successfully, but these errors were encountered:
Related issues: #1259 #1602 #2995 #4064
You can try one of the work-arounds indicated in one of these comments: #1259 (comment) #2995 (comment) #2995 (comment) #2995 (comment) #2995 (comment)
Sorry, something went wrong.
Having a similar issue under #5018.
See GFlisch/Arc4u.Guidance.Doc#88. You can solve it with nullable="true" in comments
nullable="true"
No branches or pull requests
I have a problem with C# generator.
Version 13.6.2 is the latest one what works. Code generated with that version looks like this:
As of version 13.7.0, generated code thwors exception instead of default value in case 204 status code is returned:
I added attributes on controller method to inform generator that it can result with 204, and the code generated is also not okay:
swagger.json looks more or less like this (after applying attributes):
@RicoSuter What should I do to get correct 204 status code handling.
The text was updated successfully, but these errors were encountered: