Skip to content

Commit

Permalink
Added support for Microsoft.Web. Change resource schema resource name…
Browse files Browse the repository at this point in the history
…s to be resource type with '_' instead of '/'
  • Loading branch information
Dan Schulte committed May 11, 2016
1 parent e0fde05 commit 5604cf9
Show file tree
Hide file tree
Showing 18 changed files with 24,430 additions and 220 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ public static void Network()
RunSwaggerTest("network.json", "Network");
}

[Fact]
public static void Web()
{
RunSwaggerTest("web.json", "Web");
}

private static void RunSwaggerTest(string swaggerFileName, string expectedFolderName)
{
SwaggerSpecHelper.RunTests<AzureResourceSchemaCodeGenerator>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@
<Content Include="Expected\Network\Microsoft.Network.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Expected\Web\Microsoft.Web.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Expected\Web\Microsoft.DomainRegistration.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Expected\Web\Microsoft.CertificateRegistration.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="packages.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand All @@ -112,6 +121,9 @@
<Content Include="Swagger\network.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Swagger\web.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Modelers\Swagger.Tests\AutoRest.Modeler.Swagger.Tests.csproj">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void Name()
public void UsageInstructionsWithNoOutputFileSetting()
{
AzureResourceSchemaCodeGenerator codeGen = CreateGenerator();
Assert.Equal("Your Azure Resource Schema can be found at " + codeGen.SchemaPath, codeGen.UsageInstructions);
Assert.Equal("Your Azure Resource Schema(s) can be found in " + codeGen.Settings.OutputDirectory, codeGen.UsageInstructions);
}

[Fact]
Expand All @@ -47,16 +47,7 @@ public void UsageInstructionsWithOutputFileSetting()
};
AzureResourceSchemaCodeGenerator codeGen = CreateGenerator(settings);

Assert.Equal("Your Azure Resource Schema can be found at " + codeGen.SchemaPath, codeGen.UsageInstructions);
}

[Fact]
public async void GenerateWithEmptyServiceClient()
{
await TestGenerate(null, new string[0],
@"{
""$schema"": ""http://json-schema.org/draft-04/schema#""
}");
Assert.Equal("Your Azure Resource Schema(s) can be found in " + settings.OutputDirectory, codeGen.UsageInstructions);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "Microsoft.Batch",
"description": "Microsoft Batch Resource Types",
"resourceDefinitions": {
"batchAccounts": {
"Microsoft.Batch_batchAccounts": {
"type": "object",
"properties": {
"type": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"title": "Microsoft.Cdn",
"description": "Microsoft Cdn Resource Types",
"resourceDefinitions": {
"customDomains": {
"Microsoft.Cdn_profiles": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"Microsoft.Cdn/profiles/endpoints/customDomains"
"Microsoft.Cdn/profiles"
]
},
"apiVersion": {
Expand All @@ -19,18 +19,31 @@
"2016-04-02"
]
},
"properties": {
"$ref": "#/definitions/CustomDomainPropertiesParameters"
"location": {
"type": "string",
"description": "Profile location"
},
"tags": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "Profile tags"
},
"sku": {
"$ref": "#/definitions/Sku",
"description": "The SKU (pricing tier) of the CDN profile."
}
},
"required": [
"type",
"apiVersion",
"properties"
"location",
"sku"
],
"description": "Microsoft.Cdn/profiles/endpoints/customDomains"
"description": "Microsoft.Cdn/profiles"
},
"endpoints": {
"Microsoft.Cdn_profiles_endpoints": {
"type": "object",
"properties": {
"type": {
Expand Down Expand Up @@ -68,13 +81,13 @@
],
"description": "Microsoft.Cdn/profiles/endpoints"
},
"origins": {
"Microsoft.Cdn_profiles_endpoints_customDomains": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"Microsoft.Cdn/profiles/endpoints/origins"
"Microsoft.Cdn/profiles/endpoints/customDomains"
]
},
"apiVersion": {
Expand All @@ -84,23 +97,23 @@
]
},
"properties": {
"$ref": "#/definitions/OriginPropertiesParameters"
"$ref": "#/definitions/CustomDomainPropertiesParameters"
}
},
"required": [
"type",
"apiVersion",
"properties"
],
"description": "Microsoft.Cdn/profiles/endpoints/origins"
"description": "Microsoft.Cdn/profiles/endpoints/customDomains"
},
"profiles": {
"Microsoft.Cdn_profiles_endpoints_origins": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"Microsoft.Cdn/profiles"
"Microsoft.Cdn/profiles/endpoints/origins"
]
},
"apiVersion": {
Expand All @@ -109,29 +122,16 @@
"2016-04-02"
]
},
"location": {
"type": "string",
"description": "Profile location"
},
"tags": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "Profile tags"
},
"sku": {
"$ref": "#/definitions/Sku",
"description": "The SKU (pricing tier) of the CDN profile."
"properties": {
"$ref": "#/definitions/OriginPropertiesParameters"
}
},
"required": [
"type",
"apiVersion",
"location",
"sku"
"properties"
],
"description": "Microsoft.Cdn/profiles"
"description": "Microsoft.Cdn/profiles/endpoints/origins"
}
},
"definitions": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "Microsoft.Compute",
"description": "Microsoft Compute Resource Types",
"resourceDefinitions": {
"availabilitySets": {
"Microsoft.Compute_availabilitySets": {
"type": "object",
"properties": {
"type": {
Expand All @@ -30,13 +30,13 @@
],
"description": "Microsoft.Compute/availabilitySets"
},
"extensions": {
"Microsoft.Compute_virtualMachines": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"Microsoft.Compute/virtualMachines/extensions"
"Microsoft.Compute/virtualMachines"
]
},
"apiVersion": {
Expand All @@ -45,24 +45,28 @@
"2016-03-30"
]
},
"plan": {
"$ref": "#/definitions/Plan",
"description": "Gets or sets the purchase plan when deploying virtual machine from VM Marketplace images."
},
"properties": {
"$ref": "#/definitions/VirtualMachineExtensionProperties"
"$ref": "#/definitions/VirtualMachineProperties"
}
},
"required": [
"type",
"apiVersion",
"properties"
],
"description": "Microsoft.Compute/virtualMachines/extensions"
"description": "Microsoft.Compute/virtualMachines"
},
"virtualMachines": {
"Microsoft.Compute_virtualMachines_extensions": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"Microsoft.Compute/virtualMachines"
"Microsoft.Compute/virtualMachines/extensions"
]
},
"apiVersion": {
Expand All @@ -71,22 +75,18 @@
"2016-03-30"
]
},
"plan": {
"$ref": "#/definitions/Plan",
"description": "Gets or sets the purchase plan when deploying virtual machine from VM Marketplace images."
},
"properties": {
"$ref": "#/definitions/VirtualMachineProperties"
"$ref": "#/definitions/VirtualMachineExtensionProperties"
}
},
"required": [
"type",
"apiVersion",
"properties"
],
"description": "Microsoft.Compute/virtualMachines"
"description": "Microsoft.Compute/virtualMachines/extensions"
},
"virtualMachineScaleSets": {
"Microsoft.Compute_virtualMachineScaleSets": {
"type": "object",
"properties": {
"type": {
Expand Down
Loading

0 comments on commit 5604cf9

Please sign in to comment.