Update NuGet packages and fix build warnings#73
Conversation
There was a problem hiding this comment.
Pull request overview
This PR attempts to update NuGet packages to newer versions and fix Swagger-related build warnings. However, the changes introduce multiple critical compilation errors due to incorrect API usage and potentially non-existent package versions.
Changes:
- Update Radzen.Blazor from 9.0.4 to 9.0.5 (minor update, low risk)
- Update Microsoft.AspNetCore.TestHost from 10.0.2 to 10.0.3 (patch update, low risk)
- Update Microsoft.SemanticKernel from 1.20.1 to 1.71.0 (suspicious version jump)
- Update Swashbuckle.AspNetCore from 7.3.2 to 10.1.4 (major version jump with breaking changes)
- Modify ConfigureSwaggerOptions.cs to adapt to new Swagger API (contains critical errors)
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/ResidencyRoll.Web/ResidencyRoll.Web.csproj | Minor version update to Radzen.Blazor UI component library |
| src/ResidencyRoll.Tests/ResidencyRoll.Tests.csproj | Patch version update to ASP.NET Core test hosting package |
| src/ResidencyRoll.Api/ResidencyRoll.Api.csproj | Major version updates to Semantic Kernel and Swashbuckle packages with potential compatibility issues |
| src/ResidencyRoll.Api/Configuration/ConfigureSwaggerOptions.cs | Attempted migration to new Swagger API, but contains incorrect namespace and non-existent API usage |
| using Microsoft.AspNetCore.Authentication.JwtBearer; | ||
| using Microsoft.Extensions.Options; | ||
| using Microsoft.OpenApi.Models; | ||
| using Microsoft.OpenApi; |
There was a problem hiding this comment.
The namespace change from Microsoft.OpenApi.Models to Microsoft.OpenApi is incorrect. The types used in this file (OpenApiInfo, OpenApiSecurityScheme, SecuritySchemeType, ParameterLocation, OpenApiSecurityRequirement) are located in the Microsoft.OpenApi.Models namespace, not the root Microsoft.OpenApi namespace. This will cause compilation errors. The using statement should be using Microsoft.OpenApi.Models; to maintain access to these types.
| using Microsoft.OpenApi; | |
| using Microsoft.OpenApi.Models; |
| options.AddSecurityRequirement(document => new OpenApiSecurityRequirement | ||
| { | ||
| { | ||
| new OpenApiSecurityScheme | ||
| { | ||
| Reference = new OpenApiReference | ||
| { | ||
| Type = ReferenceType.SecurityScheme, | ||
| Id = "Bearer" | ||
| } | ||
| }, | ||
| Array.Empty<string>() | ||
| new OpenApiSecuritySchemeReference("Bearer", document, null), | ||
| new List<string>() | ||
| } | ||
| }); |
There was a problem hiding this comment.
The AddSecurityRequirement method signature has been changed to accept a lambda function with a document parameter, but this API is not standard for Swashbuckle.AspNetCore. The typical AddSecurityRequirement method accepts an OpenApiSecurityRequirement instance directly, not a factory function. This change appears to be using a non-existent API and will cause compilation errors. The correct approach is to use the original pattern: create the OpenApiSecurityRequirement object with a proper OpenApiSecurityScheme reference.
| } | ||
| }, | ||
| Array.Empty<string>() | ||
| new OpenApiSecuritySchemeReference("Bearer", document, null), |
There was a problem hiding this comment.
The OpenApiSecuritySchemeReference type does not exist in the Microsoft.OpenApi.Models namespace. The correct approach when updating to Swashbuckle.AspNetCore 10.x is to use an OpenApiSecurityScheme with a Reference property pointing to an OpenApiReference object. The constructor call with three parameters (id, document, null) does not match any known API in the OpenAPI or Swashbuckle libraries.
Update various NuGet packages to their latest versions and resolve build warnings related to the Swagger configuration.