Skip to content

Commit 4251f91

Browse files
close #2636: added json schemas for Aspire.Hosting.AppHost and Aspire.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 <eric.erhardt@microsoft.com>
1 parent 9757b4f commit 4251f91

File tree

6 files changed

+69
-1
lines changed

6 files changed

+69
-1
lines changed

src/Aspire.Hosting.AppHost/Aspire.Hosting.AppHost.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</PropertyGroup>
1717

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

2222
<ItemGroup>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "object",
3+
"properties": {
4+
"Parameters": {
5+
"description": ".NET Aspire parameter configuration. A parameter's value will be retrieved from the property with the same name.",
6+
"type": "object"
7+
}
8+
}
9+
}

src/Aspire.Hosting.AppHost/build/Aspire.Hosting.AppHost.targets

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
<ProjectCapability Include="Aspire" Condition=" '$(IsAspireHost)' == 'true' " />
1313
</ItemGroup>
1414

15+
<ItemGroup>
16+
<JsonSchemaSegment Include="$(MSBuildThisFileDirectory)..\AspireAppHostConfiguration.json"
17+
FilePathPattern="appsettings\..*json" />
18+
</ItemGroup>
19+
1520
<Target Name="_CreateAspireProjectResources">
1621

1722
<ItemGroup>

src/Aspire.Hosting.Azure/Aspire.Hosting.Azure.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
<EmbeddedResource Include="Bicep\*.bicep" />
2525
</ItemGroup>
2626

27+
<ItemGroup>
28+
<None Include="**/*.targets;AspireAzureConfigurationSchema.json" Pack="true" PackagePath="%(RecursiveDir)%(Filename)%(Extension)" />
29+
</ItemGroup>
30+
2731
<ItemGroup>
2832
<ProjectReference Include="..\Aspire.Hosting\Aspire.Hosting.csproj" />
2933
<PackageReference Include="System.IO.Hashing" />
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"type": "object",
3+
"properties": {
4+
"Azure": {
5+
"description": "Azure provisioning information. This section is used to create Azure resources for the app.",
6+
"type": "object",
7+
"properties": {
8+
"SubscriptionId": {
9+
"description": "Azure Subscription Id that will be used to host the resources.",
10+
"type": "string"
11+
},
12+
"ResourceGroup": {
13+
"description": "Azure Resource Group name where to create resources.",
14+
"type": "string"
15+
},
16+
"ResourceGroupPrefix": {
17+
"description": "Azure Resource Group prefix used in resource groups names created.",
18+
"type": "string"
19+
},
20+
"AllowResourceGroupCreation": {
21+
"description": "Flag that shows if it is allowed to create a resource group if not exists. Defaults to false if ResourceGroup is provided.",
22+
"type": "boolean"
23+
},
24+
"Location": {
25+
"description": "Azure Location that will be used to create resources.",
26+
"type": "string"
27+
},
28+
"CredentialSource": {
29+
"description": "Configures which Azure credential to use for provisioning.",
30+
"enum": [
31+
"AzureCli",
32+
"AzurePowerShell",
33+
"VisualStudio",
34+
"VisualStudioCode",
35+
"AzureDeveloperCli",
36+
"InteractiveBrowser",
37+
"Default"
38+
],
39+
"default": "Default"
40+
}
41+
}
42+
}
43+
}
44+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Project>
2+
<ItemGroup>
3+
<JsonSchemaSegment Include="$(MSBuildThisFileDirectory)..\AspireAzureConfigurationSchema.json"
4+
FilePathPattern="appsettings\..*json" />
5+
</ItemGroup>
6+
</Project>

0 commit comments

Comments
 (0)