Friday, May 2, 2025

ASP.NET Core 10.0: OpenAPI 3.1 Support

From ASP.NET Core 10.0, the default OpenAPI version would be 3.1.x. Prior to ASP.NET Core 10.0, the default OpenAPI version was 3.0.x for as long as I could remember.
OpenAPI: 3.1.x
While this looks like a minor version bump, this is a significant update with breaking changes. If you want to keep using OpenAPI version 3.0.x, you can do so as follows:
builder.Services.AddOpenApi(x =>
{
    x.OpenApiVersion = Microsoft.OpenApi.OpenApiSpecVersion.OpenApi3_0;
});
If you are generating the OpenAPI document at build time, you can add the following MSBiild item.
<OpenApiGenerateDocumentsOptions>--openapi-version OpenApi3_0</OpenApiGenerateDocumentsOptions>
Hope this helps.

Happy Coding.

Regards,
Jaliya

No comments:

Post a Comment