forked from Azure/autorest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Azure#1018 from daschult/master
Improve AzureResourceSchema generator
- Loading branch information
Showing
32 changed files
with
52,564 additions
and
462 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/AcceptanceTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
using Microsoft.Rest.Generator.AzureResourceSchema; | ||
using Microsoft.Rest.Modeler.Swagger.Tests; | ||
using System.IO; | ||
using Xunit; | ||
|
||
namespace AutoRest.Generator.AzureResourceSchema.Tests | ||
{ | ||
[Collection("AutoRest Azure Resource Schema Tests")] | ||
public static class AcceptanceTests | ||
{ | ||
[Fact] | ||
public static void Storage() | ||
{ | ||
RunSwaggerTest("storage.json", "Storage"); | ||
} | ||
|
||
[Fact] | ||
public static void Batch() | ||
{ | ||
RunSwaggerTest("BatchManagement.json", "Batch"); | ||
} | ||
|
||
[Fact] | ||
public static void Cdn() | ||
{ | ||
RunSwaggerTest("cdn.json", "CDN"); | ||
} | ||
|
||
[Fact] | ||
public static void Compute() | ||
{ | ||
RunSwaggerTest("compute.json", "Compute"); | ||
} | ||
|
||
[Fact] | ||
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>( | ||
Path.Combine("Swagger", swaggerFileName), | ||
Path.Combine("Expected", expectedFolderName)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
...erators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Batch/Microsoft.Batch.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
{ | ||
"id": "http://schema.management.azure.com/schemas/2015-12-01/Microsoft.Batch.json#", | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"title": "Microsoft.Batch", | ||
"description": "Microsoft Batch Resource Types", | ||
"resourceDefinitions": { | ||
"Microsoft.Batch_batchAccounts": { | ||
"type": "object", | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"enum": [ | ||
"Microsoft.Batch/batchAccounts" | ||
] | ||
}, | ||
"apiVersion": { | ||
"type": "string", | ||
"enum": [ | ||
"2015-12-01" | ||
] | ||
}, | ||
"location": { | ||
"type": "string", | ||
"description": "The region in which the account is created." | ||
}, | ||
"tags": { | ||
"oneOf": [ | ||
{ | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "string" | ||
} | ||
}, | ||
{ | ||
"$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" | ||
} | ||
], | ||
"description": "The user specified tags associated with the account." | ||
}, | ||
"properties": { | ||
"oneOf": [ | ||
{ | ||
"$ref": "#/definitions/AccountBaseProperties" | ||
}, | ||
{ | ||
"$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" | ||
} | ||
], | ||
"description": "The properties of the account." | ||
} | ||
}, | ||
"required": [ | ||
"type", | ||
"apiVersion", | ||
"properties" | ||
], | ||
"description": "Microsoft.Batch/batchAccounts" | ||
} | ||
}, | ||
"definitions": { | ||
"AccountBaseProperties": { | ||
"type": "object", | ||
"properties": { | ||
"autoStorage": { | ||
"oneOf": [ | ||
{ | ||
"$ref": "#/definitions/AutoStorageBaseProperties" | ||
}, | ||
{ | ||
"$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" | ||
} | ||
], | ||
"description": "The properties related to auto storage account." | ||
} | ||
}, | ||
"description": "The properties of a Batch account." | ||
}, | ||
"AutoStorageBaseProperties": { | ||
"type": "object", | ||
"properties": { | ||
"storageAccountId": { | ||
"type": "string", | ||
"description": "The resource id of the storage account to be used for auto storage account." | ||
} | ||
}, | ||
"required": [ | ||
"storageAccountId" | ||
], | ||
"description": "The properties related to auto storage account." | ||
} | ||
} | ||
} |
Oops, something went wrong.