You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/specs/polyglot-apphost.md
+75-4Lines changed: 75 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,7 @@ You run `aspire run`, and the CLI starts both the .NET AppHost server and your g
39
39
-**DTO** - A serializable data transfer object (marked with `[AspireDto]`)
40
40
-**Enum** - A .NET enum type that serializes as its string name
41
41
-**Exported Value** - An immutable predefined value (marked with `[AspireValue]`) emitted into guest SDK catalogs
42
+
-**Documentation** - Structured XML documentation captured during ATS scanning and emitted by guest SDK generators
42
43
43
44
---
44
45
@@ -47,7 +48,7 @@ You run `aspire run`, and the CLI starts both the .NET AppHost server and your g
47
48
ATS leverages .NET's rich type system rather than replacing it. The `[AspireExport]`, `[AspireDto]`, and `[AspireValue]` attributes mark what should be exposed—the rest is inferred from the C# signatures. This means:
- The scanner **extracts types, parameters, and relationships** at build time
51
+
- The scanner **extracts types, parameters, relationships, and documentation** at build time
51
52
- Code generators produce **idiomatic APIs** in each target language
52
53
53
54
ATS then flattens .NET's polymorphism into a simple, portable model that any language can work with:
@@ -959,7 +960,67 @@ The CLI generates language-specific SDKs from ATS capabilities.
959
960
1. Load assemblies from AppHost server build
960
961
2. Scan for `[AspireExport]`, `[AspireDto]`, and `[AspireValue]` metadata using `AtsCapabilityScanner`
961
962
3. Expand interface targets to concrete implementations
962
-
4. Generate language-specific SDK, including predefined value catalogs
963
+
4. Capture XML documentation for generated public SDK surfaces
964
+
5. Generate language-specific SDK, including predefined value catalogs and documentation comments
965
+
966
+
### Documentation Model
967
+
968
+
ATS treats C# XML documentation as part of the code-generation model, not as export-shaping metadata. The scanner captures documentation into `AtsDocumentationInfo` so every language generator can choose how to render it.
969
+
970
+
Documentation is captured for:
971
+
972
+
- Exported handle and resource types
973
+
- Capabilities, including summaries, remarks, returns, and parameters
974
+
- Callback parameters
975
+
- DTO types and DTO properties
976
+
- Enum types and enum values
977
+
- Exported value catalogs and exported values
978
+
979
+
`[AspireExport(Description = "...")]` remains compatibility metadata and is only used as a fallback summary when XML summary documentation is unavailable (either because the member has no XML documentation or because its `<summary>`/`<ats-summary>` text is missing). New API documentation should prefer XML docs so C# and generated guest SDK documentation stay tied together.
980
+
981
+
First-level `ats-*` tags override the matching standard XML documentation when generated SDKs need language-neutral or polyglot-specific text:
982
+
983
+
| Standard tag | ATS override |
984
+
|--------------|--------------|
985
+
|`<summary>`|`<ats-summary>`|
986
+
|`<param name="...">`|`<ats-param name="...">`|
987
+
|`<returns>`|`<ats-returns>`|
988
+
|`<remarks>`|`<ats-remarks>`|
989
+
990
+
An empty `ats-*` override intentionally suppresses the matching standard documentation. This is useful when C# documentation is correct for .NET callers but misleading for generated guest language APIs.
991
+
992
+
```csharp
993
+
/// <summary>
994
+
/// Adds a PostgreSQL resource to the application model.
995
+
/// </summary>
996
+
/// <ats-summary>
997
+
/// Adds a PostgreSQL server resource to the application model.
/// See <ats-seecref="method:RedisResource.withPersistence" /> and
1017
+
/// <ats-seecref="field:RedisDefaults.Port" />.
1018
+
/// </remarks>
1019
+
```
1020
+
1021
+
The supported reference kinds are `type`, `method`, and `field`. The target uses dot notation over generated polyglot-visible identifiers and must not use C# generic type syntax. TypeScript currently renders these references as JSDoc `{@link ...}` tags.
1022
+
1023
+
TypeScript renders captured documentation as JSDoc on generated classes, interfaces, enums, enum values, exported values, methods, method parameters, callback option parameters, and return values. Other language generators should consume the same `AtsDocumentationInfo` model and render documentation in the idiomatic format for that language.
963
1024
964
1025
### Capability Expansion
965
1026
@@ -1487,18 +1548,28 @@ public sealed class AtsContext
1487
1548
-`ExpandedTargetTypeIds` - Concrete types for interface targets
1488
1549
-`ReturnType` - Return type reference with category
0 commit comments