Skip to content

Commit f1df2ab

Browse files
Dan Schultetbombach
authored andcommitted
Add AzureResourceSchema Microsoft.Resources test (#1134)
* Add AzureResourceSchema Microsoft.Resources test * Add AzureResourceSchema Microsoft.Scheduler test * Add AzureResourceSchema Microsoft.Logic test and remove 'Possible values' from descriptions * Add AzureResourceSchema MachineLearning test. Add minimum and maximum to JsonSchema. Fix SequenceType bug * Add AzureResourceSchema PowerBIEmbedded test * Add Redis generated schema * Add Microsoft.Search test * Add TrafficManager schema * Fix analysis errors * Add Microsoft.Logic.json expected test file * Update Microsoft.MachineLearning 2016-05-01-preview tests * Add discriminator support to AzureResourceSchema generator * Add discriminator property to generated schema definitions * Fix the AzureResourceSchema generator by moving child resources property to be inside the first level properties property
1 parent 5dfea14 commit f1df2ab

File tree

42 files changed

+14535
-1135
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+14535
-1135
lines changed

AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/AutoRest.Generator.AzureResourceSchema.Tests.csproj

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
</Reference>
6565
</ItemGroup>
6666
<ItemGroup>
67-
<Compile Include="AcceptanceTests.cs" />
67+
<Compile Include="AzureResourceSchemaAcceptanceTests.cs" />
6868
<Compile Include="AzureResourceSchemaCodeGeneratorTests.cs" />
6969
<Compile Include="JSONSchemaTests.cs" />
7070
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -138,6 +138,30 @@
138138
<Content Include="Expected\DevTestLabs\2015-05-21-preview\Microsoft.DevTestLabs.json">
139139
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
140140
</Content>
141+
<Content Include="Expected\Resources\2016-02-01\Microsoft.Resources.json">
142+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
143+
</Content>
144+
<Content Include="Expected\Scheduler\2016-03-01\Microsoft.Scheduler.json">
145+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
146+
</Content>
147+
<Content Include="Expected\Logic\2015-02-01-preview\Microsoft.Logic.json">
148+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
149+
</Content>
150+
<Content Include="Expected\MachineLearning\2016-05-01-preview\Microsoft.MachineLearning.json">
151+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
152+
</Content>
153+
<Content Include="Expected\PowerBIEmbedded\2016-01-29\Microsoft.PowerBI.json">
154+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
155+
</Content>
156+
<Content Include="Expected\Redis\2016-04-01\Microsoft.Cache.json">
157+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
158+
</Content>
159+
<Content Include="Expected\Search\2015-02-28\Microsoft.Search.json">
160+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
161+
</Content>
162+
<Content Include="Expected\TrafficManager\2015-11-01\Microsoft.Network.json">
163+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
164+
</Content>
141165
<None Include="packages.config">
142166
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
143167
</None>
@@ -198,6 +222,30 @@
198222
<Content Include="Swagger\DevTestLabs\2015-05-21-preview\DTL.json">
199223
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
200224
</Content>
225+
<Content Include="Swagger\Resources\2016-02-01\resources.json">
226+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
227+
</Content>
228+
<Content Include="Swagger\Scheduler\2016-03-01\scheduler.json">
229+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
230+
</Content>
231+
<Content Include="Swagger\Logic\2015-02-01-preview\logic.json">
232+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
233+
</Content>
234+
<Content Include="Swagger\MachineLearning\2016-05-01-preview\webservices.json">
235+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
236+
</Content>
237+
<Content Include="Swagger\PowerBIEmbedded\2016-01-29\powerbiembedded.json">
238+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
239+
</Content>
240+
<Content Include="Swagger\Redis\2016-04-01\redis.json">
241+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
242+
</Content>
243+
<Content Include="Swagger\Search\2015-02-28\search.json">
244+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
245+
</Content>
246+
<Content Include="Swagger\TrafficManager\2015-11-01\trafficmanager.json">
247+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
248+
</Content>
201249
</ItemGroup>
202250
<ItemGroup>
203251
<ProjectReference Include="..\..\..\Modelers\Swagger.Tests\AutoRest.Modeler.Swagger.Tests.csproj">

AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/AcceptanceTests.cs renamed to AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/AzureResourceSchemaAcceptanceTests.cs

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace AutoRest.Generator.AzureResourceSchema.Tests
1010
{
1111
[Collection("AutoRest Azure Resource Schema Tests")]
12-
public static class AcceptanceTests
12+
public static class AzureResourceSchemaAcceptanceTests
1313
{
1414
[Fact]
1515
public static void Batch()
@@ -77,6 +77,18 @@ public static void Dns_2016_04_01()
7777
RunSwaggerTest("DNS", "2016-04-01", "dns.json");
7878
}
7979

80+
[Fact]
81+
public static void Logic_2015_02_01_preview()
82+
{
83+
RunSwaggerTest("Logic", "2015-02-01-preview", "logic.json");
84+
}
85+
86+
[Fact]
87+
public static void MachineLearning_2016_05_01_preview()
88+
{
89+
RunSwaggerTest("MachineLearning", "2016-05-01-preview", "webservices.json");
90+
}
91+
8092
[Fact]
8193
public static void Network_2015_05_01_preview()
8294
{
@@ -95,6 +107,36 @@ public static void Network_2016_03_30()
95107
RunSwaggerTest("Network", "2016-03-30", "network.json");
96108
}
97109

110+
[Fact]
111+
public static void PowerBIEmbedded_2016_01_29()
112+
{
113+
RunSwaggerTest("PowerBIEmbedded", "2016-01-29", "powerbiembedded.json");
114+
}
115+
116+
[Fact]
117+
public static void Redis_2016_04_01()
118+
{
119+
RunSwaggerTest("Redis", "2016-04-01", "redis.json");
120+
}
121+
122+
[Fact]
123+
public static void Resources_2016_02_01()
124+
{
125+
RunSwaggerTest("Resources", "2016-02-01", "resources.json");
126+
}
127+
128+
[Fact]
129+
public static void Scheduler_2016_03_01()
130+
{
131+
RunSwaggerTest("Scheduler", "2016-03-01", "scheduler.json");
132+
}
133+
134+
[Fact]
135+
public static void Search_2015_02_28()
136+
{
137+
RunSwaggerTest("Search", "2015-02-28", "search.json");
138+
}
139+
98140
[Fact]
99141
public static void Storage_2015_05_01_preview()
100142
{
@@ -113,6 +155,12 @@ public static void Storage_2016_01_01()
113155
RunSwaggerTest("Storage", "2016-01-01", "storage.json");
114156
}
115157

158+
[Fact]
159+
public static void TrafficManager_2015_11_01()
160+
{
161+
RunSwaggerTest("TrafficManager", "2015-11-01", "trafficmanager.json");
162+
}
163+
116164
[Fact]
117165
public static void Web()
118166
{

AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Batch/2015-12-01/Microsoft.Batch.json

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@
4747
}
4848
],
4949
"description": "The properties of the account."
50-
}
51-
},
52-
"resources": {
53-
"type": "array",
54-
"items": {
55-
"oneOf": [
56-
{
57-
"$ref": "#/definitions/batchAccounts_applications_childResource"
58-
}
59-
]
50+
},
51+
"resources": {
52+
"type": "array",
53+
"items": {
54+
"oneOf": [
55+
{
56+
"$ref": "#/definitions/batchAccounts_applications_childResource"
57+
}
58+
]
59+
}
6060
}
6161
},
6262
"required": [
@@ -95,16 +95,16 @@
9595
"displayName": {
9696
"type": "string",
9797
"description": "The display name for the application."
98-
}
99-
},
100-
"resources": {
101-
"type": "array",
102-
"items": {
103-
"oneOf": [
104-
{
105-
"$ref": "#/definitions/batchAccounts_applications_versions_childResource"
106-
}
107-
]
98+
},
99+
"resources": {
100+
"type": "array",
101+
"items": {
102+
"oneOf": [
103+
{
104+
"$ref": "#/definitions/batchAccounts_applications_versions_childResource"
105+
}
106+
]
107+
}
108108
}
109109
},
110110
"required": [
@@ -196,16 +196,16 @@
196196
"displayName": {
197197
"type": "string",
198198
"description": "The display name for the application."
199-
}
200-
},
201-
"resources": {
202-
"type": "array",
203-
"items": {
204-
"oneOf": [
205-
{
206-
"$ref": "#/definitions/batchAccounts_applications_versions_childResource"
207-
}
208-
]
199+
},
200+
"resources": {
201+
"type": "array",
202+
"items": {
203+
"oneOf": [
204+
{
205+
"$ref": "#/definitions/batchAccounts_applications_versions_childResource"
206+
}
207+
]
208+
}
209209
}
210210
},
211211
"required": [

AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/CDN/2015-06-01/Microsoft.Cdn.json

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@
4646
"$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
4747
}
4848
]
49-
}
50-
},
51-
"resources": {
52-
"type": "array",
53-
"items": {
54-
"oneOf": [
55-
{
56-
"$ref": "#/definitions/profiles_endpoints_childResource"
57-
}
58-
]
49+
},
50+
"resources": {
51+
"type": "array",
52+
"items": {
53+
"oneOf": [
54+
{
55+
"$ref": "#/definitions/profiles_endpoints_childResource"
56+
}
57+
]
58+
}
5959
}
6060
},
6161
"required": [
@@ -108,19 +108,19 @@
108108
"$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
109109
}
110110
]
111-
}
112-
},
113-
"resources": {
114-
"type": "array",
115-
"items": {
116-
"oneOf": [
117-
{
118-
"$ref": "#/definitions/profiles_endpoints_customDomains_childResource"
119-
},
120-
{
121-
"$ref": "#/definitions/profiles_endpoints_origins_childResource"
122-
}
123-
]
111+
},
112+
"resources": {
113+
"type": "array",
114+
"items": {
115+
"oneOf": [
116+
{
117+
"$ref": "#/definitions/profiles_endpoints_customDomains_childResource"
118+
},
119+
{
120+
"$ref": "#/definitions/profiles_endpoints_origins_childResource"
121+
}
122+
]
123+
}
124124
}
125125
},
126126
"required": [
@@ -342,7 +342,7 @@
342342
"$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
343343
}
344344
],
345-
"description": "Defines the query string caching behavior. Possible values include: 'IgnoreQueryString', 'BypassCaching', 'UseQueryString', 'NotSet'"
345+
"description": "Defines the query string caching behavior."
346346
},
347347
"origins": {
348348
"oneOf": [
@@ -458,19 +458,19 @@
458458
"$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
459459
}
460460
]
461-
}
462-
},
463-
"resources": {
464-
"type": "array",
465-
"items": {
466-
"oneOf": [
467-
{
468-
"$ref": "#/definitions/profiles_endpoints_customDomains_childResource"
469-
},
470-
{
471-
"$ref": "#/definitions/profiles_endpoints_origins_childResource"
472-
}
473-
]
461+
},
462+
"resources": {
463+
"type": "array",
464+
"items": {
465+
"oneOf": [
466+
{
467+
"$ref": "#/definitions/profiles_endpoints_customDomains_childResource"
468+
},
469+
{
470+
"$ref": "#/definitions/profiles_endpoints_origins_childResource"
471+
}
472+
]
473+
}
474474
}
475475
},
476476
"required": [
@@ -563,7 +563,7 @@
563563
"$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
564564
}
565565
],
566-
"description": "Name of the pricing tier. Possible values include: 'Standard', 'Premium'"
566+
"description": "Name of the pricing tier."
567567
}
568568
},
569569
"description": "The SKU (pricing tier) of the CDN profile."

0 commit comments

Comments
 (0)