Add polyglot exports for MongoDB#14752
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14752Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14752" |
There was a problem hiding this comment.
Pull request overview
Adds ATS/polyglot export annotations for the MongoDB hosting integration and introduces a TypeScript ValidationAppHost sample intended to exercise the generated TypeScript SDK for MongoDB.
Changes:
- Annotate MongoDB hosting extension methods with
[AspireExport]/[AspireExportIgnore]for TypeScript AppHost codegen. - Add a new
playground/polyglot/TypeScript/Aspire.Hosting.MongoDB/ValidationAppHostsample. - Update
.gitignorerules affecting TypeScript AppHost artifacts.
Reviewed changes
Copilot reviewed 9 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Aspire.Hosting.MongoDB/MongoDBBuilderExtensions.cs | Adds ATS export/ignore attributes for MongoDB extension methods. |
| playground/polyglot/TypeScript/Aspire.Hosting.MongoDB/ValidationAppHost/tsconfig.json | TypeScript compiler configuration for the MongoDB ValidationAppHost. |
| playground/polyglot/TypeScript/Aspire.Hosting.MongoDB/ValidationAppHost/package.json | Node/TypeScript project definition for the ValidationAppHost. |
| playground/polyglot/TypeScript/Aspire.Hosting.MongoDB/ValidationAppHost/package-lock.json | Locked dependency graph for the ValidationAppHost. |
| playground/polyglot/TypeScript/Aspire.Hosting.MongoDB/ValidationAppHost/apphost.ts | Validation script exercising exported MongoDB capabilities from TypeScript. |
| playground/polyglot/TypeScript/Aspire.Hosting.MongoDB/ValidationAppHost/apphost.run.json | Run profile settings for the ValidationAppHost. |
| playground/polyglot/TypeScript/Aspire.Hosting.MongoDB/ValidationAppHost/.modules/transport.ts | Generated TypeScript AppHost transport layer output. |
| playground/polyglot/TypeScript/Aspire.Hosting.MongoDB/ValidationAppHost/.modules/base.ts | Generated TypeScript AppHost base types output. |
| playground/polyglot/TypeScript/Aspire.Hosting.MongoDB/ValidationAppHost/.modules/.codegen-hash | Generated codegen hash artifact. |
| playground/polyglot/TypeScript/Aspire.Hosting.MongoDB/ValidationAppHost/.aspire/settings.json | Polyglot AppHost settings referencing the MongoDB package. |
| .gitignore | Modifies ignore rules for TypeScript AppHost outputs. |
Files not reviewed (1)
- playground/polyglot/TypeScript/Aspire.Hosting.MongoDB/ValidationAppHost/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)
src/Aspire.Hosting.MongoDB/MongoDBBuilderExtensions.cs:54
- This exported overload’s
nameparameter is missing the[ResourceName]attribute. MostAdd*exports in the repo annotate resource-name parameters for analyzer/tooling support; consider adding[ResourceName]here as well for consistency with the otherAddMongoDBoverloads and other integrations.
[AspireExport("addMongoDB", Description = "Adds a MongoDB container resource")]
public static IResourceBuilder<MongoDBServerResource> AddMongoDB(this IDistributedApplicationBuilder builder,
string name,
int? port = null,
IResourceBuilder<ParameterResource>? userName = null,
IResourceBuilder<ParameterResource>? password = null)
playground/polyglot/TypeScript/Aspire.Hosting.MongoDB/ValidationAppHost/.modules/transport.ts
Show resolved
Hide resolved
| /// <param name="name">The name of the resource. This name will be used as the connection string name when referenced in a dependency.</param> | ||
| /// <param name="databaseName">The name of the database. If not provided, this defaults to the same value as <paramref name="name"/>.</param> | ||
| /// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns> | ||
| [AspireExport("addDatabase", Description = "Adds a MongoDB database resource")] | ||
| public static IResourceBuilder<MongoDBDatabaseResource> AddDatabase(this IResourceBuilder<MongoDBServerResource> builder, [ResourceName] string name, string? databaseName = null) |
There was a problem hiding this comment.
Within this exported AddDatabase API, a health check is registered (healthCheckKey + AddMongoDb(...)), but the returned builder doesn’t attach it to the resource (missing .WithHealthCheck(healthCheckKey) on the returned builder). This prevents WaitFor(...)/dashboard health integration from using the check for this database resource; return the builder with the health check applied, consistent with other database resources.
🎬 CLI E2E Test RecordingsThe following terminal recordings are available for commit
📹 Recordings uploaded automatically from CI run #22467372532 |
* Add polyglot exports for MongoDB * Fix mongodb healthcheck
Related to #14069