diff --git a/aspnetcore/fundamentals/openapi/aspnetcore-openapi.md b/aspnetcore/fundamentals/openapi/aspnetcore-openapi.md index 67bf3a2fd52e..5dca8f8e3f4f 100644 --- a/aspnetcore/fundamentals/openapi/aspnetcore-openapi.md +++ b/aspnetcore/fundamentals/openapi/aspnetcore-openapi.md @@ -78,6 +78,16 @@ Launch the app and navigate to `https://localhost:/openapi/v1.json` to vie The following sections demonstrate how to customize OpenAPI document generation. +### Generate OpenAPI document in YAML format + +The OpenAPI document can be generated in either JSON or YAML format. By default, the OpenAPI document is generated in JSON format. To generate the OpenAPI document in YAML format, specify the endpoint in the MapOpenApi call with a ".yaml" or ".yml" suffix, as shown in the following example: + +```csharp +app.MapOpenApi("/openapi/{documentName}.yaml"); +``` + +Generating penAPI documents in YAML format at build time is currently not supported, but planned in a future preview. + ### Customize the OpenAPI document name Each OpenAPI document in an app has a unique name. The default document name that is registered is `v1`. diff --git a/aspnetcore/release-notes/aspnetcore-10/includes/openApi.md b/aspnetcore/release-notes/aspnetcore-10/includes/openApi.md index bae9c2b0957f..2161f3faef0c 100644 --- a/aspnetcore/release-notes/aspnetcore-10/includes/openApi.md +++ b/aspnetcore/release-notes/aspnetcore-10/includes/openApi.md @@ -61,7 +61,7 @@ options.AddSchemaTransformer((schema, context, cancellationToken) => Note that these changes are necessary even when only configuring the OpenAPI version to 3.0. -### OpenAPI in Yaml +### OpenAPI in YAML ASP.NET now supports serving the generated OpenAPI document in YAML format. YAML can be more concise than JSON, eliminating curly braces and quotation marks when these can be inferred. YAML also supports multi-line strings, which can be useful for long descriptions.