Skip to content

Automatic generation of ConfigurationSchema.json files #1146

Closed

Description

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:

"ConfigurationOptions": {
"type": "object",
"description": "The options relevant to a set of redis connections.",
"properties": {
"AbortOnConnectFail": {
"type": "boolean",
"description": "Gets or sets whether connect/configuration timeouts should be explicitly notified via a TimeoutException."
},
"AllowAdmin": {
"type": "boolean",
"description": "Indicates whether admin operations should be allowed."
},

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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