Skip to content

Commit

Permalink
close #2636: added json schemas for Aspire.Hosting.AppHost and Aspire…
Browse files Browse the repository at this point in the history
….Hosting.Azure (#4912)

Description
fixed an issues with intellisense inside appsettings.json when using Aspire.Hosting.AppHost or Aspire.Hosting.Azure

Changes:

added AspireAppHostConfiguration.json file and included it into Aspire.Host.AppHosting nuget package
added src/Aspire.Hosting.Azure/AspireAzureConfigurationSchema.json and included it into Aspire.Host.Azure package

* fix: added appsettings intellisence to show Parameters json property

* feat: added Aspire Hosting Azure json schema

* fixed PR comments

* PR feedback

Add some more descriptions and tweak wording.

Fix #2636
---------

Co-authored-by: Eric Erhardt <[email protected]>
  • Loading branch information
vladimir-shirmanov and eerhardt authored Aug 26, 2024
1 parent 9757b4f commit 4251f91
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.AppHost/Aspire.Hosting.AppHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</PropertyGroup>

<ItemGroup>
<None Include="**/*.props;**/*.targets" Pack="true" PackagePath="%(RecursiveDir)%(Filename)%(Extension)" />
<None Include="**/*.props;**/*.targets;AspireAppHostConfiguration.json" Pack="true" PackagePath="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 9 additions & 0 deletions src/Aspire.Hosting.AppHost/AspireAppHostConfiguration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "object",
"properties": {
"Parameters": {
"description": ".NET Aspire parameter configuration. A parameter's value will be retrieved from the property with the same name.",
"type": "object"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
<ProjectCapability Include="Aspire" Condition=" '$(IsAspireHost)' == 'true' " />
</ItemGroup>

<ItemGroup>
<JsonSchemaSegment Include="$(MSBuildThisFileDirectory)..\AspireAppHostConfiguration.json"
FilePathPattern="appsettings\..*json" />
</ItemGroup>

<Target Name="_CreateAspireProjectResources">

<ItemGroup>
Expand Down
4 changes: 4 additions & 0 deletions src/Aspire.Hosting.Azure/Aspire.Hosting.Azure.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
<EmbeddedResource Include="Bicep\*.bicep" />
</ItemGroup>

<ItemGroup>
<None Include="**/*.targets;AspireAzureConfigurationSchema.json" Pack="true" PackagePath="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Aspire.Hosting\Aspire.Hosting.csproj" />
<PackageReference Include="System.IO.Hashing" />
Expand Down
44 changes: 44 additions & 0 deletions src/Aspire.Hosting.Azure/AspireAzureConfigurationSchema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"type": "object",
"properties": {
"Azure": {
"description": "Azure provisioning information. This section is used to create Azure resources for the app.",
"type": "object",
"properties": {
"SubscriptionId": {
"description": "Azure Subscription Id that will be used to host the resources.",
"type": "string"
},
"ResourceGroup": {
"description": "Azure Resource Group name where to create resources.",
"type": "string"
},
"ResourceGroupPrefix": {
"description": "Azure Resource Group prefix used in resource groups names created.",
"type": "string"
},
"AllowResourceGroupCreation": {
"description": "Flag that shows if it is allowed to create a resource group if not exists. Defaults to false if ResourceGroup is provided.",
"type": "boolean"
},
"Location": {
"description": "Azure Location that will be used to create resources.",
"type": "string"
},
"CredentialSource": {
"description": "Configures which Azure credential to use for provisioning.",
"enum": [
"AzureCli",
"AzurePowerShell",
"VisualStudio",
"VisualStudioCode",
"AzureDeveloperCli",
"InteractiveBrowser",
"Default"
],
"default": "Default"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<ItemGroup>
<JsonSchemaSegment Include="$(MSBuildThisFileDirectory)..\AspireAzureConfigurationSchema.json"
FilePathPattern="appsettings\..*json" />
</ItemGroup>
</Project>

0 comments on commit 4251f91

Please sign in to comment.