Skip to content

Automatic generation of ConfigurationSchema.json files #1146

@eerhardt

Description

@eerhardt

Today, each Aspire Component has a ConfigurationSchema.json file that is added to the nupkg to provide JSON intellisense in appsettings.json files in the IDE:

https://github.com/dotnet/aspire/blob/a3f058c8d6bcb8f3b69239363b0c7832b027f4f0/src/Components/Aspire.StackExchange.Redis/ConfigurationSchema.json#L21-L32

image

Currently these .json files are hand-crafted. We should be able to generate them. My high-level thinking is:

  • Add a "post-compile" task to the build that uses Roslyn APIs to inspect and generate these .json files based on a supplied set of Types and config paths.
  • The ConfigurationSchema.json files stay checked into source control
    • This allows us to inspect, link to, and see the history of the file over time.
  • If the generated file is different than the checked-in file, fail the build.
  • The generator has an MSBuild option to overwrite the file, so when it needs to be updated you can simply dotnet build /p:UpdateConfigurationSchema=true and produce the new file

Metadata

Metadata

Assignees

Labels

area-integrationsIssues pertaining to Aspire Integrations packages

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions