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

Dealing with Null responses #4064

Open
hdecagny opened this issue Jun 24, 2022 · 1 comment
Open

Dealing with Null responses #4064

hdecagny opened this issue Jun 24, 2022 · 1 comment

Comments

@hdecagny
Copy link

Hi everybody,

I hope this is the best place to post this, if not my apologies.

We are owning a Web Api both client and server side, and we developed a method that can return a null answer in some cases

image

The associated Json documentation
image

However, when the client is generated with Nswag :

  1. There is a mandatory null check in case of a 200 response
  2. A possible 204 answer is not taken into account.

image

I did try to add a 204 attribute server side, and this does add a 204 status check on the server side, but within the 204 check, it will nevertheless throw an exception

image

I am starting to get a bit out of ideas and I have to admit i am not so familiar with the swagger/swashbuckle/Nswag ecosystem.I did try to google it a bit and i found those (one year) old answers but I was wondering if there was any workaround at the moment?

#1602

We do not partcularly need to return a 204 answer in case of a null content (ASP does it automatically), so if there is a way to return a null 200 response and to suppress the null check for this method, I will take it.

So far, we are writing a partial class client with a specific 204 handling case, but we need to do some tweaking everytime we refresh the client. This works, but this is not ideal.
image

Thank you very much for your help,

Kind regards

@taspeotis
Copy link

I think this is just a continuation of #2995

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

No branches or pull requests

2 participants