Skip to content

Make AtsJsonCodeWriter a shared internal helper - #16677

Merged
Eric Erhardt (eerhardt) merged 1 commit into
microsoft:mainfrom
eerhardt:eerhardt/jsoncodewriter-sharing
May 5, 2026
Merged

Make AtsJsonCodeWriter a shared internal helper#16677
Eric Erhardt (eerhardt) merged 1 commit into
microsoft:mainfrom
eerhardt:eerhardt/jsoncodewriter-sharing

Conversation

@eerhardt

Copy link
Copy Markdown
Member

Description

AtsJsonCodeWriter was only used by the CLI and polyglot code generation projects, so exposing it from Aspire.TypeSystem added public API that consumers do not need. This moves the implementation to src\Shared\Json as an internal helper and link-compiles it into each project that uses it: CLI plus Go, Java, Python, Rust, and TypeScript codegen.

Validation:

  • restore.cmd
  • dotnet.cmd build for Aspire.TypeSystem, all affected code generation projects, and Aspire.Cli with /p:SkipNativeBuild=true

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

Move the JSON code writer out of Aspire.TypeSystem so it is not exposed as public API. Link the shared internal helper into each CLI and code generation project that uses it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

🚀 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/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16677

Or

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR removes an unnecessary public surface area exposure by relocating AtsJsonCodeWriter out of Aspire.TypeSystem and into src/Shared/Json, then link-compiling it into the CLI and polyglot code generation projects that consume it.

Changes:

  • Moved AtsJsonCodeWriter into Aspire.Shared.Json and made it internal-only.
  • Updated CLI and code generators (Go/Java/Python/Rust/TypeScript) to reference the new shared helper namespace.
  • Added shared-source <Compile Include="...AtsJsonCodeWriter.cs" Link="..."> entries to the affected projects.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Shared/Json/AtsJsonCodeWriter.cs Relocates the helper into Aspire.Shared.Json and restricts it to internal usage.
src/Aspire.Hosting.CodeGeneration.TypeScript/AtsTypeScriptCodeGenerator.cs Imports the new shared JSON helper namespace for relaxed JSON formatting.
src/Aspire.Hosting.CodeGeneration.TypeScript/Aspire.Hosting.CodeGeneration.TypeScript.csproj Link-compiles the shared AtsJsonCodeWriter into the TypeScript generator project.
src/Aspire.Hosting.CodeGeneration.Rust/AtsRustCodeGenerator.cs Imports the new shared JSON helper namespace.
src/Aspire.Hosting.CodeGeneration.Rust/Aspire.Hosting.CodeGeneration.Rust.csproj Link-compiles the shared AtsJsonCodeWriter into the Rust generator project.
src/Aspire.Hosting.CodeGeneration.Python/AtsPythonCodeGenerator.cs Imports the new shared JSON helper namespace.
src/Aspire.Hosting.CodeGeneration.Python/Aspire.Hosting.CodeGeneration.Python.csproj Link-compiles the shared AtsJsonCodeWriter into the Python generator project.
src/Aspire.Hosting.CodeGeneration.Java/AtsJavaCodeGenerator.cs Imports the new shared JSON helper namespace.
src/Aspire.Hosting.CodeGeneration.Java/Aspire.Hosting.CodeGeneration.Java.csproj Link-compiles the shared AtsJsonCodeWriter into the Java generator project.
src/Aspire.Hosting.CodeGeneration.Go/AtsGoCodeGenerator.cs Imports the new shared JSON helper namespace.
src/Aspire.Hosting.CodeGeneration.Go/Aspire.Hosting.CodeGeneration.Go.csproj Link-compiles the shared AtsJsonCodeWriter into the Go generator project.
src/Aspire.Cli/Commands/Sdk/SdkDumpCommand.cs Switches to the shared JSON helper namespace for relaxed JSON rendering.
src/Aspire.Cli/Aspire.Cli.csproj Link-compiles the shared AtsJsonCodeWriter into the CLI.

@eerhardt

Copy link
Copy Markdown
Member Author

/backport to release/13.3

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Started backporting to release/13.3 (link to workflow run)

@eerhardt
Eric Erhardt (eerhardt) merged commit 892a875 into microsoft:main May 5, 2026
1131 of 1140 checks passed
@eerhardt
Eric Erhardt (eerhardt) deleted the eerhardt/jsoncodewriter-sharing branch May 5, 2026 17:51
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 13.4 milestone May 5, 2026
Nell Shamrell-Harrington (nellshamrell) pushed a commit to nellshamrell/aspire that referenced this pull request May 18, 2026
Move the JSON code writer out of Aspire.TypeSystem so it is not exposed as public API. Link the shared internal helper into each CLI and code generation project that uses it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 5, 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.

4 participants