Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions aspnetcore/fundamentals/openapi/aspnetcore-openapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ Launch the app and navigate to `https://localhost:<port>/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.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #35248


### Customize the OpenAPI document name

Each OpenAPI document in an app has a unique name. The default document name that is registered is `v1`.
Expand Down
2 changes: 1 addition & 1 deletion aspnetcore/release-notes/aspnetcore-10/includes/openApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down