@@ -29,6 +29,57 @@ This section describes new features for SignalR.
2929
3030This section describes new features for minimal APIs.
3131
32+ ## OpenAPI
33+
34+ This section describes new features for OpenAPI.
35+
36+ ### Breaking changes
37+
38+ Support for OpenAPI 3.1 requires an update to the underlying OpenAPI.NET library to a new major version, 2.0.
39+ This new version has some breaking changes from the previous version, and this may impact your applications
40+ if you have any document, operation, or schema transformers.
41+ Perhaps the most significant change is that the ` OpenApiAny ` class has been dropped in favor of using ` JsonNode ` directly.
42+ If your transformers use ` OpenApiAny ` , you will need to update them to use ` JsonNode ` instead.
43+ For example, a schema transformer to add an example in .NET 9 might look like this:
44+
45+ ``` csharp
46+ options .AddSchemaTransformer ((schema , context , cancellationToken ) =>
47+ {
48+ if (context .JsonTypeInfo .Type == typeof (WeatherForecast ))
49+ {
50+ schema .Example = new OpenApiObject
51+ {
52+ [" date" ] = new OpenApiString (DateTime .Now .AddDays (1 ).ToString (" yyyy-MM-dd" )),
53+ [" temperatureC" ] = new OpenApiInteger (0 ),
54+ [" temperatureF" ] = new OpenApiInteger (32 ),
55+ [" summary" ] = new OpenApiString (" Bracing" ),
56+ };
57+ }
58+ return Task .CompletedTask ;
59+ });
60+ ```
61+
62+ In .NET 10 the transformer to do the same task will look like this:
63+
64+ ``` csharp
65+ options .AddSchemaTransformer ((schema , context , cancellationToken ) =>
66+ {
67+ if (context .JsonTypeInfo .Type == typeof (WeatherForecast ))
68+ {
69+ schema .Example = new JsonObject
70+ {
71+ [" date" ] = DateTime .Now .AddDays (1 ).ToString (" yyyy-MM-dd" ),
72+ [" temperatureC" ] = 0 ,
73+ [" temperatureF" ] = 32 ,
74+ [" summary" ] = " Bracing" ,
75+ };
76+ }
77+ return Task .CompletedTask ;
78+ });
79+ ```
80+
81+ Note that these changes will be necessary even if you congfigure the OpenAPI version to 3.0.
82+
3283## Authentication and authorization
3384
3485This section describes new features for authentication and authorization.
0 commit comments