Skip to content

Commit 01f0a37

Browse files
committed
WN: P1
1 parent f4eb109 commit 01f0a37

File tree

3 files changed

+30
-27
lines changed

3 files changed

+30
-27
lines changed

aspnetcore/release-notes/aspnetcore-10.0.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ This section describes new features for minimal APIs.
3333

3434
This section describes new features for OpenAPI.
3535

36+
[!INCLUDE[](~/release-notes/aspnetcore-10/includes/openApi.md)]
37+
38+
39+
[!INCLUDE[](~/release-notes/aspnetcore-10/includes/responseDescProducesResponseType.md)]
40+
3641
## Authentication and authorization
3742

3843
This section describes new features for authentication and authorization.
@@ -41,4 +46,6 @@ This section describes new features for authentication and authorization.
4146

4247
This section describes miscellaneous new features in ASP.NET Core 10.0.
4348

49+
[!INCLUDE[](~/release-notes/aspnetcore-10/includes/testAppsTopLevel.md)]
50+
4451
## Related content

aspnetcore/release-notes/aspnetcore-10/includes/openApi.md

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
### OpenAPI 3.1 support
22

3-
https://github.com/dotnet/aspnetcore/pull/59480
4-
https://github.com/dotnet/aspnetcore/pull/60002
53

64
ASP.NET Core has added support for generating [OpenAPI version 3.1] documents in .NET 10.
75
Despite the minor version bump, OpenAPI 3.1 is a significant update to the OpenAPI specification,
@@ -11,11 +9,12 @@ in particular with full support for [JSON Schema draft 2020-12].
119
[JSON Schema draft 2020-12]: https://json-schema.org/specification-links#2020-12
1210

1311
Some of the changes you will see in the generated OpenAPI document include:
14-
- Nullable types will no longer have the `nullable: true` property in the schema, and instead will have a `type` keyword whose value is an array that includes `null` as one of the types.
1512

16-
With this feature, the default OpenAPI version for generated documents will be 3.1, but you can easily change this
17-
by explicitly setting the `OpenApiVersion` property of the `OpenApiOptions` in the `configureOptions` delegate
18-
parameter of `AddOpenApi`.
13+
- Nullable types no longer have the `nullable: true` property in the schema.
14+
- Instead of a `nullable: true` property, they have a `type` keyword whose value is an array that includes `null` as one of the types.
15+
16+
With this feature, the default OpenAPI version for generated documents will be `3.1` . You can easily change the version
17+
by explicitly setting the [OpenApiVersion](/dotnet/api/microsoft.aspnetcore.openapi.openapioptions.openapiversion?view=aspnetcore-9.0) property of the [OpenApiOptions](/dotnet/api/microsoft.aspnetcore.openapi.openapioptions?view=aspnetcore-9.0) in the `configureOptions` delegate parameter of [AddOpenApi](/dotnet/api/microsoft.extensions.dependencyinjection.openapiservicecollectionextensions.addopenapi?view=aspnetcore-9.0).
1918

2019
```csharp
2120
builder.Services.AddOpenApi(options =>
@@ -25,21 +24,21 @@ builder.Services.AddOpenApi(options =>
2524
});
2625
```
2726

28-
If you are generating the OpenAPI document at build time, you can select the OpenAPI version by setting the `--openapi-version` in the `OpenApiGenerateDocumentsOptions` MSBuild item.
27+
When generating the OpenAPI document at build time, the OpenAPI version can be selected by setting the `--openapi-version` in the `OpenApiGenerateDocumentsOptions` MSBuild item.
2928

3029
```xml
3130
<!-- Configure build-time OpenAPI generation to produce an OpenAPI 3.0 document. -->
3231
<OpenApiGenerateDocumentsOptions>--openapi-version OpenApi3_0</OpenApiGenerateDocumentsOptions>
3332
```
3433

34+
OpenAPI 3.1 support was primarly added in the following this [PR](https://github.com/dotnet/aspnetcore/pull/59480).
35+
36+
3537
### Breaking changes
3638

37-
Support for OpenAPI 3.1 requires an update to the underlying OpenAPI.NET library to a new major version, 2.0.
38-
This new version has some breaking changes from the previous version, and this may impact your applications
39-
if you have any document, operation, or schema transformers.
40-
Perhaps the most significant change is that the `OpenApiAny` class has been dropped in favor of using `JsonNode` directly.
41-
If your transformers use `OpenApiAny`, you will need to update them to use `JsonNode` instead.
42-
For example, a schema transformer to add an example in .NET 9 might look like this:
39+
Support for OpenAPI 3.1 requires an update to the underlying OpenAPI.NET library to a new major version, 2.0. This new version has some breaking changes from the previous version. The breaking changes may impact apps if they have any document, operation, or schema transformers.
40+
41+
One of the most significant changes is that the `OpenApiAny` class has been dropped in favor of using `JsonNode` directly.If your transformers use `OpenApiAny`, you will need to update them to use `JsonNode` instead. For example, a schema transformer to add an example in .NET 9 might look like the following:
4342

4443
```csharp
4544
options.AddSchemaTransformer((schema, context, cancellationToken) =>
@@ -58,7 +57,7 @@ For example, a schema transformer to add an example in .NET 9 might look like th
5857
});
5958
```
6059

61-
In .NET 10 the transformer to do the same task will look like this:
60+
In .NET 10 the transformer to do the same task will look like the following:
6261

6362
```csharp
6463
options.AddSchemaTransformer((schema, context, cancellationToken) =>
@@ -77,22 +76,21 @@ In .NET 10 the transformer to do the same task will look like this:
7776
});
7877
```
7978

80-
Note that these changes will be necessary even if you congfigure the OpenAPI version to 3.0.
79+
Note that these changes are necessary even when only congfiguring the OpenAPI version to 3.0.
8180

8281
### OpenAPI in Yaml
8382

8483
https://github.com/dotnet/aspnetcore/pull/58616
8584

86-
ASP.NET now supports serving the generated OpenAPI document in YAML format.
87-
YAML can be more concise than JSON, eliminating curly braces and quotation marks when these can be inferred.
88-
YAML also supports multi-line strings, which can be useful for long descriptions.
85+
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.
8986

90-
To configure your application to serve the generated OpenAPI document in YAML format,
91-
specify the endpoint in the MapOpenApi call with a ".yaml" or ".yml" suffix, as shown in this example:
87+
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:
9288

9389
```csharp
9490
app.MapOpenApi("/openapi/{documentName}.yaml");
9591
```
9692

97-
Support for YAML is currently only available for the the OpenAPI served from the OpenAPI endpoint.
98-
Support for generating OpenAPI documents in YAML format at build time will be added in a future preview.
93+
Support for:
94+
95+
* YAML is currently only available for the the OpenAPI served from the OpenAPI endpoint.
96+
* Generating OpenAPI documents in YAML format at build time will be added in a future preview.
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
### Response description on ProducesResponseType
22

3-
https://github.com/dotnet/aspnetcore/pull/58193
4-
5-
The ProducesAttribute, ProducesResponseTypeAttribute, and ProducesDefaultResponseType attributes now accept an optional string parameter, `Description`, that will set the description of the response. Here's an example:
3+
The [ProducesAttribute](/dotnet/api/microsoft.aspnetcore.mvc.producesattribute-1?view=aspnetcore-9.0), [ProducesResponseTypeAttribute](/dotnet/api/microsoft.aspnetcore.mvc.producesresponsetypeattribute-1?view=aspnetcore-9.0), and [ProducesDefaultResponseType](/dotnet/api/microsoft.aspnetcore.mvc.producesdefaultresponsetypeattribute?view=aspnetcore-9.0) attributes now accept an optional string parameter, `Description`, that will set the description of the response. Here's an example:
64

75
```csharp
86
[HttpGet(Name = "GetWeatherForecast")]
@@ -11,7 +9,7 @@ public IEnumerable<WeatherForecast> Get()
119
{
1210
```
1311

14-
And the generated OpenAPI will be
12+
And the generated OpenAPI:
1513

1614
```json
1715
"responses": {
@@ -20,4 +18,4 @@ And the generated OpenAPI will be
2018
"content": {
2119
```
2220

23-
Community contribution! 🙏
21+
[Community contribution](https://github.com/dotnet/aspnetcore/pull/58193) by [Sander ten Brinke](https://github.com/sander1095) 🙏

0 commit comments

Comments
 (0)