Open
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15649Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15649" |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR unifies Aspire Type System (ATS) environment-variable exports across polyglot app hosts by consolidating multiple specialized WithEnvironment* capability exports into a single withEnvironment(name, value) capability that accepts a broader set of value types.
Changes:
- Introduces an internal
withEnvironmentdispatcher export that accepts a union of supported environment value types (string, expressions, endpoint refs, parameters, connection strings, value providers). - Removes specialized ATS exports (and generated polyglot APIs) like
withEnvironmentExpression,withEnvironmentEndpoint,withEnvironmentParameter, etc., updating TypeScript/Python codegen snapshots and ATS baselines accordingly. - Adds support types/interfaces for dispatching custom environment behavior and exports
IValueProvider/IManifestExpressionProviderinto ATS.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts | Snapshot updates reflecting unified TS withEnvironment union-typed API and removal of specialized methods. |
| tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/HostingContainerResourceCapabilities.verified.txt | Removes specialized environment capability entries from TS capability baseline snapshot. |
| tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py | Snapshot updates reflecting unified Python with_env union typing and removal of specialized methods/options. |
| src/Aspire.Hosting/api/Aspire.Hosting.Capabilities.txt | ATS baseline updated: withEnvironment now takes a union of supported types; specialized exports removed. |
| src/Aspire.Hosting/ResourceBuilderExtensions.cs | Adds internal dispatcher export, value-provider wiring, and reflection-based custom dispatch mechanism. |
| src/Aspire.Hosting/ApplicationModel/IValueWithCustomWithEnvironment.cs | Introduces a new experimental interface for value-specific WithEnvironment dispatch behavior. |
| src/Aspire.Hosting/ApplicationModel/IValueProvider.cs | Exports IValueProvider into ATS. |
| src/Aspire.Hosting/ApplicationModel/IManifestExpressionProvider.cs | Exports IManifestExpressionProvider into ATS. |
| src/Aspire.Hosting.CodeGeneration.TypeScript/AtsTypeScriptCodeGenerator.cs | Updates TS generator to emit proper TS unions for ATS union parameters. |
| src/Aspire.Hosting.Azure/AzureBicepResourceExtensions.cs | Stops exporting Azure-specific withEnvironmentFrom* ATS methods; routes through unified environment API. |
| src/Aspire.Hosting.Azure/AzureBicepResource.cs | Makes BicepOutputReference provide custom WithEnvironment dispatch. |
| src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultSecretResource.cs | Adds custom WithEnvironment dispatch for Key Vault secret resource values. |
| src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultSecretReference.cs | Adds custom WithEnvironment dispatch for Key Vault secret references. |
| src/Aspire.Hosting.SqlServer/api/Aspire.Hosting.SqlServer.ats.txt | Refreshes checked-in ATS baseline for SqlServer package to match new shared capability set. |
| playground/polyglot/TypeScript/Aspire.Hosting/ValidationAppHost/apphost.ts | Updates playground usage to call unified withEnvironment for endpoint/parameter/connection-string values. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure/ValidationAppHost/apphost.ts | Updates playground usage to call unified withEnvironment for Bicep output & Key Vault secret values. |
| playground/polyglot/Python/Aspire.Hosting/ValidationAppHost/apphost.py | Updates playground usage to call unified with_environment for endpoint/parameter/connection-string values. |
| playground/polyglot/Python/Aspire.Hosting.Azure/ValidationAppHost/apphost.py | Updates playground usage to call unified with_environment for Bicep output & Key Vault secret values. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
🎬 CLI E2E Test Recordings — 52 recordings uploaded (commit View recordings
📹 Recordings uploaded automatically from CI run #23667050573 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Unifies ATS
WithEnvironmentexports so polyglot apphosts use a singlewithEnvironment(name, value)API, following the same abstraction pattern used forwithReference.This removes the specialized ATS export names for environment values, keeps the existing runtime C# overloads intact, updates the TypeScript generator and snapshots, and refreshes the checked-in ATS capability baselines.
Validation:
./dotnet.sh test tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.csproj -- --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"./dotnet.sh test tests/Aspire.Hosting.Azure.Tests/Aspire.Hosting.Azure.Tests.csproj -- --filter-method "*.WithEnvironment_AddsKeyVaultSecretReference" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: