Closed
Description
openedon Nov 30, 2023
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:
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.
- Note that this can't be a "normal" source generator because Roslyn doesn't support generating non-C# files.
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment