Saturday, May 3, 2025

ASP.NET Core 10.0: OpenAPI Document in YAML Format

ASP.NET Core 10.0, now supports OpenAPI specification in YAML format. YAML also supports multi-line strings, which can be useful for long descriptions.

To configure an app to serve the generated OpenAPI document in YAML format, specify the endpoint in the MapOpenApi call with a .yaml or .yml suffix, as shown in the following example:

app.MapOpenApi();
app.MapOpenApi("/openapi/v1.yaml");

Now we are exposing OpenAPI specification in both JSON (default) and YAML format.

OpenAPI Document in YAML Format

Hope this helps.

Happy Coding.

Regards,
Jaliya

No comments:

Post a Comment