No Request example with SerializeAsV2
Swagger V2 supports examples on the request under /paths/[path]/[method]/parameters/[index]/schema/example
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaExample
However, when rendering using SerializeAsV2, request examples are not output, as per the comments in https://github.com/microsoft/OpenAPI.NET/blob/master/src/Microsoft.OpenApi/Models/OpenApiExample.cs#L106
I think this is incorrect, and an example should be output when using SerializeAsV2. Related issue: https://github.com/mattfrear/Swashbuckle.AspNetCore.Filters/issues/115
Technically those are two different examples. One is an example of for the schema which is modelled as Any and the other is the example property of requestBody which is an OpenApiExample.
If the example was set in the Schema object of the RequestBody.Content then it would render out in V2.
I suppose in the V2 translation, we could reach into the first requestBody.Content object and pull the Example.Value into the Schema example. Somewhere here I think https://github.com/microsoft/OpenAPI.NET/blob/master/src/Microsoft.OpenApi/Models/OpenApiOperation.cs#L250
Hi Darrel
I ended up working around this issue by setting the /definitions/[schemaType]/example object myself.
If you want to Close this issue, that's cool.
Examples are going to change again in 3.1 so we will deal with this in the 3.1 release.
Fixed by #1538