I've been struggling with making swagger request examples using Swashbuckle, because I have several endpoints that uses the same request model. I make multiple examples, applying the correct ones to each endpoint, but only one of the examples will be applied to all endpoints, and this has confused me a lot. Then I read this on github (https://github.com/mattfrear/Swashbuckle.Examples):
For requests, in the Swagger 2.0 spec there is only one schema for each request object defined across all the API endpoints. So if you are using the same request object in multiple API endpoints, i.e. on multiple controller actions like this:
public async Task<IHttpActionResult> DeliveryOptionsForAddress(DeliveryOptionsSearchModel search)
...
// maybe in some other controller, e.g. Search.cs
public async Task<IHttpActionResult> Search(DeliveryOptionsSearchModel search)
That DeliveryOptionsSearchModel object is only defined once in the entire Swagger document and it can only have one request example defined.
So my question is, is there a way around this? I see someone have used an Example tag, but it does not display anything. Remark tag does work, but I would rather have a proper example that can be used directly if possible.