Add multi-language integrations guide#558
Conversation
New doc explaining how integration authors export their APIs for TypeScript AppHosts using [AspireExport], [AspireDto], [AspireExportIgnore], and [AspireUnion] attributes. Covers the analyzer (ASPIREEXPORT001-010), local development with project references in aspire.config.json, third-party attribute definitions, and a supported types reference. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ce9223b to
8b3d490
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
IEvangelist
left a comment
There was a problem hiding this comment.
Great start! I have several questions, nits, and suggestions.
| </PackageReference> | ||
| ``` | ||
|
|
||
| The analyzer reports 10 diagnostics (ASPIREEXPORT001–010) that help you get your exports right before users encounter runtime errors. |
There was a problem hiding this comment.
I don't think we should explicitly call out the number of diagnostics, as that's fragile. Instead, say more generically that there are a number of diagnostics available, and perhaps detail some of the common scenarios these diagnostics cover/handle.
We'll also need to add these diagnostic articles to the existing /diagnostics/overview/ and create a new article per diagnostic following the existing patterns.
It also seems like we need a ASPIREATS001 diag article too.
src/frontend/src/content/docs/extensibility/multi-language-integration-authoring.mdx
Outdated
Show resolved
Hide resolved
src/frontend/src/content/docs/extensibility/multi-language-integration-authoring.mdx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Since this arrticle falls under the extensibility node in the sidebar, we should link to it from the other TypeScript AppHost articles.
src/frontend/src/content/docs/extensibility/multi-language-integration-authoring.mdx
Outdated
Show resolved
Hide resolved
| // Your existing implementation... | ||
| } | ||
|
|
||
| [AspireExport] |
There was a problem hiding this comment.
We should have an example that uses ExposeMethods and ExposeProperties set to true, detailing what they are/what they do and when to use them. In fact, there are several other properties on this attribute that should be detailed.
There was a problem hiding this comment.
Most resources should have ExportProperties = true
|
|
||
| ## Third-party integrations | ||
|
|
||
| If your integration doesn't reference `Aspire.Hosting` directly (or you want to avoid a version dependency on the attribute types), you can define your own copies of the ATS attributes. The scanner discovers attributes by **full type name**, not by assembly reference. |
There was a problem hiding this comment.
Curious about this, how can you be an Aspire hosting integration without depending on Aspire.Hosting? Also, if this is such a concern - why not leave the abstractions, attributes, etc. in their own separate assembly?
There was a problem hiding this comment.
Yea, tbh this isn't interesting to add, it's an implementation detail.
src/frontend/src/content/docs/extensibility/multi-language-integration-authoring.mdx
Show resolved
Hide resolved
src/frontend/src/content/docs/extensibility/multi-language-integration-authoring.mdx
Outdated
Show resolved
Hide resolved
src/frontend/src/content/docs/extensibility/multi-language-integration-authoring.mdx
Outdated
Show resolved
Hide resolved
src/frontend/src/content/docs/extensibility/multi-language-integration-authoring.mdx
Outdated
Show resolved
Hide resolved
Co-authored-by: David Pine <david.pine@microsoft.com>
…language integration authoring guide
|
Hey @copilot, could you please update this PR to include new articles for the missing diagnostics that are called out? |
|
@IEvangelist I've opened a new pull request, #560, to work on those changes. Once the pull request is ready, I'll request review from you. |
| Add `[AspireExport]` to your `Add*`, `With*`, and `Run*` extension methods. The attribute takes a method name that becomes the TypeScript API: | ||
|
|
||
| ```csharp title="C# — MyDatabaseBuilderExtensions.cs" | ||
| #pragma warning disable ASPIREATS001 // ATS types are experimental |
There was a problem hiding this comment.
Maybe suggest to discard this warning in the csproj?
| | **Special** | `ParameterResource`, `ReferenceExpression`, `EndpointReference`, `CancellationToken` | | ||
| | **Nullable** | Any of the above as nullable (`T?`) | | ||
|
|
||
| Types that are **not** ATS-compatible include: `Action<T>`, `Func<T>`, `IConfiguration`, `ILogger` (unless explicitly exported), interpolated string handlers, and custom complex types without `[AspireExport]` or `[AspireDto]`. |
There was a problem hiding this comment.
Isn't that mostly wrong statements?
Most delegates are compatible. ILogger and even IServiceProvider are already exported. We might have some exports today that were not because of these, but we'll revisit them in 13.2.1 or 13.3 because in the meantime it has been aded.
Also Action maybe require the RunAsBackgroundSoemthing when it's invoked inline (and not referenced as a later callback)
- Don't hardcode diagnostic count, describe scenarios generically - Show NoWarn in csproj instead of #pragma for ASPIREATS001 - Add ExposeProperties/ExposeMethods examples (per sebastienros) - Fix supported types: delegates, ILogger, IServiceProvider are compatible - Remove Third-party integrations section (implementation detail per davidfowl) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tegrations Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
New documentation for integration authors explaining how to make their Aspire hosting integrations work with TypeScript AppHosts and other non-.NET app hosts.
Relates to dotnet/aspire#14069 (Part 4: Extensibility for Integration Authors)
Changes
extensibility/multi-language-integration-authoring.mdxcovering:[AspireExport]on extension methods and resource types[AspireDto]for configuration objects[AspireExportIgnore]for incompatible overloads[AspireUnion]for multi-type parametersAspire.Hosting.Integration.Analyzers) with all 10 diagnostic rules (ASPIREEXPORT001–010)aspire.config.json(from Add project reference support for polyglot apphost integrations aspire#14821)Testing
[AspireExport], referenced it via.csprojpath in a TypeScript AppHost, confirmed SDK generation and resource startup (test project at/tmp/aspire-projref-e2e/)