Skip to content

Add polyglot exports for MongoDB#14752

Merged
sebastienros merged 2 commits intorelease/13.2from
sebros/polyglot-mongodb
Feb 27, 2026
Merged

Add polyglot exports for MongoDB#14752
sebastienros merged 2 commits intorelease/13.2from
sebros/polyglot-mongodb

Conversation

@sebastienros
Copy link
Copy Markdown
Contributor

Related to #14069

Copilot AI review requested due to automatic review settings February 26, 2026 23:42
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 26, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14752

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14752"

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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/ValidationAppHost sample.
  • Update .gitignore rules 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 name parameter is missing the [ResourceName] attribute. Most Add* exports in the repo annotate resource-name parameters for analyzer/tooling support; consider adding [ResourceName] here as well for consistency with the other AddMongoDB overloads 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)

Comment on lines 100 to 104
/// <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)
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 27, 2026

🎬 CLI E2E Test Recordings

The following terminal recordings are available for commit 4f09c1b:

Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
AddPackageWhileAppHostRunningDetached ▶️ View Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
AgentInitCommand_WithMalformedMcpJson_ShowsErrorAndExitsNonZero ▶️ View Recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
CreateAndDeployToDockerCompose ▶️ View Recording
CreateAndDeployToDockerComposeInteractive ▶️ View Recording
CreateAndPublishToKubernetes ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateEmptyAppHostProject ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateStartWaitAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DescribeCommandResolvesReplicaNames ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
SecretCrudOnDotNetAppHost ▶️ View Recording
SecretCrudOnTypeScriptAppHost ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
StopAllAppHostsFromAppHostDirectory ▶️ View Recording
StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
StopNonInteractiveMultipleAppHostsShowsError ▶️ View Recording
StopNonInteractiveSingleAppHost ▶️ View Recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording

📹 Recordings uploaded automatically from CI run #22467372532

@sebastienros sebastienros merged commit cb2ea94 into release/13.2 Feb 27, 2026
680 of 683 checks passed
@sebastienros sebastienros deleted the sebros/polyglot-mongodb branch February 27, 2026 01:33
@dotnet-policy-service dotnet-policy-service bot added this to the 13.2 milestone Feb 27, 2026
Copilot AI pushed a commit that referenced this pull request Mar 10, 2026
* Add polyglot exports for MongoDB

* Fix mongodb healthcheck
@github-actions github-actions bot locked and limited conversation to collaborators Mar 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants