Skip to content

cli: support YAML as alternative config format#15517

Closed
maxtorqs wants to merge 1 commit intomicrosoft:mainfrom
maxtorqs:yaml-config-support
Closed

cli: support YAML as alternative config format#15517
maxtorqs wants to merge 1 commit intomicrosoft:mainfrom
maxtorqs:yaml-config-support

Conversation

@maxtorqs
Copy link

Description

Add aspire.config.yaml/.yml as alternatives to aspire.config.json. YAML is parsed via YamlDotNet's AOT-safe event-based API, converted to JSON, then deserialized through the existing source-gen pipeline. Save preserves the source format. Errors if multiple formats exist.

Things covered:

  • New feature implementation (YAML reading/writing)
  • AOT compatibility (event-based parser, no reflection)
  • Format preservation on save
  • Multiple format detection with clear error
  • ConfigurationService + ConfigurationHelper YAML support
  • Error strings + xlf translations auto-generated
  • Unit tests
  • Manual E2E test (config list, config set with YAML file)

Things to consider:

  • The xlf files have state="new" for the new strings
  • Schema validation: there's a JSON schema but YAML users won't get schema validation in editors, could be a follow-up
  • The Exists() check is used in several places: updated it to check all formats

Not in scope (potential follow-ups):

  • YAML schema for editor support
  • aspire new scaffolding still creates JSON by default (correct per issue: "JSON/JSONC would remain the default")
  • TOML support (mentioned in issue as a possible alternative)

Fixes #15508

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?

Add aspire.config.yaml/.yml as alternatives to aspire.config.json.
YAML is parsed via YamlDotNet's AOT-safe event-based API, converted
to JSON, then deserialized through the existing source-gen pipeline.
Save preserves the source format. Errors if multiple formats exist.

Closes microsoft#15508
@github-actions
Copy link
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 -- 15517

Or

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

@mitchdenny
Copy link
Member

It doesn't make sense to introduce another configuration file format at this time since all it does is introduce ambiguity.

@adamint
Copy link
Member

adamint commented Mar 24, 2026

Please avoid implementation of a feature request until we can comment on that feature request.

I agree with Mitch, there is dubious benefit to this change. Closing

@adamint adamint closed this Mar 24, 2026
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.

Support YAML as an alternative format for aspire.config.json

3 participants