Tighten WithOrigin generic constraint for Front Door#16409
Tighten WithOrigin generic constraint for Front Door#16409eerhardt wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Update WithOrigin to require T : IComputeResource, IResourceWithEndpoints, making the constraint more restrictive. WithOrigin needs to accept an IComputeResource that has endpoints.
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16409Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16409" |
There was a problem hiding this comment.
Pull request overview
This PR tightens the generic constraint on AzureFrontDoorExtensions.WithOrigin<T> to ensure origins are compute resources that also expose endpoints, aligning the API contract with Front Door’s requirement to resolve an origin host address from a compute environment.
Changes:
- Updated
WithOrigin<T>to requireT : IComputeResource, IResourceWithEndpoints. - Adjusted the null-argument unit test to use a type (
ProjectResource) that satisfies the new constraint.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/Aspire.Hosting.Azure.Tests/AzureFrontDoorTests.cs | Updates the null-argument test to compile with the tightened WithOrigin<T> constraint. |
| src/Aspire.Hosting.Azure.FrontDoor/AzureFrontDoorExtensions.cs | Tightens WithOrigin<T>’s generic constraint to require compute resources with endpoints. |
| public static IResourceBuilder<AzureFrontDoorResource> WithOrigin<T>( | ||
| this IResourceBuilder<AzureFrontDoorResource> builder, | ||
| IResourceBuilder<T> resource) where T : IResourceWithEndpoints | ||
| IResourceBuilder<T> resource) where T : IComputeResource, IResourceWithEndpoints |
There was a problem hiding this comment.
The new generic constraint requires T to be an IComputeResource as well as IResourceWithEndpoints, but the XML docs above still describe T only as a resource with endpoints. Please update the <typeparam name="T"> documentation to reflect that T must be a compute resource with endpoints (to avoid confusing API consumers).
There was a problem hiding this comment.
@copilot apply changes based on this feedback
|
Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
|
Update WithOrigin to require T : IComputeResource, IResourceWithEndpoints, making the constraint more restrictive. WithOrigin needs to accept an IComputeResource that has endpoints.