Skip to content

Add multi-language integrations guide#558

Merged
IEvangelist merged 8 commits intorelease/13.2from
multi-language-authoring
Mar 19, 2026
Merged

Add multi-language integrations guide#558
IEvangelist merged 8 commits intorelease/13.2from
multi-language-authoring

Conversation

@davidfowl
Copy link
Contributor

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

  • New doc: extensibility/multi-language-integration-authoring.mdx covering:
    • [AspireExport] on extension methods and resource types
    • [AspireDto] for configuration objects
    • [AspireExportIgnore] for incompatible overloads
    • [AspireUnion] for multi-type parameters
    • Analyzer package (Aspire.Hosting.Integration.Analyzers) with all 10 diagnostic rules (ASPIREEXPORT001–010)
    • Third-party integration support (copy attributes, no package dependency needed)
    • Local development with project references in aspire.config.json (from Add project reference support for polyglot apphost integrations aspire#14821)
    • Testing workflow, supported types reference
  • Sidebar entry added under Extensibility section

Testing

  • Verified page renders correctly on Astro dev server via playwright-cli
  • All sections, code blocks, tables, tabs, and links confirmed working
  • E2E validated: Created a custom integration with [AspireExport], referenced it via .csproj path in a TypeScript AppHost, confirmed SDK generation and resource startup (test project at /tmp/aspire-projref-e2e/)

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>
@davidfowl davidfowl requested a review from IEvangelist as a code owner March 19, 2026 14:10
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@davidfowl davidfowl force-pushed the multi-language-authoring branch from ce9223b to 8b3d490 Compare March 19, 2026 14:21
@davidfowl davidfowl changed the title Add multi-language integration authoring guide Add multi-language integrations guide Mar 19, 2026
davidfowl and others added 2 commits March 19, 2026 10:22
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Member

@IEvangelist IEvangelist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this arrticle falls under the extensibility node in the sidebar, we should link to it from the other TypeScript AppHost articles.

// Your existing implementation...
}

[AspireExport]
Copy link
Member

@IEvangelist IEvangelist Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, tbh this isn't interesting to add, it's an implementation detail.

Co-authored-by: David Pine <david.pine@microsoft.com>
@IEvangelist
Copy link
Member

Hey @copilot, could you please update this PR to include new articles for the missing diagnostics that are called out?

Copy link
Contributor

Copilot AI commented Mar 19, 2026

@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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

davidfowl and others added 2 commits March 19, 2026 11:55
- 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>
@IEvangelist IEvangelist merged commit 9887940 into release/13.2 Mar 19, 2026
1 check passed
@IEvangelist IEvangelist deleted the multi-language-authoring branch March 19, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants