Description
The documentation incorrectly showed builder.AddOpenApi() when AddOpenApi() is an extension method on IServiceCollection, not WebApplicationBuilder.
Changes
Lines 135-136: Updated service registration to use builder.Services.AddOpenApi() instead of builder.AddOpenApi()
Metadata: Added ai-usage: ai-assisted and updated ms.date per repository guidelines
Example
Before:
builder.AddOpenApi(); // Adds "v1" by default
builder.AddOpenApi("v2");
builder.Services.AddScoped();
After:
builder.Services.AddOpenApi(); // Adds "v1" by default
builder.Services.AddOpenApi("v2");
builder.Services.AddScoped();
This aligns with standard ASP.NET Core DI patterns and the actual API surface.
Page URL
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/openapi/using-openapi-documents?view=aspnetcore-10.0
Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/openapi/using-openapi-documents.md
Document ID
472b10ab-681b-f631-040d-025ef0a02329
Platform Id
c973de58-a013-4aa0-ccef-0bd78e4749db
Article author
@captainsafia
Metadata
- ID: 472b10ab-681b-f631-040d-025ef0a02329
- PlatformId: c973de58-a013-4aa0-ccef-0bd78e4749db
- Service: aspnet-core
- Sub-service: fundamentals
Related Issues
Manually created ADO tracking issue
Description
The documentation incorrectly showed builder.AddOpenApi() when AddOpenApi() is an extension method on IServiceCollection, not WebApplicationBuilder.
Changes
Lines 135-136: Updated service registration to use builder.Services.AddOpenApi() instead of builder.AddOpenApi()
Metadata: Added ai-usage: ai-assisted and updated ms.date per repository guidelines
Example
Before:
builder.AddOpenApi(); // Adds "v1" by default
builder.AddOpenApi("v2");
builder.Services.AddScoped();
After:
builder.Services.AddOpenApi(); // Adds "v1" by default
builder.Services.AddOpenApi("v2");
builder.Services.AddScoped();
This aligns with standard ASP.NET Core DI patterns and the actual API surface.
Page URL
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/openapi/using-openapi-documents?view=aspnetcore-10.0
Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/openapi/using-openapi-documents.md
Document ID
472b10ab-681b-f631-040d-025ef0a02329
Platform Id
c973de58-a013-4aa0-ccef-0bd78e4749db
Article author
@captainsafia
Metadata
Related Issues
Manually created ADO tracking issue