The best way to add a body example #59812
Labels
area-minimal
Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
feature-openapi
✔️ Resolution: Answered
Resolved because the question asked by the original author has been answered.
Status: Resolved
Hi there, I hope someone can help me out, I just need a little confirmation:
I am working on a Minimal Api with the new OpenApi lib. I am trying to add a body example to an endpoint. After many hours (more on that later) I managed to get it working using
IOpenApiOperationTransformer
(within the TransformAsync() the OperationId is checked, to put the body-example in the right place).The documentation. states:
My code:
And register that with:
My hours have been spent on AI and me offcourse not reading documentation, because that keeps pointing me to use WithOpenApi() on the endpoint, but this does nothing (as documented I guess it states:
somewhere). So is this currently the only way? It feels logical that I can add something to the
MapPost()
To get it working. 'Example' is also such a hard google term, so thats why I added this issue.@mikekistler informed me that:
The text was updated successfully, but these errors were encountered: