diff --git a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/ResourceSchemaParser.cs b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/ResourceSchemaParser.cs index 6703a0eb73..1e98e8f950 100644 --- a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/ResourceSchemaParser.cs +++ b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/ResourceSchemaParser.cs @@ -396,23 +396,23 @@ public static bool IsCreateResourceMethod(Method method) /// URL path that comes after the resourceProvider section. /// /// - /// + /// /// - public static string GetResourceType(string resourceProvider, string methodUrlPathAfterProvider) + public static string GetResourceType(string resourceProvider, string methodPathAfterProvider) { if (string.IsNullOrWhiteSpace(resourceProvider)) { throw new ArgumentException("resourceProvider cannot be null or whitespace", "resourceProvider"); } - if (string.IsNullOrWhiteSpace(methodUrlPathAfterProvider)) + if (string.IsNullOrWhiteSpace(methodPathAfterProvider)) { - throw new ArgumentException("methodUrlPathAfterProvider cannot be null or whitespace", "methodUrlPathAfterProvider"); + throw new ArgumentException("methodPathAfterProvider cannot be null or whitespace", "methodPathAfterProvider"); } List resourceTypeParts = new List(); resourceTypeParts.Add(resourceProvider); - string[] pathSegments = methodUrlPathAfterProvider.Split(new char[] { '/' }); + string[] pathSegments = methodPathAfterProvider.Split(new char[] { '/' }); for (int i = 0; i < pathSegments.Length; i += 2) { resourceTypeParts.Add(pathSegments[i]); diff --git a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/ResourceSchemaWriter.cs b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/ResourceSchemaWriter.cs index 5da44b80c7..98dcd57d27 100644 --- a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/ResourceSchemaWriter.cs +++ b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/ResourceSchemaWriter.cs @@ -33,7 +33,7 @@ public static void Write(TextWriter writer, ResourceSchema resourceSchema) } } - public static void Write(JsonTextWriter writer, ResourceSchema resourceSchema) + public static void Write(JsonWriter writer, ResourceSchema resourceSchema) { if (writer == null) { @@ -58,7 +58,7 @@ public static void Write(JsonTextWriter writer, ResourceSchema resourceSchema) writer.WriteEndObject(); } - private static void WriteDefinitionMap(JsonTextWriter writer, string definitionMapName, IDictionary definitionMap, bool sortDefinitions = false, bool addExpressionReferences = false) + private static void WriteDefinitionMap(JsonWriter writer, string definitionMapName, IDictionary definitionMap, bool sortDefinitions = false, bool addExpressionReferences = false) { if (definitionMap != null && definitionMap.Count > 0) { @@ -120,8 +120,13 @@ private static void WriteDefinitionMap(JsonTextWriter writer, string definitionM } } - public static void WriteDefinition(JsonTextWriter writer, string resourceName, JsonSchema definition) + public static void WriteDefinition(JsonWriter writer, string resourceName, JsonSchema definition) { + if (writer == null) + { + throw new ArgumentNullException("writer"); + } + if (definition != null) { writer.WritePropertyName(resourceName); @@ -129,7 +134,7 @@ public static void WriteDefinition(JsonTextWriter writer, string resourceName, J } } - private static void WriteDefinition(JsonTextWriter writer, JsonSchema definition) + private static void WriteDefinition(JsonWriter writer, JsonSchema definition) { if (definition == null) { @@ -151,7 +156,7 @@ private static void WriteDefinition(JsonTextWriter writer, JsonSchema definition writer.WriteEndObject(); } - private static void WriteStringArray(JsonTextWriter writer, string arrayName, IEnumerable arrayValues) + private static void WriteStringArray(JsonWriter writer, string arrayName, IEnumerable arrayValues) { if (arrayValues != null && arrayValues.Count() > 0) { @@ -165,7 +170,7 @@ private static void WriteStringArray(JsonTextWriter writer, string arrayName, IE } } - private static void WriteDefinitionArray(JsonTextWriter writer, string arrayName, IEnumerable arrayDefinitions) + private static void WriteDefinitionArray(JsonWriter writer, string arrayName, IEnumerable arrayDefinitions) { if (arrayDefinitions != null && arrayDefinitions.Count() > 0) { @@ -191,7 +196,7 @@ private static void WriteDefinitionArray(JsonTextWriter writer, string arrayName } } - public static void WriteProperty(JsonTextWriter writer, string propertyName, string propertyValue) + public static void WriteProperty(JsonWriter writer, string propertyName, string propertyValue) { if (writer == null) {