Reputation: 805
In my WebAPI, I have a change password method. It takes a parameter that is a class that contains two properties: "OldPassword" and "NewPassword". Obviously, i do not want to pass that thru query strings, i want em passed into the body. As soon as I use the FromBody attribute, the Swagger UI no longer offers a nice form with two textbox, it turns into a single JSON blob.
I'd like to mix those behaviors, provide a form but format the input into json that would match the schema.
I tried playing around with OperationFilters but couldn't achieve anything similar. I'm sure this is pretty common, but my google and stackoverflow searches haven't returned anything. Perhaps i'm not searching for the proper keywords. Unsure.
Upvotes: 3
Views: 2063
Reputation: 805
Decided to stick with json blob in the body as it is the decison that makes the most sense, design wise.
I got it working with FromHeader, but considering that this is not the way this API should be consumed, we prefered to stick with designing for the actual use case and not around Swagger's features and limiations.
Thanks for the answers!
Upvotes: 2