Open harvzor opened 1 year ago
Interesting.
I never noticed it.
It seems to show all content types even if I remove AddNewtonsoftJsonMergePatch
and comment out all non-default settings in swagger options in my application.
It looks like it is really a swagger issue but I have no time right now to investigate more.
After calling
.AddSystemTextJsonMergePatch()
in the startup, it adds theapplication/merge-patch+json
content type to Swagger.However, this means that other endpoints will default to this type, even if they're not
PATCH
:Probably it defaults to this because the list is in alphabetical order:
I think this is more of an issue on Swashbuckle's side. I'm not expecting this to be fixed (probably it can't be fixed here) - I just wanted this to be documented 😄
Workaround
Put
[Consumes(MediaTypeNames.Application.Json)]
on either every other method that accepts a body, or just apply it to the class: