Repository navigation
[release/17.0] Mark resource trait APIs experimental - #22206
Jose Perez Rodriguez (joperezr) merged 2 commits into
Conversation
Resource traits (WithTrait, WithTags, WithDisplayOrder, TraitAnnotation,
DisplayOrderAnnotation) are new in 17.0 on stable Aspire.Hosting. Trait names
are free-form strings and the reserved names are still internal, so mark the
APIs [Experimental("ASPIRERESOURCETRAITS001")] until well-known traits are
designed.
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 22206Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 22206" |
This comment has been minimized.
This comment has been minimized.
| /// <summary> | ||
| /// Shared diagnostic ID for resource traits, tags, and display order. | ||
| /// </summary> | ||
| public const string DiagnosticId = "ASPIRERESOURCETRAITS001"; |
There was a problem hiding this comment.
honestly I'd rather put the strings directly in the Experimental attributes. The reasoning being it is really easy to query the APIs that use it
There was a problem hiding this comment.
Done
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the changes marking resource trait and display-order APIs as experimental.
No open issues 🎉
What changed in this PR
Marks resource trait and display-order APIs in Aspire.Hosting as experimental for 17.0, addressing API review feedback from #22185 while preserving their runtime behavior.
Changes:
- Applies
ASPIRERESOURCETRAITS001to trait extensions, the polyglot tags adapter, and annotation types. - Updates TypeScript and Go snapshots to include experimental documentation notices.
- Documents the diagnostic and suppresses it for existing internal, test, and playground consumers.
| File | Description |
|---|---|
| tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj | Suppresses the diagnostic for hosting tests. |
| tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts | Adds experimental tags to generated API documentation. |
| tests/Aspire.Hosting.CodeGeneration.Go.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.go | Adds experimental notices to generated API documentation. |
| src/Aspire.Hosting/ResourceTraitBuilderExtensions.cs | Marks extension methods and the polyglot adapter experimental. |
| src/Aspire.Hosting/ApplicationModel/TraitAnnotation.cs | Marks trait annotations experimental. |
| src/Aspire.Hosting/ApplicationModel/ResourceTraitSnapshotProperties.cs | Suppresses the diagnostic in snapshot publishing. |
| src/Aspire.Hosting/ApplicationModel/ResourceTraitDiagnostics.cs | Defines the shared diagnostic ID and documentation URL format. |
| src/Aspire.Hosting/ApplicationModel/DisplayOrderAnnotation.cs | Marks display-order annotations experimental. |
| playground/TestShop/TestShop.AppHost/AppHost.cs | Suppresses the diagnostic for existing sample usage. |
| docs/list-of-diagnostics.md | Documents the new diagnostic and affected APIs. |
Review effort: Balanced
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot App <[email protected]>
Tests selector52 / 101 PR test projects · 4 PR jobs, from 8 changed files. Selected PR test projects (52 / 101)
Selected PR jobs (4)
How these were chosen — grouped by what changed
🔧 show 43
🧪 📦 affected project 📦 affected project 📄 🧪 🧪 Job reasons
Selection computed for commit |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
4c46aa7
into
release/17.0
|
✅ No documentation update needed. Step 5 branch: excluded → base_branch_is_release, title_release_prefix (backport: base |
Description
Addresses the API review feedback in #22185 (comment): resource traits are a new concept on stable
Aspire.Hostingin 17.0, trait names are free-form strings, and the reserved names that get special handling (such as the tag trait) are still internal. This marks the trait APIs experimental so the shape can still change once well-known traits are designed.New diagnostic:
ASPIRERESOURCETRAITS001(docs linkhttps://aka.ms/aspire/diagnostics/ASPIRERESOURCETRAITS001).Marked
[Experimental]:ResourceTraitBuilderExtensions.WithTraitResourceTraitBuilderExtensions.WithTags, including the internalwithTagspolyglot adapterResourceTraitBuilderExtensions.WithDisplayOrder(this replacedWithDashboardPositionin release/17.0)TraitAnnotationDisplayOrderAnnotationThe attribute is applied to each member, not to the extension class.
[Experimental]on a type is only reported where the type name appears, and extension-method calls such asbuilder.WithTags(...)never name the containing class, so a class-level attribute would not warn C# callers.Other changes:
withTrait,withTagsandwithDisplayOrderas experimental, so their snapshots were updated.docs/list-of-diagnostics.mdlists the new ID.Aspire.Hosting.Testsand the TestShop playground suppress the new diagnostic.Making
ResourceTypeDisplayNameAnnotationinternal, the other API review comment, is handled separately in #22205.Follow-up: add the aka.ms redirect and an aspire.dev diagnostics page for
ASPIRERESOURCETRAITS001.Validation
Aspire.Hosting.Tests:ResourceTraitBuilderTests,ResourceNotificationTests,DashboardServiceDataTerminalTestspass.Aspire.Hosting.CodeGeneration.{TypeScript,Go,Java,Python,Rust}.Testspass.Aspire.Dashboard.Tests,Aspire.Cli.TestsandTestShop.AppHostbuild.