Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ErikPilsits-RJW
Copy link
Contributor

A 204 response is successful and it is expected that there is no body. Therefore the client should return the default(T) response instead of throwing a null response exception.

@Shaddix
Copy link

Shaddix commented Dec 6, 2022

Since 204 is handled in Typescript generator, it seems to make sense to handle it in C# as well

@bstordrup
Copy link

Any estimate on merging this in? Could use this as well.

@ErikPilsits-RJW
Copy link
Contributor Author

@RicoSuter any chance this can make it into the next release? It's the last manual template update I maintain for our org.

@ErikPilsits-RJW
Copy link
Contributor Author

A gentle bump, no merge conflicts.

@RicoSuter

@ErikPilsits-RJW
Copy link
Contributor Author

I know there are a few other open issues and PRs regarding 204 responses, but mine seems to be simple and correct for now. Future enhancements are still possible, but this has been working in our org for quite some time. I'm just getting tired of maintaining the template override with every new nswag release.

Any chance I could at least get some feedback if this is being considered?

@RicoSuter @arshrp @lahma

@svartis
Copy link

svartis commented Jul 8, 2025

I am also very keen to get this one in place

@RicoSuter
Copy link
Owner

Please also add some tests covering this change and fix the build errors. Then it's fine to merge.

@ErikPilsits-RJW
Copy link
Contributor Author

Please also add some tests covering this change and fix the build errors. Then it's fine to merge.

Can you give me some guidance on what tests you would like added and where? If there's an example to go off that should be sufficient.

@RicoSuter
Copy link
Owner

We have some snapshot based tests here:
https://github.com/RicoSuter/NSwag/tree/master/src/NSwag.CodeGeneration.TypeScript.Tests

I think we should add a sample minimal openapi with a 204 and 200 in it (etc) and generate a typescript from it and snapshot so that we have this feature under test..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants