-
Notifications
You must be signed in to change notification settings - Fork 25.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update the "What's new in ASP.NET Core 10.0" for .NET 10 Preview 1 #34622
Comments
OpenAPI 3.1 supportdotnet/aspnetcore#59480 ASP.NET Core has added support for generating OpenAPI version 3.1 documents in .NET 10. Some of the changes you will see in the generated OpenAPI document include:
With this feature, the default OpenAPI version for generated documents will be 3.1, but you can easily change this builder.Services.AddOpenApi(options =>
{
// Specify the OpenAPI version to use.
options.OpenApiVersion = Microsoft.OpenApi.OpenApiSpecVersion.OpenApi3_0;
}); If you are generating the OpenAPI document at build time, you can select the OpenAPI version by setting the <!-- Configure build-time OpenAPI generation to produce an OpenAPI 3.0 document. -->
<OpenApiGenerateDocumentsOptions>--openapi-version OpenApi3_0</OpenApiGenerateDocumentsOptions> Breaking changesSupport for OpenAPI 3.1 requires an update to the underlying OpenAPI.NET library to a new major version, 2.0. options.AddSchemaTransformer((schema, context, cancellationToken) =>
{
if (context.JsonTypeInfo.Type == typeof(WeatherForecast))
{
schema.Example = new OpenApiObject
{
["date"] = new OpenApiString(DateTime.Now.AddDays(1).ToString("yyyy-MM-dd")),
["temperatureC"] = new OpenApiInteger(0),
["temperatureF"] = new OpenApiInteger(32),
["summary"] = new OpenApiString("Bracing"),
};
}
return Task.CompletedTask;
}); In .NET 10 the transformer to do the same task will look like this: options.AddSchemaTransformer((schema, context, cancellationToken) =>
{
if (context.JsonTypeInfo.Type == typeof(WeatherForecast))
{
schema.Example = new JsonObject
{
["date"] = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd"),
["temperatureC"] = 0,
["temperatureF"] = 32,
["summary"] = "Bracing",
};
}
return Task.CompletedTask;
}); Note that these changes will be necessary even if you congfigure the OpenAPI version to 3.0. |
OpenAPI in YamlASP.NET now supports serving the generated OpenAPI document in YAML format. To configure your application to serve the generated OpenAPI document in YAML format, app.MapOpenApi("/openapi/{documentName}.yaml"); Support for YAML is currently only available for the the OpenAPI served from the OpenAPI endpoint. |
Response description on ProducesResponseTypeThe ProducesAttribute, ProducesResponseTypeAttribute, and ProducesDefaultResponseType attributes now accept an optional string parameter, [HttpGet(Name = "GetWeatherForecast")]
[ProducesResponseType<IEnumerable<WeatherForecast>>(StatusCodes.Status200OK, Description = "The weather forecast for the next 5 days.")]
public IEnumerable<WeatherForecast> Get()
{ And the generated OpenAPI will be "responses": {
"200": {
"description": "The weather forecast for the next 5 days.",
"content": { Community contribution! 🙏 |
Better support for testing apps with top-level statementsdotnet/aspnetcore#58199 .NET 10 now has better support for testing apps that use top-level statements. In .NET 10, a source generator is used to generate the |
Blazor coverage thus far
Cross-links ... |
Route syntax highlighting for Blazor
|
@captainsafia @mikekistler Looks like this API was added months ago, but is only now being released with .NET 10. Detect if URL is local using
|
@danroth27, I don't see any draft info for SignalR in the comments here yet or for a couple others that have sections reserved in the draft. Should I look somewhere else, or will it be dropped here in the comments for those as well? I just wanted to make sure I wasn't missing it somehow, thanks. |
@wadepickett Everything new in Preview 1 is covered in the existing comments. That may mean some of the sections in the What's New draft may not have content yet. You can also see the merged ASP.NET Core release notes for .NET 10 Preview 1 here: dotnet/core#9740 |
Description
Update the "What's new in ASP.NET Core 10.0" for .NET 10 Preview 1
Page URL
https://learn.microsoft.com/en-us/aspnet/core/release-notes/aspnetcore-10.0?view=aspnetcore-10.0
Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/release-notes/aspnetcore-10.0.md
Document ID
4e75ad25-2c3f-b28e-6a91-ac79a9c683b6
Article author
@Rick-Anderson
Metadata
Related Issues
Associated WorkItem - 368778
The text was updated successfully, but these errors were encountered: