diff --git a/AutoRest/AutoRest.Core/AutoRest.Core.csproj b/AutoRest/AutoRest.Core/AutoRest.Core.csproj
index 2ce9b707a5..5c6f4d9f54 100644
--- a/AutoRest/AutoRest.Core/AutoRest.Core.csproj
+++ b/AutoRest/AutoRest.Core/AutoRest.Core.csproj
@@ -28,6 +28,7 @@
+
@@ -87,4 +88,4 @@
-
+
\ No newline at end of file
diff --git a/AutoRest/AutoRest.Core/ClientModel/Method.cs b/AutoRest/AutoRest.Core/ClientModel/Method.cs
index 9142cb2a8c..420a6dbdf8 100644
--- a/AutoRest/AutoRest.Core/ClientModel/Method.cs
+++ b/AutoRest/AutoRest.Core/ClientModel/Method.cs
@@ -24,6 +24,7 @@ public Method()
Parameters = new List();
RequestHeaders = new Dictionary();
Responses = new Dictionary();
+ InputParameterMappings = new List();
}
///
@@ -58,6 +59,34 @@ public Method()
///
public List Parameters { get; private set; }
+ ///
+ /// Gets or sets the logical parameter.
+ ///
+ public IEnumerable LogicalParameters
+ {
+ get
+ {
+ return Parameters.Where(gp => gp.Location != ParameterLocation.None)
+ .Union(InputParameterMappings.Select(m => m.OutputParameter));
+ }
+ }
+
+ ///
+ /// Gets or sets the body parameter.
+ ///
+ public Parameter Body
+ {
+ get
+ {
+ return LogicalParameters.FirstOrDefault(p => p.Location == ParameterLocation.Body);
+ }
+ }
+
+ ///
+ /// Gets the list of input Parameter Mappings
+ ///
+ public List InputParameterMappings { get; private set; }
+
///
/// Gets or sets request headers.
///
@@ -131,8 +160,10 @@ public object Clone()
newMethod.Parameters = new List();
newMethod.RequestHeaders = new Dictionary();
newMethod.Responses = new Dictionary();
+ newMethod.InputParameterMappings = new List();
this.Extensions.ForEach(e => newMethod.Extensions[e.Key] = e.Value);
this.Parameters.ForEach(p => newMethod.Parameters.Add((Parameter)p.Clone()));
+ this.InputParameterMappings.ForEach(m => newMethod.InputParameterMappings.Add((ParameterMapping)m.Clone()));
this.RequestHeaders.ForEach(r => newMethod.RequestHeaders[r.Key] = r.Value);
this.Responses.ForEach(r => newMethod.Responses[r.Key] = r.Value);
return newMethod;
diff --git a/AutoRest/AutoRest.Core/ClientModel/Parameter.cs b/AutoRest/AutoRest.Core/ClientModel/Parameter.cs
index 2e45e90543..b626566c4f 100644
--- a/AutoRest/AutoRest.Core/ClientModel/Parameter.cs
+++ b/AutoRest/AutoRest.Core/ClientModel/Parameter.cs
@@ -70,8 +70,7 @@ public Parameter()
/// Gets or sets the documentation.
///
public string Documentation { get; set; }
-
-
+
///
/// Gets vendor extensions dictionary.
///
diff --git a/AutoRest/AutoRest.Core/ClientModel/ParameterMapping.cs b/AutoRest/AutoRest.Core/ClientModel/ParameterMapping.cs
new file mode 100644
index 0000000000..a8665cc337
--- /dev/null
+++ b/AutoRest/AutoRest.Core/ClientModel/ParameterMapping.cs
@@ -0,0 +1,65 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+
+namespace Microsoft.Rest.Generator.ClientModel
+{
+ using System;
+ using System.Globalization;
+
+ ///
+ /// Defines a parameter mapping.
+ ///
+ public class ParameterMapping : ICloneable
+ {
+ ///
+ /// Gets or sets the input parameter.
+ ///
+ public Parameter InputParameter { get; set; }
+
+ ///
+ /// Gets or sets the input parameter dot separated property path.
+ ///
+ public string InputParameterProperty { get; set; }
+
+ ///
+ /// Gets or sets the output parameter.
+ ///
+ public Parameter OutputParameter { get; set; }
+
+ ///
+ /// Gets or sets the output parameter dot separated property path.
+ ///
+ public string OutputParameterProperty { get; set; }
+
+ ///
+ /// Returns a string representation of the ParameterMapping object.
+ ///
+ ///
+ /// A string representation of the ParameterMapping object.
+ ///
+ public override string ToString()
+ {
+ string outputPath = OutputParameter.Name;
+ if (OutputParameterProperty != null)
+ {
+ outputPath += "." + OutputParameterProperty;
+ }
+ string inputPath = InputParameter.Name;
+ if (InputParameterProperty != null)
+ {
+ inputPath += "." + InputParameterProperty;
+ }
+ return string.Format(CultureInfo.InvariantCulture, "{0} = {1}", outputPath, inputPath);
+ }
+
+ ///
+ /// Performs a deep clone of a parameter mapping.
+ ///
+ /// A deep clone of current object.
+ public object Clone()
+ {
+ ParameterMapping paramMapping = (ParameterMapping)this.MemberwiseClone();
+ return paramMapping;
+ }
+ }
+}
\ No newline at end of file
diff --git a/AutoRest/AutoRest.Core/CodeNamer.cs b/AutoRest/AutoRest.Core/CodeNamer.cs
index 327b58fda3..2a0410a353 100644
--- a/AutoRest/AutoRest.Core/CodeNamer.cs
+++ b/AutoRest/AutoRest.Core/CodeNamer.cs
@@ -128,6 +128,28 @@ public virtual void NormalizeClientModel(ServiceClient client)
parameter.Name = GetParameterName(parameter.Name);
parameter.Type = NormalizeType(parameter.Type);
}
+
+ foreach (var parameterMapping in method.InputParameterMappings)
+ {
+ parameterMapping.InputParameter.Name = GetParameterName(parameterMapping.InputParameter.Name);
+ parameterMapping.InputParameter.Type = NormalizeType(parameterMapping.InputParameter.Type);
+ parameterMapping.OutputParameter.Name = GetParameterName(parameterMapping.OutputParameter.Name);
+ parameterMapping.OutputParameter.Type = NormalizeType(parameterMapping.OutputParameter.Type);
+
+ if (parameterMapping.InputParameterProperty != null)
+ {
+ parameterMapping.InputParameterProperty = string.Join(".",
+ parameterMapping.InputParameterProperty.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries)
+ .Select(p => GetPropertyName(p)));
+ }
+
+ if (parameterMapping.OutputParameterProperty != null)
+ {
+ parameterMapping.OutputParameterProperty = string.Join(".",
+ parameterMapping.OutputParameterProperty.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries)
+ .Select(p => GetPropertyName(p)));
+ }
+ }
}
}
diff --git a/AutoRest/AutoRest.Core/GlobalSuppressions.cs b/AutoRest/AutoRest.Core/GlobalSuppressions.cs
index 03eb1b9d3b..88eef6b869 100644
--- a/AutoRest/AutoRest.Core/GlobalSuppressions.cs
+++ b/AutoRest/AutoRest.Core/GlobalSuppressions.cs
@@ -49,3 +49,4 @@
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists",
Scope = "member", Target = "Microsoft.Rest.Generator.ClientModel.Method.#Parameters")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Rfc", Scope = "member", Target = "Microsoft.Rest.Generator.ClientModel.PrimaryType.#DateTimeRfc1123")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Scope = "member", Target = "Microsoft.Rest.Generator.ClientModel.Method.#InputParameterMappings")]
diff --git a/AutoRest/Generators/Azure.Common/Azure.Common/AzureCodeGenerator.cs b/AutoRest/Generators/Azure.Common/Azure.Common/AzureCodeGenerator.cs
index 56c0f05cbd..484a2eea62 100644
--- a/AutoRest/Generators/Azure.Common/Azure.Common/AzureCodeGenerator.cs
+++ b/AutoRest/Generators/Azure.Common/Azure.Common/AzureCodeGenerator.cs
@@ -29,8 +29,10 @@ public abstract class AzureCodeGenerator : CodeGenerator
//TODO: Ideally this would be the same extension as the ClientRequestIdExtension and have it specified on the response headers,
//TODO: But the response headers aren't currently used at all so we put an extension on the operation for now
public const string RequestIdExtension = "x-ms-request-id";
+ public const string ParameterGroupExtension = "x-ms-parameter-grouping";
public const string ApiVersion = "api-version";
public const string AcceptLanguage = "accept-language";
+
private const string ResourceType = "Resource";
private const string SubResourceType = "SubResource";
private const string ResourceProperties = "Properties";
@@ -64,6 +66,7 @@ public override void NormalizeClientModel(ServiceClient serviceClient)
AddLongRunningOperations(serviceClient);
AddAzureProperties(serviceClient);
SetDefaultResponses(serviceClient);
+ AddParameterGroups(serviceClient);
}
///
@@ -204,6 +207,104 @@ public static void AddLongRunningOperations(ServiceClient serviceClient)
}
}
+ ///
+ /// Adds the parameter groups to operation parameters.
+ ///
+ ///
+ public static void AddParameterGroups(ServiceClient serviceClient)
+ {
+ if (serviceClient == null)
+ {
+ throw new ArgumentNullException("serviceClient");
+ }
+
+ foreach (Method method in serviceClient.Methods)
+ {
+ //This group name is normalized by each languages code generator later, so it need not happen here.
+ Dictionary> parameterGroups = new Dictionary>();
+
+ foreach (Parameter parameter in method.Parameters)
+ {
+ if (parameter.Extensions.ContainsKey(ParameterGroupExtension))
+ {
+ Newtonsoft.Json.Linq.JContainer extensionObject = parameter.Extensions[ParameterGroupExtension] as Newtonsoft.Json.Linq.JContainer;
+ if (extensionObject != null)
+ {
+ string parameterGroupName = method.Group + "-" + method.Name + "-" + "Parameters";
+ parameterGroupName = extensionObject.Value("name") ?? parameterGroupName;
+
+ if (!parameterGroups.ContainsKey(parameterGroupName))
+ {
+ parameterGroups.Add(parameterGroupName, new Dictionary());
+ }
+
+ Property groupProperty = new Property()
+ {
+ IsReadOnly = false, //Since these properties are used as parameters they are never read only
+ Name = parameter.Name,
+ IsRequired = parameter.IsRequired,
+ DefaultValue = parameter.DefaultValue,
+ //Constraints = parameter.Constraints, Omit these since we don't want to perform parameter validation
+ Documentation = parameter.Documentation,
+ Type = parameter.Type,
+ SerializedName = null //Parameter is never serialized directly
+ };
+
+ parameterGroups[parameterGroupName].Add(groupProperty, parameter);
+ }
+ }
+ }
+
+ foreach (string parameterGroupName in parameterGroups.Keys)
+ {
+ //Define the new parameter group type (it's always a composite type)
+ CompositeType parameterGroupType = new CompositeType()
+ {
+ Name = parameterGroupName,
+ Documentation = "Additional parameters for the " + method.Name + " operation."
+ };
+
+ //Populate the parameter group type with properties.
+ foreach (Property property in parameterGroups[parameterGroupName].Keys)
+ {
+ parameterGroupType.Properties.Add(property);
+ }
+
+ //Add to the service client
+ serviceClient.ModelTypes.Add(parameterGroupType);
+
+ bool isGroupParameterRequired = parameterGroupType.Properties.Any(p => p.IsRequired);
+
+ //Create the new parameter object based on the parameter group type
+ Parameter parameterGroup = new Parameter()
+ {
+ Name = parameterGroupName,
+ IsRequired = isGroupParameterRequired,
+ Location = ParameterLocation.None,
+ SerializedName = string.Empty,
+ Type = parameterGroupType,
+ Documentation = "Additional parameters for the operation"
+ };
+
+ method.Parameters.Add(parameterGroup);
+
+ //Link the grouped parameters to their parent, and remove them from the method parameters
+ foreach (Property property in parameterGroups[parameterGroupName].Keys)
+ {
+ Parameter p = parameterGroups[parameterGroupName][property];
+
+ method.InputParameterMappings.Add(new ParameterMapping
+ {
+ InputParameter = parameterGroup,
+ OutputParameter = p,
+ InputParameterProperty = property.Name
+ });
+ method.Parameters.Remove(p);
+ }
+ }
+ }
+ }
+
///
/// Creates azure specific properties.
///
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/AcceptanceTests.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/AcceptanceTests.cs
index b123b7663d..85dd250aeb 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/AcceptanceTests.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/AcceptanceTests.cs
@@ -17,6 +17,8 @@
using Fixtures.Azure.AcceptanceTestsResourceFlattening;
using Fixtures.Azure.AcceptanceTestsResourceFlattening.Models;
using Fixtures.Azure.AcceptanceTestsSubscriptionIdApiVersion;
+using Fixtures.Azure.AcceptanceTestsAzureParameterGrouping;
+using Fixtures.Azure.AcceptanceTestsAzureParameterGrouping.Models;
using Microsoft.Rest.Azure;
using Microsoft.Rest.Generator.CSharp.Azure.Tests.Properties;
using Microsoft.Rest.Generator.CSharp.Tests;
@@ -701,5 +703,79 @@ public void DurationTests()
client.Duration.PutPositiveDuration(new TimeSpan(123, 22, 14, 12, 11));
}
}
+
+ [Fact]
+ public void ParameterGroupingTests()
+ {
+ const int bodyParameter = 1234;
+ const string headerParameter = "header";
+ const int queryParameter = 21;
+ const string pathParameter = "path";
+
+ using (var client = new AutoRestParameterGroupingTestService(
+ Fixture.Uri,
+ new TokenCredentials(Guid.NewGuid().ToString())))
+ {
+ //Valid required parameters
+ ParameterGroupingPostRequiredParameters requiredParameters = new ParameterGroupingPostRequiredParameters(bodyParameter, pathParameter)
+ {
+ CustomHeader = headerParameter,
+ Query = queryParameter
+ };
+
+ client.ParameterGrouping.PostRequired(requiredParameters);
+
+ //Required parameters but null optional parameters
+ requiredParameters = new ParameterGroupingPostRequiredParameters(bodyParameter, pathParameter);
+
+ client.ParameterGrouping.PostRequired(requiredParameters);
+
+ //Required parameters object is not null, but a required property of the object is
+ requiredParameters = new ParameterGroupingPostRequiredParameters(null, pathParameter);
+
+ Assert.Throws(() => client.ParameterGrouping.PostRequired(requiredParameters));
+
+ //null required parameters
+ Assert.Throws(() => client.ParameterGrouping.PostRequired(null));
+
+ //Valid optional parameters
+ ParameterGroupingPostOptionalParameters optionalParameters = new ParameterGroupingPostOptionalParameters()
+ {
+ CustomHeader = headerParameter,
+ Query = queryParameter
+ };
+
+ client.ParameterGrouping.PostOptional(optionalParameters);
+
+ //null optional paramters
+ client.ParameterGrouping.PostOptional(null);
+
+ //Multiple grouped parameters
+ FirstParameterGroup firstGroup = new FirstParameterGroup
+ {
+ HeaderOne = headerParameter,
+ QueryOne = queryParameter
+ };
+ SecondParameterGroup secondGroup = new SecondParameterGroup
+ {
+ HeaderTwo = "header2",
+ QueryTwo = 42
+ };
+
+ client.ParameterGrouping.PostMultipleParameterGroups(firstGroup, secondGroup);
+
+ //Multiple grouped parameters -- some optional parameters omitted
+ firstGroup = new FirstParameterGroup
+ {
+ HeaderOne = headerParameter
+ };
+ secondGroup = new SecondParameterGroup
+ {
+ QueryTwo = 42
+ };
+
+ client.ParameterGrouping.PostMultipleParameterGroups(firstGroup, secondGroup);
+ }
+ }
}
}
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDuration/Models/Error.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDuration/Models/Error.cs
index 53abad90eb..5908bd6863 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDuration/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDuration/Models/Error.cs
@@ -20,6 +20,20 @@ namespace Fixtures.Azure.AcceptanceTestsAzureBodyDuration.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/AutoRestParameterGroupingTestService.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/AutoRestParameterGroupingTestService.cs
new file mode 100644
index 0000000000..84d5525e39
--- /dev/null
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/AutoRestParameterGroupingTestService.cs
@@ -0,0 +1,206 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping
+{
+ using System;
+ using System.Linq;
+ using System.Collections.Generic;
+ using System.Diagnostics;
+ using System.Net;
+ using System.Net.Http;
+ using System.Net.Http.Headers;
+ using System.Text;
+ using System.Text.RegularExpressions;
+ using System.Threading;
+ using System.Threading.Tasks;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Serialization;
+ using Newtonsoft.Json;
+ using Microsoft.Rest.Azure;
+ using Models;
+
+ ///
+ /// Test Infrastructure for AutoRest
+ ///
+ public partial class AutoRestParameterGroupingTestService : ServiceClient, IAutoRestParameterGroupingTestService, IAzureClient
+ {
+ ///
+ /// The base URI of the service.
+ ///
+ public Uri BaseUri { get; set; }
+
+ ///
+ /// Gets or sets json serialization settings.
+ ///
+ public JsonSerializerSettings SerializationSettings { get; private set; }
+
+ ///
+ /// Gets or sets json deserialization settings.
+ ///
+ public JsonSerializerSettings DeserializationSettings { get; private set; }
+
+ ///
+ /// The management credentials for Azure.
+ ///
+ public ServiceClientCredentials Credentials { get; private set; }
+
+ ///
+ /// Gets or sets the preferred language for the response.
+ ///
+ public string AcceptLanguage { get; set; }
+
+ ///
+ /// The retry timeout for Long Running Operations.
+ ///
+ public int? LongRunningOperationRetryTimeout { get; set; }
+
+ public virtual IParameterGroupingOperations ParameterGrouping { get; private set; }
+
+ ///
+ /// Initializes a new instance of the AutoRestParameterGroupingTestService class.
+ ///
+ public AutoRestParameterGroupingTestService() : base()
+ {
+ this.Initialize();
+ }
+
+ ///
+ /// Initializes a new instance of the AutoRestParameterGroupingTestService class.
+ ///
+ ///
+ /// Optional. The set of delegating handlers to insert in the http
+ /// client pipeline.
+ ///
+ public AutoRestParameterGroupingTestService(params DelegatingHandler[] handlers) : base(handlers)
+ {
+ this.Initialize();
+ }
+
+ ///
+ /// Initializes a new instance of the AutoRestParameterGroupingTestService class.
+ ///
+ ///
+ /// Optional. The http client handler used to handle http transport.
+ ///
+ ///
+ /// Optional. The set of delegating handlers to insert in the http
+ /// client pipeline.
+ ///
+ public AutoRestParameterGroupingTestService(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers)
+ {
+ this.Initialize();
+ }
+
+ ///
+ /// Initializes a new instance of the AutoRestParameterGroupingTestService class.
+ ///
+ ///
+ /// Optional. The base URI of the service.
+ ///
+ ///
+ /// Optional. The set of delegating handlers to insert in the http
+ /// client pipeline.
+ ///
+ public AutoRestParameterGroupingTestService(Uri baseUri, params DelegatingHandler[] handlers) : this(handlers)
+ {
+ if (baseUri == null)
+ {
+ throw new ArgumentNullException("baseUri");
+ }
+ this.BaseUri = baseUri;
+ }
+
+ ///
+ /// Initializes a new instance of the AutoRestParameterGroupingTestService class.
+ ///
+ ///
+ /// Required. The management credentials for Azure.
+ ///
+ ///
+ /// Optional. The set of delegating handlers to insert in the http
+ /// client pipeline.
+ ///
+ public AutoRestParameterGroupingTestService(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers)
+ {
+ if (credentials == null)
+ {
+ throw new ArgumentNullException("credentials");
+ }
+ this.Credentials = credentials;
+ }
+
+ ///
+ /// Initializes a new instance of the AutoRestParameterGroupingTestService class.
+ ///
+ ///
+ /// Optional. The base URI of the service.
+ ///
+ ///
+ /// Required. The management credentials for Azure.
+ ///
+ ///
+ /// Optional. The set of delegating handlers to insert in the http
+ /// client pipeline.
+ ///
+ public AutoRestParameterGroupingTestService(Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers)
+ {
+ if (baseUri == null)
+ {
+ throw new ArgumentNullException("baseUri");
+ }
+ if (credentials == null)
+ {
+ throw new ArgumentNullException("credentials");
+ }
+ this.BaseUri = baseUri;
+ this.Credentials = credentials;
+ }
+
+ ///
+ /// Initializes client properties.
+ ///
+ private void Initialize()
+ {
+ this.ParameterGrouping = new ParameterGroupingOperations(this);
+ this.BaseUri = new Uri("https://localhost");
+ this.AcceptLanguage = "en-US";
+ if (this.Credentials != null)
+ {
+ this.Credentials.InitializeServiceClient(this);
+ }
+ SerializationSettings = new JsonSerializerSettings
+ {
+ Formatting = Formatting.Indented,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
+ ContractResolver = new ReadOnlyJsonContractResolver(),
+ Converters = new List
+ {
+ new Iso8601TimeSpanConverter()
+ }
+ };
+ SerializationSettings.Converters.Add(new ResourceJsonConverter());
+ DeserializationSettings = new JsonSerializerSettings{
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
+ ContractResolver = new ReadOnlyJsonContractResolver(),
+ Converters = new List
+ {
+ new Iso8601TimeSpanConverter()
+ }
+ };
+ DeserializationSettings.Converters.Add(new ResourceJsonConverter());
+ DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
+ }
+ }
+}
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/AutoRestParameterGroupingTestServiceExtensions.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/AutoRestParameterGroupingTestServiceExtensions.cs
new file mode 100644
index 0000000000..c27ba9ae5f
--- /dev/null
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/AutoRestParameterGroupingTestServiceExtensions.cs
@@ -0,0 +1,23 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping
+{
+ using System;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+
+ public static partial class AutoRestParameterGroupingTestServiceExtensions
+ {
+ }
+}
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/IAutoRestParameterGroupingTestService.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/IAutoRestParameterGroupingTestService.cs
new file mode 100644
index 0000000000..3e1eba4872
--- /dev/null
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/IAutoRestParameterGroupingTestService.cs
@@ -0,0 +1,60 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+ using Newtonsoft.Json;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+
+ ///
+ /// Test Infrastructure for AutoRest
+ ///
+ public partial interface IAutoRestParameterGroupingTestService
+ {
+ ///
+ /// The base URI of the service.
+ ///
+ Uri BaseUri { get; set; }
+
+ ///
+ /// Gets or sets json serialization settings.
+ ///
+ JsonSerializerSettings SerializationSettings { get; }
+
+ ///
+ /// Gets or sets json deserialization settings.
+ ///
+ JsonSerializerSettings DeserializationSettings { get; }
+
+ ///
+ /// The management credentials for Azure.
+ ///
+ ServiceClientCredentials Credentials { get; }
+
+ ///
+ /// Gets or sets the preferred language for the response.
+ ///
+ string AcceptLanguage { get; set; }
+
+ ///
+ /// The retry timeout for Long Running Operations.
+ ///
+ int? LongRunningOperationRetryTimeout { get; set; }
+
+
+ IParameterGroupingOperations ParameterGrouping { get; }
+
+ }
+}
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/IParameterGroupingOperations.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/IParameterGroupingOperations.cs
new file mode 100644
index 0000000000..1ce4ffaae6
--- /dev/null
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/IParameterGroupingOperations.cs
@@ -0,0 +1,68 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+
+ ///
+ /// ParameterGroupingOperations operations.
+ ///
+ public partial interface IParameterGroupingOperations
+ {
+ ///
+ /// Post a bunch of required parameters grouped
+ ///
+ ///
+ /// Additional parameters for the operation
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ Task PostRequiredWithHttpMessagesAsync(ParameterGroupingPostRequiredParameters parameterGroupingPostRequiredParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Post a bunch of optional parameters grouped
+ ///
+ ///
+ /// Additional parameters for the operation
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ Task PostOptionalWithHttpMessagesAsync(ParameterGroupingPostOptionalParameters parameterGroupingPostOptionalParameters = default(ParameterGroupingPostOptionalParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Post parameters from multiple different parameter groups
+ ///
+ ///
+ /// Additional parameters for the operation
+ ///
+ ///
+ /// Additional parameters for the operation
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ Task PostMultipleParameterGroupsWithHttpMessagesAsync(FirstParameterGroup firstParameterGroup = default(FirstParameterGroup), SecondParameterGroup secondParameterGroup = default(SecondParameterGroup), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/Models/Error.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/Models/Error.cs
new file mode 100644
index 0000000000..c9c227d19a
--- /dev/null
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/Models/Error.cs
@@ -0,0 +1,48 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping.Models
+{
+ using System;
+ using System.Linq;
+ using System.Collections.Generic;
+ using Newtonsoft.Json;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Serialization;
+ using Microsoft.Rest.Azure;
+
+ ///
+ ///
+ public partial class Error
+ {
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "status")]
+ public int? Status { get; set; }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "message")]
+ public string Message { get; set; }
+
+ }
+}
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/Models/FirstParameterGroup.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/Models/FirstParameterGroup.cs
new file mode 100644
index 0000000000..5600cc4269
--- /dev/null
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/Models/FirstParameterGroup.cs
@@ -0,0 +1,50 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping.Models
+{
+ using System;
+ using System.Linq;
+ using System.Collections.Generic;
+ using Newtonsoft.Json;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Serialization;
+ using Microsoft.Rest.Azure;
+
+ ///
+ /// Additional parameters for the postMultipleParameterGroups operation.
+ ///
+ public partial class FirstParameterGroup
+ {
+ ///
+ /// Initializes a new instance of the FirstParameterGroup class.
+ ///
+ public FirstParameterGroup() { }
+
+ ///
+ /// Initializes a new instance of the FirstParameterGroup class.
+ ///
+ public FirstParameterGroup(string headerOne = default(string), int? queryOne = default(int?))
+ {
+ HeaderOne = headerOne;
+ QueryOne = queryOne;
+ }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "")]
+ public string HeaderOne { get; set; }
+
+ ///
+ /// Query parameter with default
+ ///
+ [JsonProperty(PropertyName = "")]
+ public int? QueryOne { get; set; }
+
+ }
+}
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/Models/ParameterGroupingPostOptionalParameters.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/Models/ParameterGroupingPostOptionalParameters.cs
new file mode 100644
index 0000000000..841c776b09
--- /dev/null
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/Models/ParameterGroupingPostOptionalParameters.cs
@@ -0,0 +1,52 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping.Models
+{
+ using System;
+ using System.Linq;
+ using System.Collections.Generic;
+ using Newtonsoft.Json;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Serialization;
+ using Microsoft.Rest.Azure;
+
+ ///
+ /// Additional parameters for the postOptional operation.
+ ///
+ public partial class ParameterGroupingPostOptionalParameters
+ {
+ ///
+ /// Initializes a new instance of the
+ /// ParameterGroupingPostOptionalParameters class.
+ ///
+ public ParameterGroupingPostOptionalParameters() { }
+
+ ///
+ /// Initializes a new instance of the
+ /// ParameterGroupingPostOptionalParameters class.
+ ///
+ public ParameterGroupingPostOptionalParameters(string customHeader = default(string), int? query = default(int?))
+ {
+ CustomHeader = customHeader;
+ Query = query;
+ }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "")]
+ public string CustomHeader { get; set; }
+
+ ///
+ /// Query parameter with default
+ ///
+ [JsonProperty(PropertyName = "")]
+ public int? Query { get; set; }
+
+ }
+}
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/Models/ParameterGroupingPostRequiredParameters.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/Models/ParameterGroupingPostRequiredParameters.cs
new file mode 100644
index 0000000000..0117cf98d1
--- /dev/null
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/Models/ParameterGroupingPostRequiredParameters.cs
@@ -0,0 +1,79 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping.Models
+{
+ using System;
+ using System.Linq;
+ using System.Collections.Generic;
+ using Newtonsoft.Json;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Serialization;
+ using Microsoft.Rest.Azure;
+
+ ///
+ /// Additional parameters for the postRequired operation.
+ ///
+ public partial class ParameterGroupingPostRequiredParameters
+ {
+ ///
+ /// Initializes a new instance of the
+ /// ParameterGroupingPostRequiredParameters class.
+ ///
+ public ParameterGroupingPostRequiredParameters() { }
+
+ ///
+ /// Initializes a new instance of the
+ /// ParameterGroupingPostRequiredParameters class.
+ ///
+ public ParameterGroupingPostRequiredParameters(int? body, string path, string customHeader = default(string), int? query = default(int?))
+ {
+ Body = body;
+ CustomHeader = customHeader;
+ Query = query;
+ Path = path;
+ }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "")]
+ public int? Body { get; set; }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "")]
+ public string CustomHeader { get; set; }
+
+ ///
+ /// Query parameter with default
+ ///
+ [JsonProperty(PropertyName = "")]
+ public int? Query { get; set; }
+
+ ///
+ /// Path parameter
+ ///
+ [JsonProperty(PropertyName = "")]
+ public string Path { get; set; }
+
+ ///
+ /// Validate the object. Throws ArgumentException or ArgumentNullException if validation fails.
+ ///
+ public virtual void Validate()
+ {
+ if (Body == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Body");
+ }
+ if (Path == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Path");
+ }
+ }
+ }
+}
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/Models/SecondParameterGroup.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/Models/SecondParameterGroup.cs
new file mode 100644
index 0000000000..8d9e1f33a9
--- /dev/null
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/Models/SecondParameterGroup.cs
@@ -0,0 +1,50 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping.Models
+{
+ using System;
+ using System.Linq;
+ using System.Collections.Generic;
+ using Newtonsoft.Json;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Serialization;
+ using Microsoft.Rest.Azure;
+
+ ///
+ /// Additional parameters for the postMultipleParameterGroups operation.
+ ///
+ public partial class SecondParameterGroup
+ {
+ ///
+ /// Initializes a new instance of the SecondParameterGroup class.
+ ///
+ public SecondParameterGroup() { }
+
+ ///
+ /// Initializes a new instance of the SecondParameterGroup class.
+ ///
+ public SecondParameterGroup(string headerTwo = default(string), int? queryTwo = default(int?))
+ {
+ HeaderTwo = headerTwo;
+ QueryTwo = queryTwo;
+ }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "")]
+ public string HeaderTwo { get; set; }
+
+ ///
+ /// Query parameter with default
+ ///
+ [JsonProperty(PropertyName = "")]
+ public int? QueryTwo { get; set; }
+
+ }
+}
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/ParameterGroupingOperations.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/ParameterGroupingOperations.cs
new file mode 100644
index 0000000000..dd495157e7
--- /dev/null
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/ParameterGroupingOperations.cs
@@ -0,0 +1,463 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping
+{
+ using System;
+ using System.Linq;
+ using System.Collections.Generic;
+ using System.Net;
+ using System.Net.Http;
+ using System.Net.Http.Headers;
+ using System.Text;
+ using System.Text.RegularExpressions;
+ using System.Threading;
+ using System.Threading.Tasks;
+ using Microsoft.Rest;
+ using Newtonsoft.Json;
+ using Microsoft.Rest.Azure;
+ using Models;
+
+ ///
+ /// ParameterGroupingOperations operations.
+ ///
+ internal partial class ParameterGroupingOperations : IServiceOperations, IParameterGroupingOperations
+ {
+ ///
+ /// Initializes a new instance of the ParameterGroupingOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ internal ParameterGroupingOperations(AutoRestParameterGroupingTestService client)
+ {
+ if (client == null)
+ {
+ throw new ArgumentNullException("client");
+ }
+ this.Client = client;
+ }
+
+ ///
+ /// Gets a reference to the AutoRestParameterGroupingTestService
+ ///
+ public AutoRestParameterGroupingTestService Client { get; private set; }
+
+ ///
+ /// Post a bunch of required parameters grouped
+ ///
+ ///
+ /// Additional parameters for the operation
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task PostRequiredWithHttpMessagesAsync(ParameterGroupingPostRequiredParameters parameterGroupingPostRequiredParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ var body = (parameterGroupingPostRequiredParameters == null ? default(int?) : parameterGroupingPostRequiredParameters.Body);
+ var customHeader = (parameterGroupingPostRequiredParameters == null ? default(string) : parameterGroupingPostRequiredParameters.CustomHeader);
+ var query = (parameterGroupingPostRequiredParameters == null ? default(int?) : parameterGroupingPostRequiredParameters.Query);
+ var path = (parameterGroupingPostRequiredParameters == null ? default(string) : parameterGroupingPostRequiredParameters.Path);
+ if (body == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "body");
+ }
+ if (path == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "path");
+ }
+ // Tracing
+ bool shouldTrace = ServiceClientTracing.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("body", body);
+ tracingParameters.Add("customHeader", customHeader);
+ tracingParameters.Add("query", query);
+ tracingParameters.Add("path", path);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(invocationId, this, "PostRequired", tracingParameters);
+ }
+ // Construct URL
+ var baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var url = new Uri(new Uri(baseUrl + (baseUrl.EndsWith("/") ? "" : "/")), "parameterGrouping/postRequired/{path}").ToString();
+ url = url.Replace("{path}", Uri.EscapeDataString(path));
+ List queryParameters = new List();
+ if (query != null)
+ {
+ queryParameters.Add(string.Format("query={0}", Uri.EscapeDataString(JsonConvert.SerializeObject(query, this.Client.SerializationSettings).Trim('"'))));
+ }
+ if (queryParameters.Count > 0)
+ {
+ url += "?" + string.Join("&", queryParameters);
+ }
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = new HttpRequestMessage();
+ httpRequest.Method = new HttpMethod("POST");
+ httpRequest.RequestUri = new Uri(url);
+ // Set Headers
+ httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ if (this.Client.AcceptLanguage != null)
+ {
+ if (httpRequest.Headers.Contains("accept-language"))
+ {
+ httpRequest.Headers.Remove("accept-language");
+ }
+ httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ }
+ if (customHeader != null)
+ {
+ if (httpRequest.Headers.Contains("customHeader"))
+ {
+ httpRequest.Headers.Remove("customHeader");
+ }
+ httpRequest.Headers.TryAddWithoutValidation("customHeader", customHeader);
+ }
+ if (customHeaders != null)
+ {
+ foreach(var header in customHeaders)
+ {
+ if (httpRequest.Headers.Contains(header.Key))
+ {
+ httpRequest.Headers.Remove(header.Key);
+ }
+ httpRequest.Headers.TryAddWithoutValidation(header.Key, header.Value);
+ }
+ }
+
+ // Set Credentials
+ if (this.Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Serialize Request
+ string requestContent = JsonConvert.SerializeObject(body, this.Client.SerializationSettings);
+ httpRequest.Content = new StringContent(requestContent, Encoding.UTF8);
+ httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ // Send Request
+ if (shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ HttpResponseMessage httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ if (!(statusCode == (HttpStatusCode)Enum.Parse(typeof(HttpStatusCode), "OK")))
+ {
+ var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", statusCode));
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ Error errorBody = JsonConvert.DeserializeObject(responseContent, this.Client.DeserializationSettings);
+ if (errorBody != null)
+ {
+ ex.Body = errorBody;
+ }
+ ex.Request = httpRequest;
+ ex.Response = httpResponse;
+ if (shouldTrace)
+ {
+ ServiceClientTracing.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+ // Create Result
+ var result = new AzureOperationResponse();
+ result.Request = httpRequest;
+ result.Response = httpResponse;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (shouldTrace)
+ {
+ ServiceClientTracing.Exit(invocationId, result);
+ }
+ return result;
+ }
+
+ ///
+ /// Post a bunch of optional parameters grouped
+ ///
+ ///
+ /// Additional parameters for the operation
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task PostOptionalWithHttpMessagesAsync(ParameterGroupingPostOptionalParameters parameterGroupingPostOptionalParameters = default(ParameterGroupingPostOptionalParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ var customHeader = (parameterGroupingPostOptionalParameters == null ? default(string) : parameterGroupingPostOptionalParameters.CustomHeader);
+ var query = (parameterGroupingPostOptionalParameters == null ? default(int?) : parameterGroupingPostOptionalParameters.Query);
+ // Tracing
+ bool shouldTrace = ServiceClientTracing.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("customHeader", customHeader);
+ tracingParameters.Add("query", query);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(invocationId, this, "PostOptional", tracingParameters);
+ }
+ // Construct URL
+ var baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var url = new Uri(new Uri(baseUrl + (baseUrl.EndsWith("/") ? "" : "/")), "parameterGrouping/postOptional").ToString();
+ List queryParameters = new List();
+ if (query != null)
+ {
+ queryParameters.Add(string.Format("query={0}", Uri.EscapeDataString(JsonConvert.SerializeObject(query, this.Client.SerializationSettings).Trim('"'))));
+ }
+ if (queryParameters.Count > 0)
+ {
+ url += "?" + string.Join("&", queryParameters);
+ }
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = new HttpRequestMessage();
+ httpRequest.Method = new HttpMethod("POST");
+ httpRequest.RequestUri = new Uri(url);
+ // Set Headers
+ httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ if (this.Client.AcceptLanguage != null)
+ {
+ if (httpRequest.Headers.Contains("accept-language"))
+ {
+ httpRequest.Headers.Remove("accept-language");
+ }
+ httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ }
+ if (customHeader != null)
+ {
+ if (httpRequest.Headers.Contains("customHeader"))
+ {
+ httpRequest.Headers.Remove("customHeader");
+ }
+ httpRequest.Headers.TryAddWithoutValidation("customHeader", customHeader);
+ }
+ if (customHeaders != null)
+ {
+ foreach(var header in customHeaders)
+ {
+ if (httpRequest.Headers.Contains(header.Key))
+ {
+ httpRequest.Headers.Remove(header.Key);
+ }
+ httpRequest.Headers.TryAddWithoutValidation(header.Key, header.Value);
+ }
+ }
+
+ // Set Credentials
+ if (this.Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ HttpResponseMessage httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ if (!(statusCode == (HttpStatusCode)Enum.Parse(typeof(HttpStatusCode), "OK")))
+ {
+ var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", statusCode));
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ Error errorBody = JsonConvert.DeserializeObject(responseContent, this.Client.DeserializationSettings);
+ if (errorBody != null)
+ {
+ ex.Body = errorBody;
+ }
+ ex.Request = httpRequest;
+ ex.Response = httpResponse;
+ if (shouldTrace)
+ {
+ ServiceClientTracing.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+ // Create Result
+ var result = new AzureOperationResponse();
+ result.Request = httpRequest;
+ result.Response = httpResponse;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (shouldTrace)
+ {
+ ServiceClientTracing.Exit(invocationId, result);
+ }
+ return result;
+ }
+
+ ///
+ /// Post parameters from multiple different parameter groups
+ ///
+ ///
+ /// Additional parameters for the operation
+ ///
+ ///
+ /// Additional parameters for the operation
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task PostMultipleParameterGroupsWithHttpMessagesAsync(FirstParameterGroup firstParameterGroup = default(FirstParameterGroup), SecondParameterGroup secondParameterGroup = default(SecondParameterGroup), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ var headerOne = (firstParameterGroup == null ? default(string) : firstParameterGroup.HeaderOne);
+ var queryOne = (firstParameterGroup == null ? default(int?) : firstParameterGroup.QueryOne);
+ var headerTwo = (secondParameterGroup == null ? default(string) : secondParameterGroup.HeaderTwo);
+ var queryTwo = (secondParameterGroup == null ? default(int?) : secondParameterGroup.QueryTwo);
+ // Tracing
+ bool shouldTrace = ServiceClientTracing.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("headerOne", headerOne);
+ tracingParameters.Add("queryOne", queryOne);
+ tracingParameters.Add("headerTwo", headerTwo);
+ tracingParameters.Add("queryTwo", queryTwo);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(invocationId, this, "PostMultipleParameterGroups", tracingParameters);
+ }
+ // Construct URL
+ var baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var url = new Uri(new Uri(baseUrl + (baseUrl.EndsWith("/") ? "" : "/")), "parameterGrouping/postMultipleParameterGroups").ToString();
+ List queryParameters = new List();
+ if (queryOne != null)
+ {
+ queryParameters.Add(string.Format("query-one={0}", Uri.EscapeDataString(JsonConvert.SerializeObject(queryOne, this.Client.SerializationSettings).Trim('"'))));
+ }
+ if (queryTwo != null)
+ {
+ queryParameters.Add(string.Format("query-two={0}", Uri.EscapeDataString(JsonConvert.SerializeObject(queryTwo, this.Client.SerializationSettings).Trim('"'))));
+ }
+ if (queryParameters.Count > 0)
+ {
+ url += "?" + string.Join("&", queryParameters);
+ }
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = new HttpRequestMessage();
+ httpRequest.Method = new HttpMethod("POST");
+ httpRequest.RequestUri = new Uri(url);
+ // Set Headers
+ httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ if (this.Client.AcceptLanguage != null)
+ {
+ if (httpRequest.Headers.Contains("accept-language"))
+ {
+ httpRequest.Headers.Remove("accept-language");
+ }
+ httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ }
+ if (headerOne != null)
+ {
+ if (httpRequest.Headers.Contains("header-one"))
+ {
+ httpRequest.Headers.Remove("header-one");
+ }
+ httpRequest.Headers.TryAddWithoutValidation("header-one", headerOne);
+ }
+ if (headerTwo != null)
+ {
+ if (httpRequest.Headers.Contains("header-two"))
+ {
+ httpRequest.Headers.Remove("header-two");
+ }
+ httpRequest.Headers.TryAddWithoutValidation("header-two", headerTwo);
+ }
+ if (customHeaders != null)
+ {
+ foreach(var header in customHeaders)
+ {
+ if (httpRequest.Headers.Contains(header.Key))
+ {
+ httpRequest.Headers.Remove(header.Key);
+ }
+ httpRequest.Headers.TryAddWithoutValidation(header.Key, header.Value);
+ }
+ }
+
+ // Set Credentials
+ if (this.Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ HttpResponseMessage httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ if (!(statusCode == (HttpStatusCode)Enum.Parse(typeof(HttpStatusCode), "OK")))
+ {
+ var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", statusCode));
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ Error errorBody = JsonConvert.DeserializeObject(responseContent, this.Client.DeserializationSettings);
+ if (errorBody != null)
+ {
+ ex.Body = errorBody;
+ }
+ ex.Request = httpRequest;
+ ex.Response = httpResponse;
+ if (shouldTrace)
+ {
+ ServiceClientTracing.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+ // Create Result
+ var result = new AzureOperationResponse();
+ result.Request = httpRequest;
+ result.Response = httpResponse;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (shouldTrace)
+ {
+ ServiceClientTracing.Exit(invocationId, result);
+ }
+ return result;
+ }
+
+ }
+}
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/ParameterGroupingOperationsExtensions.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/ParameterGroupingOperationsExtensions.cs
new file mode 100644
index 0000000000..bcb75c7dfc
--- /dev/null
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/ParameterGroupingOperationsExtensions.cs
@@ -0,0 +1,122 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping
+{
+ using System;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+
+ public static partial class ParameterGroupingOperationsExtensions
+ {
+ ///
+ /// Post a bunch of required parameters grouped
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Additional parameters for the operation
+ ///
+ public static void PostRequired(this IParameterGroupingOperations operations, ParameterGroupingPostRequiredParameters parameterGroupingPostRequiredParameters)
+ {
+ Task.Factory.StartNew(s => ((IParameterGroupingOperations)s).PostRequiredAsync(parameterGroupingPostRequiredParameters), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Post a bunch of required parameters grouped
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Additional parameters for the operation
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task PostRequiredAsync( this IParameterGroupingOperations operations, ParameterGroupingPostRequiredParameters parameterGroupingPostRequiredParameters, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ await operations.PostRequiredWithHttpMessagesAsync(parameterGroupingPostRequiredParameters, null, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Post a bunch of optional parameters grouped
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Additional parameters for the operation
+ ///
+ public static void PostOptional(this IParameterGroupingOperations operations, ParameterGroupingPostOptionalParameters parameterGroupingPostOptionalParameters = default(ParameterGroupingPostOptionalParameters))
+ {
+ Task.Factory.StartNew(s => ((IParameterGroupingOperations)s).PostOptionalAsync(parameterGroupingPostOptionalParameters), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Post a bunch of optional parameters grouped
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Additional parameters for the operation
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task PostOptionalAsync( this IParameterGroupingOperations operations, ParameterGroupingPostOptionalParameters parameterGroupingPostOptionalParameters = default(ParameterGroupingPostOptionalParameters), CancellationToken cancellationToken = default(CancellationToken))
+ {
+ await operations.PostOptionalWithHttpMessagesAsync(parameterGroupingPostOptionalParameters, null, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Post parameters from multiple different parameter groups
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Additional parameters for the operation
+ ///
+ ///
+ /// Additional parameters for the operation
+ ///
+ public static void PostMultipleParameterGroups(this IParameterGroupingOperations operations, FirstParameterGroup firstParameterGroup = default(FirstParameterGroup), SecondParameterGroup secondParameterGroup = default(SecondParameterGroup))
+ {
+ Task.Factory.StartNew(s => ((IParameterGroupingOperations)s).PostMultipleParameterGroupsAsync(firstParameterGroup, secondParameterGroup), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Post parameters from multiple different parameter groups
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Additional parameters for the operation
+ ///
+ ///
+ /// Additional parameters for the operation
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task PostMultipleParameterGroupsAsync( this IParameterGroupingOperations operations, FirstParameterGroup firstParameterGroup = default(FirstParameterGroup), SecondParameterGroup secondParameterGroup = default(SecondParameterGroup), CancellationToken cancellationToken = default(CancellationToken))
+ {
+ await operations.PostMultipleParameterGroupsWithHttpMessagesAsync(firstParameterGroup, secondParameterGroup, null, cancellationToken).ConfigureAwait(false);
+ }
+
+ }
+}
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureReport/Models/Error.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureReport/Models/Error.cs
index 9bb21e3587..c931baf0a9 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureReport/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureReport/Models/Error.cs
@@ -20,6 +20,20 @@ namespace Fixtures.Azure.AcceptanceTestsAzureReport.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureSpecials/Models/Error.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureSpecials/Models/Error.cs
index 4ccdd1174d..9af348540d 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureSpecials/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureSpecials/Models/Error.cs
@@ -20,6 +20,20 @@ namespace Fixtures.Azure.AcceptanceTestsAzureSpecials.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/OperationResult.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/OperationResult.cs
index 1f66243f4a..7b7bde866b 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/OperationResult.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/OperationResult.cs
@@ -20,6 +20,20 @@ namespace Fixtures.Azure.AcceptanceTestsLro.Models
///
public partial class OperationResult
{
+ ///
+ /// Initializes a new instance of the OperationResult class.
+ ///
+ public OperationResult() { }
+
+ ///
+ /// Initializes a new instance of the OperationResult class.
+ ///
+ public OperationResult(string status = default(string), OperationResultError error = default(OperationResultError))
+ {
+ Status = status;
+ Error = error;
+ }
+
///
/// The status of the request. Possible values for this property
/// include: 'Succeeded', 'Failed', 'canceled', 'Accepted',
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/OperationResultError.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/OperationResultError.cs
index c3361a2ed0..2477eaaf08 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/OperationResultError.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/OperationResultError.cs
@@ -20,6 +20,20 @@ namespace Fixtures.Azure.AcceptanceTestsLro.Models
///
public partial class OperationResultError
{
+ ///
+ /// Initializes a new instance of the OperationResultError class.
+ ///
+ public OperationResultError() { }
+
+ ///
+ /// Initializes a new instance of the OperationResultError class.
+ ///
+ public OperationResultError(int? code = default(int?), string message = default(string))
+ {
+ Code = code;
+ Message = message;
+ }
+
///
/// The error code for an operation failure
///
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/Product.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/Product.cs
index d3ffc218ad..082edb7a7e 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/Product.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/Product.cs
@@ -20,6 +20,20 @@ namespace Fixtures.Azure.AcceptanceTestsLro.Models
///
public partial class Product : Resource
{
+ ///
+ /// Initializes a new instance of the Product class.
+ ///
+ public Product() { }
+
+ ///
+ /// Initializes a new instance of the Product class.
+ ///
+ public Product(string provisioningState = default(string), string provisioningStateValues = default(string))
+ {
+ ProvisioningState = provisioningState;
+ ProvisioningStateValues = provisioningStateValues;
+ }
+
///
///
[JsonProperty(PropertyName = "properties.provisioningState")]
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/Resource.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/Resource.cs
index 6e0807f58c..f3109f2123 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/Resource.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/Resource.cs
@@ -20,6 +20,23 @@ namespace Fixtures.Azure.AcceptanceTestsLro.Models
///
public partial class Resource : IResource
{
+ ///
+ /// Initializes a new instance of the Resource class.
+ ///
+ public Resource() { }
+
+ ///
+ /// Initializes a new instance of the Resource class.
+ ///
+ public Resource(string id = default(string), string type = default(string), IDictionary tags = default(IDictionary), string location = default(string), string name = default(string))
+ {
+ Id = id;
+ Type = type;
+ Tags = tags;
+ Location = location;
+ Name = name;
+ }
+
///
/// Resource Id
///
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/Sku.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/Sku.cs
index c7d5968668..ca86d34c94 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/Sku.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/Sku.cs
@@ -20,6 +20,20 @@ namespace Fixtures.Azure.AcceptanceTestsLro.Models
///
public partial class Sku
{
+ ///
+ /// Initializes a new instance of the Sku class.
+ ///
+ public Sku() { }
+
+ ///
+ /// Initializes a new instance of the Sku class.
+ ///
+ public Sku(string name = default(string), string id = default(string))
+ {
+ Name = name;
+ Id = id;
+ }
+
///
///
[JsonProperty(PropertyName = "name")]
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/SubProduct.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/SubProduct.cs
index 15758ea469..f7982b335b 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/SubProduct.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/SubProduct.cs
@@ -20,6 +20,20 @@ namespace Fixtures.Azure.AcceptanceTestsLro.Models
///
public partial class SubProduct : SubResource
{
+ ///
+ /// Initializes a new instance of the SubProduct class.
+ ///
+ public SubProduct() { }
+
+ ///
+ /// Initializes a new instance of the SubProduct class.
+ ///
+ public SubProduct(string provisioningState = default(string), string provisioningStateValues = default(string))
+ {
+ ProvisioningState = provisioningState;
+ ProvisioningStateValues = provisioningStateValues;
+ }
+
///
///
[JsonProperty(PropertyName = "properties.provisioningState")]
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/SubResource.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/SubResource.cs
index 9517adacca..8d1f9e7179 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/SubResource.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/Models/SubResource.cs
@@ -20,6 +20,19 @@ namespace Fixtures.Azure.AcceptanceTestsLro.Models
///
public partial class SubResource : IResource
{
+ ///
+ /// Initializes a new instance of the SubResource class.
+ ///
+ public SubResource() { }
+
+ ///
+ /// Initializes a new instance of the SubResource class.
+ ///
+ public SubResource(string id = default(string))
+ {
+ Id = id;
+ }
+
///
/// Sub Resource Id
///
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Paging/Models/OperationResult.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Paging/Models/OperationResult.cs
index ee1232b21e..4a96094729 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Paging/Models/OperationResult.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Paging/Models/OperationResult.cs
@@ -20,6 +20,19 @@ namespace Fixtures.Azure.AcceptanceTestsPaging.Models
///
public partial class OperationResult
{
+ ///
+ /// Initializes a new instance of the OperationResult class.
+ ///
+ public OperationResult() { }
+
+ ///
+ /// Initializes a new instance of the OperationResult class.
+ ///
+ public OperationResult(string status = default(string))
+ {
+ Status = status;
+ }
+
///
/// The status of the request. Possible values for this property
/// include: 'Succeeded', 'Failed', 'canceled', 'Accepted',
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Paging/Models/Product.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Paging/Models/Product.cs
index 4e089bad50..e77aacd52f 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Paging/Models/Product.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Paging/Models/Product.cs
@@ -20,6 +20,19 @@ namespace Fixtures.Azure.AcceptanceTestsPaging.Models
///
public partial class Product
{
+ ///
+ /// Initializes a new instance of the Product class.
+ ///
+ public Product() { }
+
+ ///
+ /// Initializes a new instance of the Product class.
+ ///
+ public Product(ProductProperties properties = default(ProductProperties))
+ {
+ Properties = properties;
+ }
+
///
///
[JsonProperty(PropertyName = "properties")]
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Paging/Models/ProductProperties.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Paging/Models/ProductProperties.cs
index 4f2f80e945..9d90a71952 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Paging/Models/ProductProperties.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Paging/Models/ProductProperties.cs
@@ -20,6 +20,20 @@ namespace Fixtures.Azure.AcceptanceTestsPaging.Models
///
public partial class ProductProperties
{
+ ///
+ /// Initializes a new instance of the ProductProperties class.
+ ///
+ public ProductProperties() { }
+
+ ///
+ /// Initializes a new instance of the ProductProperties class.
+ ///
+ public ProductProperties(int? id = default(int?), string name = default(string))
+ {
+ Id = id;
+ Name = name;
+ }
+
///
///
[JsonProperty(PropertyName = "id")]
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/ResourceFlattening/Models/Error.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/ResourceFlattening/Models/Error.cs
index 10d48efd22..57b505be6a 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/ResourceFlattening/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/ResourceFlattening/Models/Error.cs
@@ -20,6 +20,20 @@ namespace Fixtures.Azure.AcceptanceTestsResourceFlattening.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/ResourceFlattening/Models/FlattenedProduct.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/ResourceFlattening/Models/FlattenedProduct.cs
index 47c6aeeaa2..114fd41f8b 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/ResourceFlattening/Models/FlattenedProduct.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/ResourceFlattening/Models/FlattenedProduct.cs
@@ -20,6 +20,22 @@ namespace Fixtures.Azure.AcceptanceTestsResourceFlattening.Models
///
public partial class FlattenedProduct : Resource
{
+ ///
+ /// Initializes a new instance of the FlattenedProduct class.
+ ///
+ public FlattenedProduct() { }
+
+ ///
+ /// Initializes a new instance of the FlattenedProduct class.
+ ///
+ public FlattenedProduct(string pname = default(string), string flattenedProductType = default(string), string provisioningStateValues = default(string), string provisioningState = default(string))
+ {
+ Pname = pname;
+ FlattenedProductType = flattenedProductType;
+ ProvisioningStateValues = provisioningStateValues;
+ ProvisioningState = provisioningState;
+ }
+
///
///
[JsonProperty(PropertyName = "properties.pname")]
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/ResourceFlattening/Models/Resource.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/ResourceFlattening/Models/Resource.cs
index f8c7f7f32e..87d307e606 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/ResourceFlattening/Models/Resource.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/ResourceFlattening/Models/Resource.cs
@@ -20,6 +20,23 @@ namespace Fixtures.Azure.AcceptanceTestsResourceFlattening.Models
///
public partial class Resource : IResource
{
+ ///
+ /// Initializes a new instance of the Resource class.
+ ///
+ public Resource() { }
+
+ ///
+ /// Initializes a new instance of the Resource class.
+ ///
+ public Resource(string id = default(string), string type = default(string), IDictionary tags = default(IDictionary), string location = default(string), string name = default(string))
+ {
+ Id = id;
+ Type = type;
+ Tags = tags;
+ Location = location;
+ Name = name;
+ }
+
///
/// Resource Id
///
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/ResourceFlattening/Models/ResourceCollection.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/ResourceFlattening/Models/ResourceCollection.cs
index f10d73245a..8a72f294dc 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/ResourceFlattening/Models/ResourceCollection.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/ResourceFlattening/Models/ResourceCollection.cs
@@ -20,6 +20,21 @@ namespace Fixtures.Azure.AcceptanceTestsResourceFlattening.Models
///
public partial class ResourceCollection
{
+ ///
+ /// Initializes a new instance of the ResourceCollection class.
+ ///
+ public ResourceCollection() { }
+
+ ///
+ /// Initializes a new instance of the ResourceCollection class.
+ ///
+ public ResourceCollection(FlattenedProduct productresource = default(FlattenedProduct), IList arrayofresources = default(IList), IDictionary dictionaryofresources = default(IDictionary))
+ {
+ Productresource = productresource;
+ Arrayofresources = arrayofresources;
+ Dictionaryofresources = dictionaryofresources;
+ }
+
///
///
[JsonProperty(PropertyName = "productresource")]
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/Models/Error.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/Models/Error.cs
index 0f2fc90e66..5fadcf760d 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/Models/Error.cs
@@ -20,6 +20,20 @@ namespace Fixtures.Azure.AcceptanceTestsSubscriptionIdApiVersion.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? code = default(int?), string message = default(string))
+ {
+ Code = code;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "code")]
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/Models/SampleResourceGroup.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/Models/SampleResourceGroup.cs
index 9a3cde59a6..f1a52ce190 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/Models/SampleResourceGroup.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/Models/SampleResourceGroup.cs
@@ -20,6 +20,20 @@ namespace Fixtures.Azure.AcceptanceTestsSubscriptionIdApiVersion.Models
///
public partial class SampleResourceGroup
{
+ ///
+ /// Initializes a new instance of the SampleResourceGroup class.
+ ///
+ public SampleResourceGroup() { }
+
+ ///
+ /// Initializes a new instance of the SampleResourceGroup class.
+ ///
+ public SampleResourceGroup(string name = default(string), string location = default(string))
+ {
+ Name = name;
+ Location = location;
+ }
+
///
/// resource group name 'testgroup101'
///
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp/AzureCSharpCodeGenerator.cs b/AutoRest/Generators/CSharp/Azure.CSharp/AzureCSharpCodeGenerator.cs
index 50df2d2381..f7218eaf56 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp/AzureCSharpCodeGenerator.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp/AzureCSharpCodeGenerator.cs
@@ -1,8 +1,10 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
+using System;
using System.Globalization;
using System.IO;
+using System.Linq;
using System.Threading.Tasks;
using Microsoft.Rest.Generator.Azure;
using Microsoft.Rest.Generator.ClientModel;
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp/TemplateModels/AzureMethodTemplateModel.cs b/AutoRest/Generators/CSharp/Azure.CSharp/TemplateModels/AzureMethodTemplateModel.cs
index dbad038fe3..38481b4454 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp/TemplateModels/AzureMethodTemplateModel.cs
+++ b/AutoRest/Generators/CSharp/Azure.CSharp/TemplateModels/AzureMethodTemplateModel.cs
@@ -24,8 +24,9 @@ public AzureMethodTemplateModel(Method source, ServiceClient serviceClient)
}
ParameterTemplateModels.Clear();
+ LogicalParameterTemplateModels.Clear();
source.Parameters.ForEach(p => ParameterTemplateModels.Add(new AzureParameterTemplateModel(p)));
-
+ source.LogicalParameters.ForEach(p => LogicalParameterTemplateModels.Add(new AzureParameterTemplateModel(p)));
if (MethodGroupName != ServiceClient.Name)
{
MethodGroupName = MethodGroupName + "Operations";
@@ -188,9 +189,9 @@ public override string BuildUrl(string variableName)
private void AddQueryParametersToUri(string variableName, IndentedStringBuilder builder)
{
builder.AppendLine("List queryParameters = new List();");
- if (ParameterTemplateModels.Any(p => p.Location == ParameterLocation.Query))
+ if (LogicalParameters.Any(p => p.Location == ParameterLocation.Query))
{
- foreach (var queryParameter in ParameterTemplateModels
+ foreach (var queryParameter in LogicalParameters
.Where(p => p.Location == ParameterLocation.Query))
{
string queryParametersAddString =
@@ -225,7 +226,7 @@ queryParameter.Type is CompositeType &&
private void ReplacePathParametersInUri(string variableName, IndentedStringBuilder builder)
{
- foreach (var pathParameter in ParameterTemplateModels.Where(p => p.Location == ParameterLocation.Path))
+ foreach (var pathParameter in LogicalParameters.Where(p => p.Location == ParameterLocation.Path))
{
string replaceString = "{0} = {0}.Replace(\"{{{1}}}\", Uri.EscapeDataString({2}));";
if (pathParameter.Extensions.ContainsKey(AzureCodeGenerator.SkipUrlEncodingExtension))
diff --git a/AutoRest/Generators/CSharp/Azure.CSharp/Templates/AzureMethodTemplate.cshtml b/AutoRest/Generators/CSharp/Azure.CSharp/Templates/AzureMethodTemplate.cshtml
index 84d39305d5..58597cd8c3 100644
--- a/AutoRest/Generators/CSharp/Azure.CSharp/Templates/AzureMethodTemplate.cshtml
+++ b/AutoRest/Generators/CSharp/Azure.CSharp/Templates/AzureMethodTemplate.cshtml
@@ -15,17 +15,17 @@
}
else if (Model.HttpMethod == HttpMethod.Post || Model.HttpMethod == HttpMethod.Delete)
{
-@if (!String.IsNullOrEmpty(Model.Description) || !String.IsNullOrEmpty(Model.Summary))
+if (!String.IsNullOrEmpty(Model.Description) || !String.IsNullOrEmpty(Model.Summary))
{
@:///
@:@WrapComment("/// ", String.IsNullOrEmpty(Model.Summary) ? Model.Description.EscapeXmlComment() : Model.Summary.EscapeXmlComment())
@:///
}
-@if (!String.IsNullOrEmpty(Model.Description) && !String.IsNullOrEmpty(Model.Summary))
+if (!String.IsNullOrEmpty(Model.Description) && !String.IsNullOrEmpty(Model.Summary))
{
@:@WrapComment("/// ", Model.Description.EscapeXmlComment())
}
-@foreach (var parameter in Model.LocalParameters)
+foreach (var parameter in Model.LocalParameters)
{
@:///
@WrapComment("/// ", parameter.Documentation.EscapeXmlComment())@:
@@ -50,17 +50,17 @@ public async Task<@(Model.OperationResponseReturnTypeString)> @(Model.Name)WithH
}
else if (Model.HttpMethod == HttpMethod.Put || Model.HttpMethod == HttpMethod.Patch)
{
-@if (!String.IsNullOrEmpty(Model.Description) || !String.IsNullOrEmpty(Model.Summary))
+if (!String.IsNullOrEmpty(Model.Description) || !String.IsNullOrEmpty(Model.Summary))
{
@:///
@:@WrapComment("/// ", String.IsNullOrEmpty(Model.Summary) ? Model.Description.EscapeXmlComment() : Model.Summary.EscapeXmlComment())
@:///
}
-@if (!String.IsNullOrEmpty(Model.Description) && !String.IsNullOrEmpty(Model.Summary))
+if (!String.IsNullOrEmpty(Model.Description) && !String.IsNullOrEmpty(Model.Summary))
{
@:@WrapComment("/// ", Model.Description.EscapeXmlComment())
}
-@foreach (var parameter in Model.LocalParameters)
+foreach (var parameter in Model.LocalParameters)
{
@:///
@WrapComment("/// ", parameter.Documentation.EscapeXmlComment())@:
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyArray/Models/Error.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyArray/Models/Error.cs
index 0216155755..844444c7ee 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyArray/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyArray/Models/Error.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyArray.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyArray/Models/Product.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyArray/Models/Product.cs
index 8c1f5dd6b3..9a986becc5 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyArray/Models/Product.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyArray/Models/Product.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyArray.Models
///
public partial class Product
{
+ ///
+ /// Initializes a new instance of the Product class.
+ ///
+ public Product() { }
+
+ ///
+ /// Initializes a new instance of the Product class.
+ ///
+ public Product(int? integer = default(int?), string stringProperty = default(string))
+ {
+ Integer = integer;
+ StringProperty = stringProperty;
+ }
+
///
///
[JsonProperty(PropertyName = "integer")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyBoolean/Models/Error.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyBoolean/Models/Error.cs
index 231a8fe94d..d088ebd765 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyBoolean/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyBoolean/Models/Error.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyBoolean.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyByte/Models/Error.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyByte/Models/Error.cs
index 65bc11f27c..d676a278ea 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyByte/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyByte/Models/Error.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyByte.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/ArrayWrapper.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/ArrayWrapper.cs
index 33b59bb1d6..81d24b875c 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/ArrayWrapper.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/ArrayWrapper.cs
@@ -19,6 +19,19 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
///
public partial class ArrayWrapper
{
+ ///
+ /// Initializes a new instance of the ArrayWrapper class.
+ ///
+ public ArrayWrapper() { }
+
+ ///
+ /// Initializes a new instance of the ArrayWrapper class.
+ ///
+ public ArrayWrapper(IList array = default(IList))
+ {
+ Array = array;
+ }
+
///
///
[JsonProperty(PropertyName = "array")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Basic.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Basic.cs
index 106546e03b..031269a1ba 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Basic.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Basic.cs
@@ -19,6 +19,21 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
///
public partial class Basic
{
+ ///
+ /// Initializes a new instance of the Basic class.
+ ///
+ public Basic() { }
+
+ ///
+ /// Initializes a new instance of the Basic class.
+ ///
+ public Basic(int? id = default(int?), string name = default(string), string color = default(string))
+ {
+ Id = id;
+ Name = name;
+ Color = color;
+ }
+
///
///
[JsonProperty(PropertyName = "id")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/BooleanWrapper.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/BooleanWrapper.cs
index e49c5626c9..62bea6a911 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/BooleanWrapper.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/BooleanWrapper.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
///
public partial class BooleanWrapper
{
+ ///
+ /// Initializes a new instance of the BooleanWrapper class.
+ ///
+ public BooleanWrapper() { }
+
+ ///
+ /// Initializes a new instance of the BooleanWrapper class.
+ ///
+ public BooleanWrapper(bool? fieldTrue = default(bool?), bool? fieldFalse = default(bool?))
+ {
+ FieldTrue = fieldTrue;
+ FieldFalse = fieldFalse;
+ }
+
///
///
[JsonProperty(PropertyName = "field_true")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/ByteWrapper.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/ByteWrapper.cs
index a610bf887c..79c39b8b51 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/ByteWrapper.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/ByteWrapper.cs
@@ -19,6 +19,19 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
///
public partial class ByteWrapper
{
+ ///
+ /// Initializes a new instance of the ByteWrapper class.
+ ///
+ public ByteWrapper() { }
+
+ ///
+ /// Initializes a new instance of the ByteWrapper class.
+ ///
+ public ByteWrapper(byte[] field = default(byte[]))
+ {
+ Field = field;
+ }
+
///
///
[JsonProperty(PropertyName = "field")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Cat.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Cat.cs
index 7b64536b6d..98108a94ff 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Cat.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Cat.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
///
public partial class Cat : Pet
{
+ ///
+ /// Initializes a new instance of the Cat class.
+ ///
+ public Cat() { }
+
+ ///
+ /// Initializes a new instance of the Cat class.
+ ///
+ public Cat(string color = default(string), IList hates = default(IList))
+ {
+ Color = color;
+ Hates = hates;
+ }
+
///
///
[JsonProperty(PropertyName = "color")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/DateWrapper.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/DateWrapper.cs
index ec64e1ac83..48ceeb3eac 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/DateWrapper.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/DateWrapper.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
///
public partial class DateWrapper
{
+ ///
+ /// Initializes a new instance of the DateWrapper class.
+ ///
+ public DateWrapper() { }
+
+ ///
+ /// Initializes a new instance of the DateWrapper class.
+ ///
+ public DateWrapper(DateTime? field = default(DateTime?), DateTime? leap = default(DateTime?))
+ {
+ Field = field;
+ Leap = leap;
+ }
+
///
///
[JsonConverter(typeof(DateJsonConverter))]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/DatetimeWrapper.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/DatetimeWrapper.cs
index 9304757631..a789480650 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/DatetimeWrapper.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/DatetimeWrapper.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
///
public partial class DatetimeWrapper
{
+ ///
+ /// Initializes a new instance of the DatetimeWrapper class.
+ ///
+ public DatetimeWrapper() { }
+
+ ///
+ /// Initializes a new instance of the DatetimeWrapper class.
+ ///
+ public DatetimeWrapper(DateTime? field = default(DateTime?), DateTime? now = default(DateTime?))
+ {
+ Field = field;
+ Now = now;
+ }
+
///
///
[JsonProperty(PropertyName = "field")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Datetimerfc1123Wrapper.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Datetimerfc1123Wrapper.cs
index 983fba72f2..baabdae7ec 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Datetimerfc1123Wrapper.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Datetimerfc1123Wrapper.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
///
public partial class Datetimerfc1123Wrapper
{
+ ///
+ /// Initializes a new instance of the Datetimerfc1123Wrapper class.
+ ///
+ public Datetimerfc1123Wrapper() { }
+
+ ///
+ /// Initializes a new instance of the Datetimerfc1123Wrapper class.
+ ///
+ public Datetimerfc1123Wrapper(DateTime? field = default(DateTime?), DateTime? now = default(DateTime?))
+ {
+ Field = field;
+ Now = now;
+ }
+
///
///
[JsonConverter(typeof(DateTimeRfc1123JsonConverter))]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/DictionaryWrapper.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/DictionaryWrapper.cs
index f2b4214fa2..40fb3aeae6 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/DictionaryWrapper.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/DictionaryWrapper.cs
@@ -19,6 +19,19 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
///
public partial class DictionaryWrapper
{
+ ///
+ /// Initializes a new instance of the DictionaryWrapper class.
+ ///
+ public DictionaryWrapper() { }
+
+ ///
+ /// Initializes a new instance of the DictionaryWrapper class.
+ ///
+ public DictionaryWrapper(IDictionary defaultProgram = default(IDictionary))
+ {
+ DefaultProgram = defaultProgram;
+ }
+
///
///
[JsonProperty(PropertyName = "defaultProgram")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Dog.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Dog.cs
index 11a6534a15..6164034955 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Dog.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Dog.cs
@@ -19,6 +19,19 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
///
public partial class Dog : Pet
{
+ ///
+ /// Initializes a new instance of the Dog class.
+ ///
+ public Dog() { }
+
+ ///
+ /// Initializes a new instance of the Dog class.
+ ///
+ public Dog(string food = default(string))
+ {
+ Food = food;
+ }
+
///
///
[JsonProperty(PropertyName = "food")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/DoubleWrapper.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/DoubleWrapper.cs
index 009250d7df..86c91ce001 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/DoubleWrapper.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/DoubleWrapper.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
///
public partial class DoubleWrapper
{
+ ///
+ /// Initializes a new instance of the DoubleWrapper class.
+ ///
+ public DoubleWrapper() { }
+
+ ///
+ /// Initializes a new instance of the DoubleWrapper class.
+ ///
+ public DoubleWrapper(double? field1 = default(double?), double? field56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose = default(double?))
+ {
+ Field1 = field1;
+ Field56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose = field56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose;
+ }
+
///
///
[JsonProperty(PropertyName = "field1")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/DurationWrapper.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/DurationWrapper.cs
index 1025e13e71..c1e8b7b9f3 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/DurationWrapper.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/DurationWrapper.cs
@@ -19,6 +19,19 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
///
public partial class DurationWrapper
{
+ ///
+ /// Initializes a new instance of the DurationWrapper class.
+ ///
+ public DurationWrapper() { }
+
+ ///
+ /// Initializes a new instance of the DurationWrapper class.
+ ///
+ public DurationWrapper(TimeSpan? field = default(TimeSpan?))
+ {
+ Field = field;
+ }
+
///
///
[JsonProperty(PropertyName = "field")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Error.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Error.cs
index bb3816c818..aef7464d94 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Error.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Fish.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Fish.cs
index 3b69561c0a..400cad63b3 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Fish.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Fish.cs
@@ -20,6 +20,21 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
[JsonObject("fish")]
public partial class Fish
{
+ ///
+ /// Initializes a new instance of the Fish class.
+ ///
+ public Fish() { }
+
+ ///
+ /// Initializes a new instance of the Fish class.
+ ///
+ public Fish(double? length, string species = default(string), IList siblings = default(IList))
+ {
+ Species = species;
+ Length = length;
+ Siblings = siblings;
+ }
+
///
///
[JsonProperty(PropertyName = "species")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/FloatWrapper.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/FloatWrapper.cs
index b7964cf485..2307121ded 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/FloatWrapper.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/FloatWrapper.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
///
public partial class FloatWrapper
{
+ ///
+ /// Initializes a new instance of the FloatWrapper class.
+ ///
+ public FloatWrapper() { }
+
+ ///
+ /// Initializes a new instance of the FloatWrapper class.
+ ///
+ public FloatWrapper(double? field1 = default(double?), double? field2 = default(double?))
+ {
+ Field1 = field1;
+ Field2 = field2;
+ }
+
///
///
[JsonProperty(PropertyName = "field1")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/IntWrapper.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/IntWrapper.cs
index 150082700f..b19d31fd49 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/IntWrapper.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/IntWrapper.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
///
public partial class IntWrapper
{
+ ///
+ /// Initializes a new instance of the IntWrapper class.
+ ///
+ public IntWrapper() { }
+
+ ///
+ /// Initializes a new instance of the IntWrapper class.
+ ///
+ public IntWrapper(int? field1 = default(int?), int? field2 = default(int?))
+ {
+ Field1 = field1;
+ Field2 = field2;
+ }
+
///
///
[JsonProperty(PropertyName = "field1")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/LongWrapper.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/LongWrapper.cs
index 6de78a6917..3fe4304cb5 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/LongWrapper.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/LongWrapper.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
///
public partial class LongWrapper
{
+ ///
+ /// Initializes a new instance of the LongWrapper class.
+ ///
+ public LongWrapper() { }
+
+ ///
+ /// Initializes a new instance of the LongWrapper class.
+ ///
+ public LongWrapper(long? field1 = default(long?), long? field2 = default(long?))
+ {
+ Field1 = field1;
+ Field2 = field2;
+ }
+
///
///
[JsonProperty(PropertyName = "field1")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Pet.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Pet.cs
index a273e55f28..6b1fc19fb0 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Pet.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Pet.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
///
public partial class Pet
{
+ ///
+ /// Initializes a new instance of the Pet class.
+ ///
+ public Pet() { }
+
+ ///
+ /// Initializes a new instance of the Pet class.
+ ///
+ public Pet(int? id = default(int?), string name = default(string))
+ {
+ Id = id;
+ Name = name;
+ }
+
///
///
[JsonProperty(PropertyName = "id")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Salmon.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Salmon.cs
index 9ae9a896d0..7411588871 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Salmon.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Salmon.cs
@@ -20,6 +20,20 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
[JsonObject("salmon")]
public partial class Salmon : Fish
{
+ ///
+ /// Initializes a new instance of the Salmon class.
+ ///
+ public Salmon() { }
+
+ ///
+ /// Initializes a new instance of the Salmon class.
+ ///
+ public Salmon(string location = default(string), bool? iswild = default(bool?))
+ {
+ Location = location;
+ Iswild = iswild;
+ }
+
///
///
[JsonProperty(PropertyName = "location")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Sawshark.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Sawshark.cs
index 186c23904e..c030fe0f3e 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Sawshark.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Sawshark.cs
@@ -20,6 +20,19 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
[JsonObject("sawshark")]
public partial class Sawshark : Shark
{
+ ///
+ /// Initializes a new instance of the Sawshark class.
+ ///
+ public Sawshark() { }
+
+ ///
+ /// Initializes a new instance of the Sawshark class.
+ ///
+ public Sawshark(byte[] picture = default(byte[]))
+ {
+ Picture = picture;
+ }
+
///
///
[JsonProperty(PropertyName = "picture")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Shark.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Shark.cs
index aa7a232567..6f4715f67a 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Shark.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Shark.cs
@@ -20,6 +20,20 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
[JsonObject("shark")]
public partial class Shark : Fish
{
+ ///
+ /// Initializes a new instance of the Shark class.
+ ///
+ public Shark() { }
+
+ ///
+ /// Initializes a new instance of the Shark class.
+ ///
+ public Shark(DateTime? birthday, int? age = default(int?))
+ {
+ Age = age;
+ Birthday = birthday;
+ }
+
///
///
[JsonProperty(PropertyName = "age")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Siamese.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Siamese.cs
index 0b57aae2f7..915fa777c6 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Siamese.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/Siamese.cs
@@ -19,6 +19,19 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
///
public partial class Siamese : Cat
{
+ ///
+ /// Initializes a new instance of the Siamese class.
+ ///
+ public Siamese() { }
+
+ ///
+ /// Initializes a new instance of the Siamese class.
+ ///
+ public Siamese(string breed = default(string))
+ {
+ Breed = breed;
+ }
+
///
///
[JsonProperty(PropertyName = "breed")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/StringWrapper.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/StringWrapper.cs
index ff80b2f9fb..fae16938fc 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/StringWrapper.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/StringWrapper.cs
@@ -19,6 +19,21 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
///
public partial class StringWrapper
{
+ ///
+ /// Initializes a new instance of the StringWrapper class.
+ ///
+ public StringWrapper() { }
+
+ ///
+ /// Initializes a new instance of the StringWrapper class.
+ ///
+ public StringWrapper(string field = default(string), string empty = default(string), string nullProperty = default(string))
+ {
+ Field = field;
+ Empty = empty;
+ NullProperty = nullProperty;
+ }
+
///
///
[JsonProperty(PropertyName = "field")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDate/Models/Error.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDate/Models/Error.cs
index 68aeeb2ce6..333129dd29 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDate/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDate/Models/Error.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyDate.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDateTime/Models/Error.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDateTime/Models/Error.cs
index 075f4ebfa8..5fe0a379a8 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDateTime/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDateTime/Models/Error.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyDateTime.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/Models/Error.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/Models/Error.cs
index 1b7b34fde2..4f65e9faac 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/Models/Error.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyDateTimeRfc1123.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDictionary/Models/Error.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDictionary/Models/Error.cs
index 33c056bcbc..4563e83202 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDictionary/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDictionary/Models/Error.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyDictionary.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDictionary/Models/Widget.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDictionary/Models/Widget.cs
index 0763c5428f..f5ffda7b40 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDictionary/Models/Widget.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDictionary/Models/Widget.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyDictionary.Models
///
public partial class Widget
{
+ ///
+ /// Initializes a new instance of the Widget class.
+ ///
+ public Widget() { }
+
+ ///
+ /// Initializes a new instance of the Widget class.
+ ///
+ public Widget(int? integer = default(int?), string stringProperty = default(string))
+ {
+ Integer = integer;
+ StringProperty = stringProperty;
+ }
+
///
///
[JsonProperty(PropertyName = "integer")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDuration/Models/Error.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDuration/Models/Error.cs
index 0cb08ae893..699e87d553 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDuration/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyDuration/Models/Error.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyDuration.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyFile/Models/Error.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyFile/Models/Error.cs
index d74b96358a..e657e2d153 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyFile/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyFile/Models/Error.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyFile.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyInteger/Models/Error.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyInteger/Models/Error.cs
index 6a1f40daa4..55a155aa84 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyInteger/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyInteger/Models/Error.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyInteger.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyNumber/Models/Error.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyNumber/Models/Error.cs
index d51ae91f5f..e7648fc466 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyNumber/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyNumber/Models/Error.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyNumber.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyString/Models/Error.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyString/Models/Error.cs
index 6e4ffece26..561e45dde5 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyString/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/BodyString/Models/Error.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsBodyString.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Header/Models/Error.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Header/Models/Error.cs
index e2e134e724..a8a42afbe3 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Header/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Header/Models/Error.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsHeader.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Http/Models/A.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Http/Models/A.cs
index 537107d771..a94fb16c00 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Http/Models/A.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Http/Models/A.cs
@@ -19,6 +19,19 @@ namespace Fixtures.AcceptanceTestsHttp.Models
///
public partial class A
{
+ ///
+ /// Initializes a new instance of the A class.
+ ///
+ public A() { }
+
+ ///
+ /// Initializes a new instance of the A class.
+ ///
+ public A(string statusCode = default(string))
+ {
+ StatusCode = statusCode;
+ }
+
///
///
[JsonProperty(PropertyName = "statusCode")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Http/Models/B.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Http/Models/B.cs
index 27d132b930..b2ddad26dd 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Http/Models/B.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Http/Models/B.cs
@@ -19,6 +19,19 @@ namespace Fixtures.AcceptanceTestsHttp.Models
///
public partial class B : A
{
+ ///
+ /// Initializes a new instance of the B class.
+ ///
+ public B() { }
+
+ ///
+ /// Initializes a new instance of the B class.
+ ///
+ public B(string textStatusCode = default(string))
+ {
+ TextStatusCode = textStatusCode;
+ }
+
///
///
[JsonProperty(PropertyName = "textStatusCode")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Http/Models/C.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Http/Models/C.cs
index 1ba29d2c72..add174fb75 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Http/Models/C.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Http/Models/C.cs
@@ -19,6 +19,19 @@ namespace Fixtures.AcceptanceTestsHttp.Models
///
public partial class C
{
+ ///
+ /// Initializes a new instance of the C class.
+ ///
+ public C() { }
+
+ ///
+ /// Initializes a new instance of the C class.
+ ///
+ public C(string httpCode = default(string))
+ {
+ HttpCode = httpCode;
+ }
+
///
///
[JsonProperty(PropertyName = "httpCode")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Http/Models/D.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Http/Models/D.cs
index 74d90c53f1..69e7f2cc4e 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Http/Models/D.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Http/Models/D.cs
@@ -19,6 +19,19 @@ namespace Fixtures.AcceptanceTestsHttp.Models
///
public partial class D
{
+ ///
+ /// Initializes a new instance of the D class.
+ ///
+ public D() { }
+
+ ///
+ /// Initializes a new instance of the D class.
+ ///
+ public D(string httpStatusCode = default(string))
+ {
+ HttpStatusCode = httpStatusCode;
+ }
+
///
///
[JsonProperty(PropertyName = "httpStatusCode")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Http/Models/Error.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Http/Models/Error.cs
index 7bf7092854..f1171c4e11 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Http/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Http/Models/Error.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsHttp.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Report/Models/Error.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Report/Models/Error.cs
index acc8e6a4fb..4a867f019f 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Report/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Report/Models/Error.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsReport.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/ArrayOptionalWrapper.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/ArrayOptionalWrapper.cs
index ce71b42458..1adde5b617 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/ArrayOptionalWrapper.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/ArrayOptionalWrapper.cs
@@ -19,6 +19,19 @@ namespace Fixtures.AcceptanceTestsRequiredOptional.Models
///
public partial class ArrayOptionalWrapper
{
+ ///
+ /// Initializes a new instance of the ArrayOptionalWrapper class.
+ ///
+ public ArrayOptionalWrapper() { }
+
+ ///
+ /// Initializes a new instance of the ArrayOptionalWrapper class.
+ ///
+ public ArrayOptionalWrapper(IList value = default(IList))
+ {
+ Value = value;
+ }
+
///
///
[JsonProperty(PropertyName = "value")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/ArrayWrapper.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/ArrayWrapper.cs
index 6572c3c3c0..908f13b951 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/ArrayWrapper.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/ArrayWrapper.cs
@@ -19,6 +19,19 @@ namespace Fixtures.AcceptanceTestsRequiredOptional.Models
///
public partial class ArrayWrapper
{
+ ///
+ /// Initializes a new instance of the ArrayWrapper class.
+ ///
+ public ArrayWrapper() { }
+
+ ///
+ /// Initializes a new instance of the ArrayWrapper class.
+ ///
+ public ArrayWrapper(IList value)
+ {
+ Value = value;
+ }
+
///
///
[JsonProperty(PropertyName = "value")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/ClassOptionalWrapper.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/ClassOptionalWrapper.cs
index a86bd67d09..85831e1669 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/ClassOptionalWrapper.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/ClassOptionalWrapper.cs
@@ -19,6 +19,19 @@ namespace Fixtures.AcceptanceTestsRequiredOptional.Models
///
public partial class ClassOptionalWrapper
{
+ ///
+ /// Initializes a new instance of the ClassOptionalWrapper class.
+ ///
+ public ClassOptionalWrapper() { }
+
+ ///
+ /// Initializes a new instance of the ClassOptionalWrapper class.
+ ///
+ public ClassOptionalWrapper(Product value = default(Product))
+ {
+ Value = value;
+ }
+
///
///
[JsonProperty(PropertyName = "value")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/ClassWrapper.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/ClassWrapper.cs
index 2c9587a402..0f67623777 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/ClassWrapper.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/ClassWrapper.cs
@@ -19,6 +19,19 @@ namespace Fixtures.AcceptanceTestsRequiredOptional.Models
///
public partial class ClassWrapper
{
+ ///
+ /// Initializes a new instance of the ClassWrapper class.
+ ///
+ public ClassWrapper() { }
+
+ ///
+ /// Initializes a new instance of the ClassWrapper class.
+ ///
+ public ClassWrapper(Product value)
+ {
+ Value = value;
+ }
+
///
///
[JsonProperty(PropertyName = "value")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/Error.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/Error.cs
index f1b4755e36..e488268ceb 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/Error.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsRequiredOptional.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/IntOptionalWrapper.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/IntOptionalWrapper.cs
index fdef8a6b7a..b3f28bcd0a 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/IntOptionalWrapper.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/IntOptionalWrapper.cs
@@ -19,6 +19,19 @@ namespace Fixtures.AcceptanceTestsRequiredOptional.Models
///
public partial class IntOptionalWrapper
{
+ ///
+ /// Initializes a new instance of the IntOptionalWrapper class.
+ ///
+ public IntOptionalWrapper() { }
+
+ ///
+ /// Initializes a new instance of the IntOptionalWrapper class.
+ ///
+ public IntOptionalWrapper(int? value = default(int?))
+ {
+ Value = value;
+ }
+
///
///
[JsonProperty(PropertyName = "value")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/IntWrapper.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/IntWrapper.cs
index 98c53fdb40..9262aa5487 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/IntWrapper.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/IntWrapper.cs
@@ -19,6 +19,19 @@ namespace Fixtures.AcceptanceTestsRequiredOptional.Models
///
public partial class IntWrapper
{
+ ///
+ /// Initializes a new instance of the IntWrapper class.
+ ///
+ public IntWrapper() { }
+
+ ///
+ /// Initializes a new instance of the IntWrapper class.
+ ///
+ public IntWrapper(int? value)
+ {
+ Value = value;
+ }
+
///
///
[JsonProperty(PropertyName = "value")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/Product.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/Product.cs
index 5cbbcb32f7..45f6ad6466 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/Product.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/Product.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsRequiredOptional.Models
///
public partial class Product
{
+ ///
+ /// Initializes a new instance of the Product class.
+ ///
+ public Product() { }
+
+ ///
+ /// Initializes a new instance of the Product class.
+ ///
+ public Product(int? id, string name = default(string))
+ {
+ Id = id;
+ Name = name;
+ }
+
///
///
[JsonProperty(PropertyName = "id")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/StringOptionalWrapper.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/StringOptionalWrapper.cs
index 5771a913bd..6ea97b8e92 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/StringOptionalWrapper.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/StringOptionalWrapper.cs
@@ -19,6 +19,19 @@ namespace Fixtures.AcceptanceTestsRequiredOptional.Models
///
public partial class StringOptionalWrapper
{
+ ///
+ /// Initializes a new instance of the StringOptionalWrapper class.
+ ///
+ public StringOptionalWrapper() { }
+
+ ///
+ /// Initializes a new instance of the StringOptionalWrapper class.
+ ///
+ public StringOptionalWrapper(string value = default(string))
+ {
+ Value = value;
+ }
+
///
///
[JsonProperty(PropertyName = "value")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/StringWrapper.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/StringWrapper.cs
index 8545c59791..1d42e6456e 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/StringWrapper.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/RequiredOptional/Models/StringWrapper.cs
@@ -19,6 +19,19 @@ namespace Fixtures.AcceptanceTestsRequiredOptional.Models
///
public partial class StringWrapper
{
+ ///
+ /// Initializes a new instance of the StringWrapper class.
+ ///
+ public StringWrapper() { }
+
+ ///
+ /// Initializes a new instance of the StringWrapper class.
+ ///
+ public StringWrapper(string value)
+ {
+ Value = value;
+ }
+
///
///
[JsonProperty(PropertyName = "value")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Url/Models/Error.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Url/Models/Error.cs
index 937255f6b5..b1811e5e96 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Url/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Url/Models/Error.cs
@@ -19,6 +19,20 @@ namespace Fixtures.AcceptanceTestsUrl.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? status = default(int?), string message = default(string))
+ {
+ Status = status;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "status")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Url/PathItems.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Url/PathItems.cs
index f83c492532..bb5753e902 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Url/PathItems.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Url/PathItems.cs
@@ -95,8 +95,8 @@ public PathItems(AutoRestUrlTestService client)
invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("localStringPath", localStringPath);
- tracingParameters.Add("pathItemStringPath", pathItemStringPath);
tracingParameters.Add("localStringQuery", localStringQuery);
+ tracingParameters.Add("pathItemStringPath", pathItemStringPath);
tracingParameters.Add("pathItemStringQuery", pathItemStringQuery);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(invocationId, this, "GetAllWithValues", tracingParameters);
@@ -229,8 +229,8 @@ public PathItems(AutoRestUrlTestService client)
invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("localStringPath", localStringPath);
- tracingParameters.Add("pathItemStringPath", pathItemStringPath);
tracingParameters.Add("localStringQuery", localStringQuery);
+ tracingParameters.Add("pathItemStringPath", pathItemStringPath);
tracingParameters.Add("pathItemStringQuery", pathItemStringQuery);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(invocationId, this, "GetGlobalQueryNull", tracingParameters);
@@ -362,8 +362,8 @@ public PathItems(AutoRestUrlTestService client)
invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("localStringPath", localStringPath);
- tracingParameters.Add("pathItemStringPath", pathItemStringPath);
tracingParameters.Add("localStringQuery", localStringQuery);
+ tracingParameters.Add("pathItemStringPath", pathItemStringPath);
tracingParameters.Add("pathItemStringQuery", pathItemStringQuery);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(invocationId, this, "GetGlobalAndLocalQueryNull", tracingParameters);
@@ -495,8 +495,8 @@ public PathItems(AutoRestUrlTestService client)
invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("localStringPath", localStringPath);
- tracingParameters.Add("pathItemStringPath", pathItemStringPath);
tracingParameters.Add("localStringQuery", localStringQuery);
+ tracingParameters.Add("pathItemStringPath", pathItemStringPath);
tracingParameters.Add("pathItemStringQuery", pathItemStringQuery);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(invocationId, this, "GetLocalPathItemQueryNull", tracingParameters);
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Validation/Models/Error.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Validation/Models/Error.cs
index 952c875cb8..4a92055606 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Validation/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Validation/Models/Error.cs
@@ -19,6 +19,21 @@ namespace Fixtures.AcceptanceTestsValidation.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? code = default(int?), string message = default(string), string fields = default(string))
+ {
+ Code = code;
+ Message = message;
+ Fields = fields;
+ }
+
///
///
[JsonProperty(PropertyName = "code")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Validation/Models/Product.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Validation/Models/Product.cs
index c12a3a020b..2bdebaf9d1 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Validation/Models/Product.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/AcceptanceTests/Validation/Models/Product.cs
@@ -20,6 +20,21 @@ namespace Fixtures.AcceptanceTestsValidation.Models
///
public partial class Product
{
+ ///
+ /// Initializes a new instance of the Product class.
+ ///
+ public Product() { }
+
+ ///
+ /// Initializes a new instance of the Product class.
+ ///
+ public Product(IList displayNames = default(IList), int? capacity = default(int?), string image = default(string))
+ {
+ DisplayNames = displayNames;
+ Capacity = capacity;
+ Image = image;
+ }
+
///
/// Non required array of unique items from 0 to 6 elements.
///
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/Animal.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/Animal.cs
index 3659ca184f..286ec90a53 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/Animal.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/Animal.cs
@@ -19,6 +19,20 @@ namespace Fixtures.MirrorPolymorphic.Models
///
public partial class Animal
{
+ ///
+ /// Initializes a new instance of the Animal class.
+ ///
+ public Animal() { }
+
+ ///
+ /// Initializes a new instance of the Animal class.
+ ///
+ public Animal(string id = default(string), string description = default(string))
+ {
+ Id = id;
+ Description = description;
+ }
+
///
/// Id.
///
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/BaseCat.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/BaseCat.cs
index eb11b6652a..fdb5c67925 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/BaseCat.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/BaseCat.cs
@@ -19,6 +19,19 @@ namespace Fixtures.MirrorPolymorphic.Models
///
public partial class BaseCat : Animal
{
+ ///
+ /// Initializes a new instance of the BaseCat class.
+ ///
+ public BaseCat() { }
+
+ ///
+ /// Initializes a new instance of the BaseCat class.
+ ///
+ public BaseCat(string color = default(string))
+ {
+ Color = color;
+ }
+
///
/// cat color
///
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/BurmeseCat.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/BurmeseCat.cs
index 0663561d6e..42e97f9d02 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/BurmeseCat.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/BurmeseCat.cs
@@ -19,6 +19,19 @@ namespace Fixtures.MirrorPolymorphic.Models
///
public partial class BurmeseCat : SiameseCat
{
+ ///
+ /// Initializes a new instance of the BurmeseCat class.
+ ///
+ public BurmeseCat() { }
+
+ ///
+ /// Initializes a new instance of the BurmeseCat class.
+ ///
+ public BurmeseCat(int? nickName = default(int?))
+ {
+ NickName = nickName;
+ }
+
///
/// cat nick name
///
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/Doggy.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/Doggy.cs
index 1cd758eea9..906aae239b 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/Doggy.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/Doggy.cs
@@ -19,6 +19,19 @@ namespace Fixtures.MirrorPolymorphic.Models
///
public partial class Doggy : Animal
{
+ ///
+ /// Initializes a new instance of the Doggy class.
+ ///
+ public Doggy() { }
+
+ ///
+ /// Initializes a new instance of the Doggy class.
+ ///
+ public Doggy(string name = default(string))
+ {
+ Name = name;
+ }
+
///
/// dog name
///
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/Error2.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/Error2.cs
index 2b09fcdd16..be1fe7ca07 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/Error2.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/Error2.cs
@@ -19,6 +19,21 @@ namespace Fixtures.MirrorPolymorphic.Models
///
public partial class Error2
{
+ ///
+ /// Initializes a new instance of the Error2 class.
+ ///
+ public Error2() { }
+
+ ///
+ /// Initializes a new instance of the Error2 class.
+ ///
+ public Error2(int? code = default(int?), string message = default(string), string fields = default(string))
+ {
+ Code = code;
+ Message = message;
+ Fields = fields;
+ }
+
///
///
[JsonProperty(PropertyName = "code")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/HimalayanCat.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/HimalayanCat.cs
index f074671a57..793cd3c4a2 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/HimalayanCat.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/HimalayanCat.cs
@@ -19,6 +19,19 @@ namespace Fixtures.MirrorPolymorphic.Models
///
public partial class HimalayanCat : SiameseCat
{
+ ///
+ /// Initializes a new instance of the HimalayanCat class.
+ ///
+ public HimalayanCat() { }
+
+ ///
+ /// Initializes a new instance of the HimalayanCat class.
+ ///
+ public HimalayanCat(int? hairLength = default(int?))
+ {
+ HairLength = hairLength;
+ }
+
///
/// cat hair length
///
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/Horsey.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/Horsey.cs
index 49608a1ba7..0e8e277641 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/Horsey.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/Horsey.cs
@@ -19,6 +19,19 @@ namespace Fixtures.MirrorPolymorphic.Models
///
public partial class Horsey : Animal
{
+ ///
+ /// Initializes a new instance of the Horsey class.
+ ///
+ public Horsey() { }
+
+ ///
+ /// Initializes a new instance of the Horsey class.
+ ///
+ public Horsey(string breed = default(string))
+ {
+ Breed = breed;
+ }
+
///
/// horse breed
///
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/PersianCat.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/PersianCat.cs
index 6689db008e..3a5de946ba 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/PersianCat.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/PersianCat.cs
@@ -19,6 +19,19 @@ namespace Fixtures.MirrorPolymorphic.Models
///
public partial class PersianCat : BaseCat
{
+ ///
+ /// Initializes a new instance of the PersianCat class.
+ ///
+ public PersianCat() { }
+
+ ///
+ /// Initializes a new instance of the PersianCat class.
+ ///
+ public PersianCat(int? size = default(int?))
+ {
+ Size = size;
+ }
+
///
/// cat size
///
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/SiameseCat.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/SiameseCat.cs
index 81c7e5d6b7..7f55d8754a 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/SiameseCat.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Polymorphic/Models/SiameseCat.cs
@@ -19,6 +19,19 @@ namespace Fixtures.MirrorPolymorphic.Models
///
public partial class SiameseCat : BaseCat
{
+ ///
+ /// Initializes a new instance of the SiameseCat class.
+ ///
+ public SiameseCat() { }
+
+ ///
+ /// Initializes a new instance of the SiameseCat class.
+ ///
+ public SiameseCat(int? length = default(int?))
+ {
+ Length = length;
+ }
+
///
/// cat length
///
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Primitives/Models/Error.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Primitives/Models/Error.cs
index 58d188e342..56a8ca9921 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Primitives/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Primitives/Models/Error.cs
@@ -19,6 +19,21 @@ namespace Fixtures.MirrorPrimitives.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? code = default(int?), string message = default(string), string fields = default(string))
+ {
+ Code = code;
+ Message = message;
+ Fields = fields;
+ }
+
///
///
[JsonProperty(PropertyName = "code")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Primitives/Models/Product.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Primitives/Models/Product.cs
index 2f92053d2a..aa50ca24b6 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Primitives/Models/Product.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Primitives/Models/Product.cs
@@ -19,6 +19,41 @@ namespace Fixtures.MirrorPrimitives.Models
///
public partial class Product
{
+ ///
+ /// Initializes a new instance of the Product class.
+ ///
+ public Product() { }
+
+ ///
+ /// Initializes a new instance of the Product class.
+ ///
+ public Product(int? integer = default(int?), int? intProperty = default(int?), long? longProperty = default(long?), double? number = default(double?), double? floatProperty = default(double?), double? doubleProperty = default(double?), byte[] byteProperty = default(byte[]), string stringProperty = default(string), string enumProperty = default(string), bool? boolean = default(bool?), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), IList integerArray = default(IList), IList intArray = default(IList), IList longArray = default(IList), IList numberArray = default(IList), IList floatArray = default(IList), IList doubleArray = default(IList), IList byteArray = default(IList), IList booleanArray = default(IList), IList stringArray = default(IList), IList dateArray = default(IList), IList dateTimeArray = default(IList))
+ {
+ Integer = integer;
+ IntProperty = intProperty;
+ LongProperty = longProperty;
+ Number = number;
+ FloatProperty = floatProperty;
+ DoubleProperty = doubleProperty;
+ ByteProperty = byteProperty;
+ StringProperty = stringProperty;
+ EnumProperty = enumProperty;
+ Boolean = boolean;
+ Date = date;
+ DateTime = dateTime;
+ IntegerArray = integerArray;
+ IntArray = intArray;
+ LongArray = longArray;
+ NumberArray = numberArray;
+ FloatArray = floatArray;
+ DoubleArray = doubleArray;
+ ByteArray = byteArray;
+ BooleanArray = booleanArray;
+ StringArray = stringArray;
+ DateArray = dateArray;
+ DateTimeArray = dateTimeArray;
+ }
+
///
///
[JsonProperty(PropertyName = "integer")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.RecursiveTypes/Models/Error.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.RecursiveTypes/Models/Error.cs
index 9eccf8ed07..2333e6285d 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.RecursiveTypes/Models/Error.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.RecursiveTypes/Models/Error.cs
@@ -19,6 +19,21 @@ namespace Fixtures.MirrorRecursiveTypes.Models
///
public partial class Error
{
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error() { }
+
+ ///
+ /// Initializes a new instance of the Error class.
+ ///
+ public Error(int? code = default(int?), string message = default(string), string fields = default(string))
+ {
+ Code = code;
+ Message = message;
+ Fields = fields;
+ }
+
///
///
[JsonProperty(PropertyName = "code")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.RecursiveTypes/Models/Product.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.RecursiveTypes/Models/Product.cs
index 74581588ce..d83d58fe8c 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.RecursiveTypes/Models/Product.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.RecursiveTypes/Models/Product.cs
@@ -19,6 +19,21 @@ namespace Fixtures.MirrorRecursiveTypes.Models
///
public partial class Product
{
+ ///
+ /// Initializes a new instance of the Product class.
+ ///
+ public Product() { }
+
+ ///
+ /// Initializes a new instance of the Product class.
+ ///
+ public Product(string productId = default(string), Product parentProduct = default(Product), IList innerProducts = default(IList))
+ {
+ ProductId = productId;
+ ParentProduct = parentProduct;
+ InnerProducts = innerProducts;
+ }
+
///
/// Unique identifier representing a specific product for a given
/// latitude & longitude. For example, uberX in San Francisco
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Sequences/Models/ErrorModel.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Sequences/Models/ErrorModel.cs
index 421956930a..2533022866 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Sequences/Models/ErrorModel.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Sequences/Models/ErrorModel.cs
@@ -19,6 +19,20 @@ namespace Fixtures.MirrorSequences.Models
///
public partial class ErrorModel
{
+ ///
+ /// Initializes a new instance of the ErrorModel class.
+ ///
+ public ErrorModel() { }
+
+ ///
+ /// Initializes a new instance of the ErrorModel class.
+ ///
+ public ErrorModel(int? code, string message)
+ {
+ Code = code;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "code")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Sequences/Models/Pet.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Sequences/Models/Pet.cs
index 7eb4e2f858..ebd462c44f 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Sequences/Models/Pet.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Sequences/Models/Pet.cs
@@ -19,6 +19,22 @@ namespace Fixtures.MirrorSequences.Models
///
public partial class Pet
{
+ ///
+ /// Initializes a new instance of the Pet class.
+ ///
+ public Pet() { }
+
+ ///
+ /// Initializes a new instance of the Pet class.
+ ///
+ public Pet(long? id, string name, IList styles = default(IList), string tag = default(string))
+ {
+ Id = id;
+ Name = name;
+ Styles = styles;
+ Tag = tag;
+ }
+
///
///
[JsonProperty(PropertyName = "id")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Sequences/Models/PetStyle.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Sequences/Models/PetStyle.cs
index 6476b3ce08..498b8dd882 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Sequences/Models/PetStyle.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Mirror.Sequences/Models/PetStyle.cs
@@ -19,6 +19,19 @@ namespace Fixtures.MirrorSequences.Models
///
public partial class PetStyle
{
+ ///
+ /// Initializes a new instance of the PetStyle class.
+ ///
+ public PetStyle() { }
+
+ ///
+ /// Initializes a new instance of the PetStyle class.
+ ///
+ public PetStyle(string name)
+ {
+ Name = name;
+ }
+
///
///
[JsonProperty(PropertyName = "name")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/ApiResponse.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/ApiResponse.cs
index f09687642c..a56b16920d 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/ApiResponse.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/ApiResponse.cs
@@ -19,6 +19,21 @@ namespace Fixtures.PetstoreV2.Models
///
public partial class ApiResponse
{
+ ///
+ /// Initializes a new instance of the ApiResponse class.
+ ///
+ public ApiResponse() { }
+
+ ///
+ /// Initializes a new instance of the ApiResponse class.
+ ///
+ public ApiResponse(int? code = default(int?), string type = default(string), string message = default(string))
+ {
+ Code = code;
+ Type = type;
+ Message = message;
+ }
+
///
///
[JsonProperty(PropertyName = "code")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/Category.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/Category.cs
index b99b0ae559..3b3c565ef2 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/Category.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/Category.cs
@@ -19,6 +19,20 @@ namespace Fixtures.PetstoreV2.Models
///
public partial class Category
{
+ ///
+ /// Initializes a new instance of the Category class.
+ ///
+ public Category() { }
+
+ ///
+ /// Initializes a new instance of the Category class.
+ ///
+ public Category(long? id = default(long?), string name = default(string))
+ {
+ Id = id;
+ Name = name;
+ }
+
///
///
[JsonProperty(PropertyName = "id")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/Order.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/Order.cs
index 7ae660d61a..2f3bebac85 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/Order.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/Order.cs
@@ -19,6 +19,24 @@ namespace Fixtures.PetstoreV2.Models
///
public partial class Order
{
+ ///
+ /// Initializes a new instance of the Order class.
+ ///
+ public Order() { }
+
+ ///
+ /// Initializes a new instance of the Order class.
+ ///
+ public Order(long? id = default(long?), long? petId = default(long?), int? quantity = default(int?), DateTime? shipDate = default(DateTime?), string status = default(string), bool? complete = default(bool?))
+ {
+ Id = id;
+ PetId = petId;
+ Quantity = quantity;
+ ShipDate = shipDate;
+ Status = status;
+ Complete = complete;
+ }
+
///
///
[JsonProperty(PropertyName = "id")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/Pet.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/Pet.cs
index 828a528d68..e8e4c500f7 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/Pet.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/Pet.cs
@@ -19,6 +19,27 @@ namespace Fixtures.PetstoreV2.Models
///
public partial class Pet
{
+ ///
+ /// Initializes a new instance of the Pet class.
+ ///
+ public Pet() { }
+
+ ///
+ /// Initializes a new instance of the Pet class.
+ ///
+ public Pet(string name, IList photoUrls, long? id = default(long?), Category category = default(Category), IList tags = default(IList), byte[] sByteProperty = default(byte[]), DateTime? birthday = default(DateTime?), IDictionary dictionary = default(IDictionary), string status = default(string))
+ {
+ Id = id;
+ Category = category;
+ Name = name;
+ PhotoUrls = photoUrls;
+ Tags = tags;
+ SByteProperty = sByteProperty;
+ Birthday = birthday;
+ Dictionary = dictionary;
+ Status = status;
+ }
+
///
///
[JsonProperty(PropertyName = "id")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/Tag.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/Tag.cs
index 018f460059..0142ae6bcb 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/Tag.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/Tag.cs
@@ -19,6 +19,20 @@ namespace Fixtures.PetstoreV2.Models
///
public partial class Tag
{
+ ///
+ /// Initializes a new instance of the Tag class.
+ ///
+ public Tag() { }
+
+ ///
+ /// Initializes a new instance of the Tag class.
+ ///
+ public Tag(long? id = default(long?), string name = default(string))
+ {
+ Id = id;
+ Name = name;
+ }
+
///
///
[JsonProperty(PropertyName = "id")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/User.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/User.cs
index 010af18894..aff76f0c5c 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/User.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/Models/User.cs
@@ -19,6 +19,26 @@ namespace Fixtures.PetstoreV2.Models
///
public partial class User
{
+ ///
+ /// Initializes a new instance of the User class.
+ ///
+ public User() { }
+
+ ///
+ /// Initializes a new instance of the User class.
+ ///
+ public User(long? id = default(long?), string username = default(string), string firstName = default(string), string lastName = default(string), string email = default(string), string password = default(string), string phone = default(string), int? userStatus = default(int?))
+ {
+ Id = id;
+ Username = username;
+ FirstName = firstName;
+ LastName = lastName;
+ Email = email;
+ Password = password;
+ Phone = phone;
+ UserStatus = userStatus;
+ }
+
///
///
[JsonProperty(PropertyName = "id")]
diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/SwaggerPetstoreV2.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/SwaggerPetstoreV2.cs
index 15d109544e..bd96d4e7a4 100644
--- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/SwaggerPetstoreV2.cs
+++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2/SwaggerPetstoreV2.cs
@@ -734,8 +734,8 @@ private void Initialize()
{
invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("petId", petId);
tracingParameters.Add("apiKey", apiKey);
+ tracingParameters.Add("petId", petId);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(invocationId, this, "DeletePet", tracingParameters);
}
diff --git a/AutoRest/Generators/CSharp/CSharp/AutoRest.Generator.CSharp.csproj b/AutoRest/Generators/CSharp/CSharp/AutoRest.Generator.CSharp.csproj
index c17b586df5..3a4ffe28f7 100644
--- a/AutoRest/Generators/CSharp/CSharp/AutoRest.Generator.CSharp.csproj
+++ b/AutoRest/Generators/CSharp/CSharp/AutoRest.Generator.CSharp.csproj
@@ -102,4 +102,4 @@
-
+
\ No newline at end of file
diff --git a/AutoRest/Generators/CSharp/CSharp/GlobalSuppressions.cs b/AutoRest/Generators/CSharp/CSharp/GlobalSuppressions.cs
index 73d0d0cc35..c8a0df44f0 100644
--- a/AutoRest/Generators/CSharp/CSharp/GlobalSuppressions.cs
+++ b/AutoRest/Generators/CSharp/CSharp/GlobalSuppressions.cs
@@ -66,4 +66,6 @@
Target = "Microsoft.Rest.Generator.CSharp.TemplateModels.ClientModelExtensions.#AppendConstraintValidations(System.String,System.Collections.Generic.Dictionary`2,Microsoft.Rest.Generator.Utilities.IndentedStringBuilder)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "Microsoft.Rest.Generator.CSharp.MethodTemplateModel.#.ctor(Microsoft.Rest.Generator.ClientModel.Method,Microsoft.Rest.Generator.ClientModel.ServiceClient)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "1", Scope = "member", Target = "Microsoft.Rest.Generator.CSharp.MethodTemplateModel.#.ctor(Microsoft.Rest.Generator.ClientModel.Method,Microsoft.Rest.Generator.ClientModel.ServiceClient)")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "Microsoft.Rest.Generator.CSharp.ModelTemplateModel.#.ctor(Microsoft.Rest.Generator.ClientModel.CompositeType)")]
\ No newline at end of file
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "Microsoft.Rest.Generator.CSharp.ModelTemplateModel.#.ctor(Microsoft.Rest.Generator.ClientModel.CompositeType)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Scope = "member", Target = "Microsoft.Rest.Generator.CSharp.MethodTemplateModel.#GroupedParameterTemplateModels")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Scope = "member", Target = "Microsoft.Rest.Generator.CSharp.MethodTemplateModel.#LogicalParameterTemplateModels")]
diff --git a/AutoRest/Generators/CSharp/CSharp/TemplateModels/MethodGroupTemplateModel.cs b/AutoRest/Generators/CSharp/CSharp/TemplateModels/MethodGroupTemplateModel.cs
index e8328933b1..8890afc5f6 100644
--- a/AutoRest/Generators/CSharp/CSharp/TemplateModels/MethodGroupTemplateModel.cs
+++ b/AutoRest/Generators/CSharp/CSharp/TemplateModels/MethodGroupTemplateModel.cs
@@ -32,7 +32,7 @@ public virtual IEnumerable Usings
{
get
{
- if (this.ModelTypes.Any())
+ if (this.ModelTypes.Any() || this.MethodGroups.Any())
{
yield return "Models";
}
diff --git a/AutoRest/Generators/CSharp/CSharp/TemplateModels/MethodTemplateModel.cs b/AutoRest/Generators/CSharp/CSharp/TemplateModels/MethodTemplateModel.cs
index 69a8035332..1aa75fdf58 100644
--- a/AutoRest/Generators/CSharp/CSharp/TemplateModels/MethodTemplateModel.cs
+++ b/AutoRest/Generators/CSharp/CSharp/TemplateModels/MethodTemplateModel.cs
@@ -19,7 +19,9 @@ public MethodTemplateModel(Method source, ServiceClient serviceClient)
{
this.LoadFrom(source);
ParameterTemplateModels = new List();
+ LogicalParameterTemplateModels = new List();
source.Parameters.ForEach(p => ParameterTemplateModels.Add(new ParameterTemplateModel(p)));
+ source.LogicalParameters.ForEach(p => LogicalParameterTemplateModels.Add(new ParameterTemplateModel(p)));
ServiceClient = serviceClient;
MethodGroupName = source.Group ?? serviceClient.Name;
}
@@ -28,7 +30,9 @@ public MethodTemplateModel(Method source, ServiceClient serviceClient)
public ServiceClient ServiceClient { get; set; }
- public List ParameterTemplateModels { get; private set; }
+ protected List ParameterTemplateModels { get; private set; }
+
+ public List LogicalParameterTemplateModels { get; private set; }
public IScopeProvider Scope
{
@@ -65,7 +69,7 @@ public string SyncMethodParameterDeclaration
get
{
List declarations = new List();
- foreach (var parameter in LocalParameters)
+ foreach (var parameter in LocalParameters)
{
string format = (parameter.IsRequired ? "{0} {1}" : "{0} {1} = {2}");
string defaultValue = string.Format(CultureInfo.InvariantCulture, "default({0})", parameter.DeclarationExpression);
@@ -146,7 +150,7 @@ public string GetAsyncMethodInvocationArgs (string customHeaderReference)
}
///
- /// Get the parameters that are actually method parameters in the order they apopear in the method signatur
+ /// Get the parameters that are actually method parameters in the order they appear in the method signature
/// exclude global parameters
///
public IEnumerable LocalParameters
@@ -256,7 +260,10 @@ public string ReturnTypeString
///
public ParameterTemplateModel RequestBody
{
- get { return ParameterTemplateModels.FirstOrDefault(p => p.Location == ParameterLocation.Body); }
+ get
+ {
+ return this.Body != null ? new ParameterTemplateModel(this.Body) : null;
+ }
}
///
@@ -334,18 +341,17 @@ public virtual string BuildUrl(string variableName)
{
var builder = new IndentedStringBuilder();
- foreach (var pathParameter in ParameterTemplateModels.Where(p => p.Location == ParameterLocation.Path))
+ foreach (var pathParameter in this.LogicalParameters.Where(p => p.Location == ParameterLocation.Path))
{
builder.AppendLine("{0} = {0}.Replace(\"{{{1}}}\", Uri.EscapeDataString({2}));",
variableName,
pathParameter.SerializedName,
pathParameter.Type.ToString(ClientReference, pathParameter.Name));
}
- if (ParameterTemplateModels.Any(p => p.Location == ParameterLocation.Query))
+ if (this.LogicalParameters.Any(p => p.Location == ParameterLocation.Query))
{
builder.AppendLine("List queryParameters = new List();");
- foreach (var queryParameter in ParameterTemplateModels
- .Where(p => p.Location == ParameterLocation.Query))
+ foreach (var queryParameter in this.LogicalParameters.Where(p => p.Location == ParameterLocation.Query))
{
builder.AppendLine("if ({0} != null)", queryParameter.Name)
.AppendLine("{").Indent()
diff --git a/AutoRest/Generators/CSharp/CSharp/TemplateModels/ModelTemplateModel.cs b/AutoRest/Generators/CSharp/CSharp/TemplateModels/ModelTemplateModel.cs
index b360e5255c..88d9dc1048 100644
--- a/AutoRest/Generators/CSharp/CSharp/TemplateModels/ModelTemplateModel.cs
+++ b/AutoRest/Generators/CSharp/CSharp/TemplateModels/ModelTemplateModel.cs
@@ -9,6 +9,8 @@
namespace Microsoft.Rest.Generator.CSharp
{
+ using System.Globalization;
+
public class ModelTemplateModel : CompositeType
{
private readonly IScopeProvider _scope = new ScopeProvider();
@@ -47,6 +49,24 @@ public bool NeedsPolymorphicConverter
}
}
+ //TODO: this could just be the "required" parameters instead of required and all the optional ones with defaults if we wanted a bit cleaner constructors
+ public string ConstructorParameters
+ {
+ get
+ {
+ List declarations = new List();
+ foreach (var property in this.PropertyTemplateModels.OrderBy(p => !p.IsRequired))
+ {
+ string format = (property.IsRequired ? "{0} {1}" : "{0} {1} = default({0})");
+ declarations.Add(string.Format(CultureInfo.InvariantCulture,
+ format, property.Type, CodeNamer.CamelCase(property.Name)));
+ }
+
+ return string.Join(", ", declarations);
+ }
+ }
+
+
public virtual IEnumerable Usings
{
get { return Enumerable.Empty(); }
diff --git a/AutoRest/Generators/CSharp/CSharp/TemplateModels/ParameterTemplateModel.cs b/AutoRest/Generators/CSharp/CSharp/TemplateModels/ParameterTemplateModel.cs
index 3996e57600..87333a8ad1 100644
--- a/AutoRest/Generators/CSharp/CSharp/TemplateModels/ParameterTemplateModel.cs
+++ b/AutoRest/Generators/CSharp/CSharp/TemplateModels/ParameterTemplateModel.cs
@@ -31,5 +31,6 @@ public virtual bool CanBeValidated
return true;
}
}
+
}
}
\ No newline at end of file
diff --git a/AutoRest/Generators/CSharp/CSharp/Templates/MethodTemplate.cshtml b/AutoRest/Generators/CSharp/CSharp/Templates/MethodTemplate.cshtml
index 311bcaa960..c535cf42de 100644
--- a/AutoRest/Generators/CSharp/CSharp/Templates/MethodTemplate.cshtml
+++ b/AutoRest/Generators/CSharp/CSharp/Templates/MethodTemplate.cshtml
@@ -1,3 +1,4 @@
+@using System.Globalization
@using System.Linq;
@using System
@using Microsoft.Rest.Generator.ClientModel
@@ -30,7 +31,15 @@
///
public async Task<@(Model.OperationResponseReturnTypeString)> @(Model.Name)WithHttpMessagesAsync(@(Model.GetAsyncMethodParameterDeclaration(true)))
{
- @foreach (var parameter in Model.ParameterTemplateModels)
+ @foreach (var mapping in Model.InputParameterMappings)
+ {
+ @:var @(mapping.OutputParameter.Name) = @string.Format(CultureInfo.InvariantCulture,
+ "({0} == null ? default({1}) : {0}.{2})",
+ mapping.InputParameter.Name,
+ mapping.OutputParameter.Type.Name, mapping.InputParameterProperty);
+ }
+
+ @foreach (var parameter in Model.LogicalParameterTemplateModels)
{
if (parameter.IsRequired)
{
@@ -40,8 +49,7 @@ public async Task<@(Model.OperationResponseReturnTypeString)> @(Model.Name)WithH
@:}
@:
}
- if (parameter.CanBeValidated == true &&
- (Model.HttpMethod != HttpMethod.Patch || parameter.Location != ParameterLocation.Body))
+ if(parameter.CanBeValidated == true && parameter.Location != ParameterLocation.None && (Model.HttpMethod != HttpMethod.Patch || parameter.Location != ParameterLocation.Body))
{
@:@(parameter.Type.ValidateType(Model.Scope, parameter.Name, parameter.Constraints))
}
@@ -53,7 +61,7 @@ public async Task<@(Model.OperationResponseReturnTypeString)> @(Model.Name)WithH
{
invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- @foreach (var parameter in Model.LocalParameters)
+ @foreach (var parameter in Model.LogicalParameters.Where(p => p.ClientProperty == null))
{
@:tracingParameters.Add("@(parameter.Name)", @(parameter.Name));
}
@@ -78,7 +86,7 @@ public async Task<@(Model.OperationResponseReturnTypeString)> @(Model.Name)WithH
httpRequest.RequestUri = new Uri(url);
// Set Headers
@(Model.SetDefaultHeaders)
- @foreach (var parameter in Model.Parameters.Where(p => p.Location == ParameterLocation.Header))
+ @foreach (var parameter in Model.LogicalParameters.Where(p => p.Location == ParameterLocation.Header))
{
@:if (@(parameter.Name) != null)
@:{
diff --git a/AutoRest/Generators/CSharp/CSharp/Templates/ModelTemplate.cshtml b/AutoRest/Generators/CSharp/CSharp/Templates/ModelTemplate.cshtml
index d32284b7bc..b3b8ad27c8 100644
--- a/AutoRest/Generators/CSharp/CSharp/Templates/ModelTemplate.cshtml
+++ b/AutoRest/Generators/CSharp/CSharp/Templates/ModelTemplate.cshtml
@@ -2,6 +2,7 @@
@using Microsoft.Rest.Generator.ClientModel
@using Microsoft.Rest.Generator.CSharp.TemplateModels
@using Microsoft.Rest.Generator.Utilities
+@using Microsoft.Rest.Generator
@inherits Microsoft.Rest.Generator.Template
@Header("// ")
@EmptyLine
@@ -26,6 +27,24 @@ namespace @(Settings.Namespace).Models
}
public partial class @Model.Name@(Model.BaseModelType != null ? " : " + Model.BaseModelType.Name : "")
{
+ ///
+ @WrapComment("/// ", ("Initializes a new instance of the " + Model.Name + " class.").EscapeXmlComment())
+ ///
+ public @(Model.Name)() { }
+
+ @EmptyLine
+
+ ///
+ @WrapComment("/// ", ("Initializes a new instance of the " + Model.Name + " class.").EscapeXmlComment())
+ ///
+ public @(Model.Name)(@Model.ConstructorParameters)
+ {
+ @foreach (var property in Model.Properties)
+ {
+ @:@(property.Name) = @(CodeNamer.CamelCase(property.Name));
+ }
+ }
+ @EmptyLine
@foreach (var property in Model.PropertyTemplateModels)
{
@:///
diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/AutoRestParameterGroupingTestService.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/AutoRestParameterGroupingTestService.java
new file mode 100644
index 0000000000..1758fcff91
--- /dev/null
+++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/AutoRestParameterGroupingTestService.java
@@ -0,0 +1,66 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+ * Changes may cause incorrect behavior and will be lost if the code is
+ * regenerated.
+ */
+
+package fixtures.azureparametergrouping;
+
+import com.microsoft.rest.credentials.ServiceClientCredentials;
+
+/**
+ * The interface for AutoRestParameterGroupingTestService class.
+ */
+public interface AutoRestParameterGroupingTestService {
+ /**
+ * Gets the URI used as the base for all cloud service requests.
+ * @return The BaseUri value.
+ */
+ String getBaseUri();
+
+ /**
+ * Gets The management credentials for Azure..
+ *
+ * @return the credentials value.
+ */
+ ServiceClientCredentials getCredentials();
+
+ /**
+ * Gets Gets or sets the preferred language for the response..
+ *
+ * @return the acceptLanguage value.
+ */
+ String getAcceptLanguage();
+
+ /**
+ * Sets Gets or sets the preferred language for the response..
+ *
+ * @param acceptLanguage the acceptLanguage value.
+ */
+ void setAcceptLanguage(String acceptLanguage);
+
+ /**
+ * Gets The retry timeout for Long Running Operations..
+ *
+ * @return the longRunningOperationRetryTimeout value.
+ */
+ int getLongRunningOperationRetryTimeout();
+
+ /**
+ * Sets The retry timeout for Long Running Operations..
+ *
+ * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value.
+ */
+ void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout);
+
+ /**
+ * Gets the ParameterGrouping object to access its operations.
+ * @return the parameterGrouping value.
+ */
+ ParameterGrouping getParameterGrouping();
+
+}
diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/AutoRestParameterGroupingTestServiceImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/AutoRestParameterGroupingTestServiceImpl.java
new file mode 100644
index 0000000000..525e93df94
--- /dev/null
+++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/AutoRestParameterGroupingTestServiceImpl.java
@@ -0,0 +1,132 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+ * Changes may cause incorrect behavior and will be lost if the code is
+ * regenerated.
+ */
+
+package fixtures.azureparametergrouping;
+
+import com.microsoft.rest.credentials.ServiceClientCredentials;
+import com.microsoft.rest.ServiceClient;
+import com.squareup.okhttp.OkHttpClient;
+import retrofit.Retrofit;
+
+/**
+ * Initializes a new instance of the AutoRestParameterGroupingTestService class.
+ */
+public class AutoRestParameterGroupingTestServiceImpl extends ServiceClient implements AutoRestParameterGroupingTestService {
+ private String baseUri;
+
+ /**
+ * Gets the URI used as the base for all cloud service requests.
+ * @return The BaseUri value.
+ */
+ public String getBaseUri() {
+ return this.baseUri;
+ }
+
+ private ServiceClientCredentials credentials;
+
+ /**
+ * Gets The management credentials for Azure.
+ *
+ * @return the credentials value.
+ */
+ public ServiceClientCredentials getCredentials() {
+ return this.credentials;
+ }
+
+ private String acceptLanguage;
+
+ /**
+ * Gets Gets or sets the preferred language for the response.
+ *
+ * @return the acceptLanguage value.
+ */
+ public String getAcceptLanguage() {
+ return this.acceptLanguage;
+ }
+
+ /**
+ * Sets Gets or sets the preferred language for the response.
+ *
+ * @param acceptLanguage the acceptLanguage value.
+ */
+ public void setAcceptLanguage(String acceptLanguage) {
+ this.acceptLanguage = acceptLanguage;
+ }
+
+ private int longRunningOperationRetryTimeout;
+
+ /**
+ * Gets The retry timeout for Long Running Operations.
+ *
+ * @return the longRunningOperationRetryTimeout value.
+ */
+ public int getLongRunningOperationRetryTimeout() {
+ return this.longRunningOperationRetryTimeout;
+ }
+
+ /**
+ * Sets The retry timeout for Long Running Operations.
+ *
+ * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value.
+ */
+ public void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) {
+ this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout;
+ }
+
+ private ParameterGrouping parameterGrouping;
+
+ /**
+ * Gets the ParameterGrouping object to access its operations.
+ * @return the parameterGrouping value.
+ */
+ public ParameterGrouping getParameterGrouping() {
+ return this.parameterGrouping;
+ }
+
+ /**
+ * Initializes an instance of AutoRestParameterGroupingTestService client.
+ */
+ public AutoRestParameterGroupingTestServiceImpl() {
+ this("https://localhost");
+ }
+
+ /**
+ * Initializes an instance of AutoRestParameterGroupingTestService client.
+ *
+ * @param baseUri the base URI of the host
+ */
+ public AutoRestParameterGroupingTestServiceImpl(String baseUri) {
+ super();
+ this.baseUri = baseUri;
+ initialize();
+ }
+
+ /**
+ * Initializes an instance of AutoRestParameterGroupingTestService client.
+ *
+ * @param baseUri the base URI of the host
+ * @param client the {@link OkHttpClient} client to use for REST calls
+ * @param retrofitBuilder the builder for building up a {@link Retrofit}
+ */
+ public AutoRestParameterGroupingTestServiceImpl(String baseUri, OkHttpClient client, Retrofit.Builder retrofitBuilder) {
+ super(client, retrofitBuilder);
+ this.baseUri = baseUri;
+ initialize();
+ }
+
+ private void initialize() {
+ if (this.credentials != null)
+ {
+ this.credentials.applyCredentialsFilter(this.client);
+ }
+ Retrofit retrofit = retrofitBuilder.baseUrl(baseUri).build();
+ this.parameterGrouping = new ParameterGroupingImpl(retrofit, this);
+ }
+}
diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/ParameterGrouping.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/ParameterGrouping.java
new file mode 100644
index 0000000000..b2784bb1e5
--- /dev/null
+++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/ParameterGrouping.java
@@ -0,0 +1,97 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+ * Changes may cause incorrect behavior and will be lost if the code is
+ * regenerated.
+ */
+
+package fixtures.azureparametergrouping;
+
+import com.microsoft.rest.ServiceCallback;
+import com.microsoft.rest.ServiceException;
+import retrofit.Call;
+import com.squareup.okhttp.ResponseBody;
+import fixtures.azureparametergrouping.models.ParameterGroupingPostRequiredParameters;
+import fixtures.azureparametergrouping.models.ParameterGroupingPostOptionalParameters;
+import fixtures.azureparametergrouping.models.FirstParameterGroup;
+import fixtures.azureparametergrouping.models.SecondParameterGroup;
+import retrofit.http.POST;
+import retrofit.http.Header;
+
+/**
+ * An instance of this class provides access to all the operations defined
+ * in ParameterGrouping.
+ */
+public interface ParameterGrouping {
+ /**
+ * The interface defining all the services for ParameterGrouping to be
+ * used by Retrofit to perform actually REST calls.
+ */
+ interface ParameterGroupingService {
+ @POST("/parameterGrouping/postRequired/{path}")
+ Call postRequired(@Header("accept-language") String acceptLanguage);
+
+ @POST("/parameterGrouping/postOptional")
+ Call postOptional(@Header("accept-language") String acceptLanguage);
+
+ @POST("/parameterGrouping/postMultipleParameterGroups")
+ Call postMultipleParameterGroups(@Header("accept-language") String acceptLanguage);
+
+ }
+ /**
+ * Post a bunch of required parameters grouped
+ *
+ * @param parameterGroupingPostRequiredParameters Additional parameters for the operation
+ * @throws ServiceException the exception wrapped in ServiceException if failed.
+ */
+ void postRequired(ParameterGroupingPostRequiredParameters parameterGroupingPostRequiredParameters) throws ServiceException;
+
+ /**
+ * Post a bunch of required parameters grouped
+ *
+ * @param parameterGroupingPostRequiredParameters Additional parameters for the operation
+ * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
+ * @return the {@link Call} object
+ */
+ Call postRequiredAsync(ParameterGroupingPostRequiredParameters parameterGroupingPostRequiredParameters, final ServiceCallback serviceCallback);
+
+ /**
+ * Post a bunch of optional parameters grouped
+ *
+ * @param parameterGroupingPostOptionalParameters Additional parameters for the operation
+ * @throws ServiceException the exception wrapped in ServiceException if failed.
+ */
+ void postOptional(ParameterGroupingPostOptionalParameters parameterGroupingPostOptionalParameters) throws ServiceException;
+
+ /**
+ * Post a bunch of optional parameters grouped
+ *
+ * @param parameterGroupingPostOptionalParameters Additional parameters for the operation
+ * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
+ * @return the {@link Call} object
+ */
+ Call postOptionalAsync(ParameterGroupingPostOptionalParameters parameterGroupingPostOptionalParameters, final ServiceCallback serviceCallback);
+
+ /**
+ * Post parameters from multiple different parameter groups
+ *
+ * @param firstParameterGroup Additional parameters for the operation
+ * @param secondParameterGroup Additional parameters for the operation
+ * @throws ServiceException the exception wrapped in ServiceException if failed.
+ */
+ void postMultipleParameterGroups(FirstParameterGroup firstParameterGroup, SecondParameterGroup secondParameterGroup) throws ServiceException;
+
+ /**
+ * Post parameters from multiple different parameter groups
+ *
+ * @param firstParameterGroup Additional parameters for the operation
+ * @param secondParameterGroup Additional parameters for the operation
+ * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
+ * @return the {@link Call} object
+ */
+ Call postMultipleParameterGroupsAsync(FirstParameterGroup firstParameterGroup, SecondParameterGroup secondParameterGroup, final ServiceCallback serviceCallback);
+
+}
diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/ParameterGroupingImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/ParameterGroupingImpl.java
new file mode 100644
index 0000000000..3120b6b10f
--- /dev/null
+++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/ParameterGroupingImpl.java
@@ -0,0 +1,191 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+ * Changes may cause incorrect behavior and will be lost if the code is
+ * regenerated.
+ */
+
+package fixtures.azureparametergrouping;
+
+import com.google.common.reflect.TypeToken;
+import com.microsoft.rest.ServiceCallback;
+import com.microsoft.rest.ServiceException;
+import com.microsoft.rest.ServiceResponse;
+import com.microsoft.rest.ServiceResponseBuilder;
+import com.microsoft.rest.ServiceResponseCallback;
+import com.microsoft.rest.ServiceResponseEmptyCallback;
+import com.squareup.okhttp.ResponseBody;
+import retrofit.Retrofit;
+import retrofit.Call;
+import retrofit.Response;
+import fixtures.azureparametergrouping.models.ParameterGroupingPostRequiredParameters;
+import fixtures.azureparametergrouping.models.ParameterGroupingPostOptionalParameters;
+import fixtures.azureparametergrouping.models.FirstParameterGroup;
+import fixtures.azureparametergrouping.models.SecondParameterGroup;
+import fixtures.azureparametergrouping.models.Error;
+import com.microsoft.rest.Validator;
+import com.microsoft.rest.serializer.JacksonHelper;
+
+public class ParameterGroupingImpl implements ParameterGrouping {
+ private ParameterGroupingService service;
+ AutoRestParameterGroupingTestService client;
+
+ public ParameterGroupingImpl(Retrofit retrofit, AutoRestParameterGroupingTestService client) {
+ this.service = retrofit.create(ParameterGroupingService.class);
+ this.client = client;
+ }
+
+ /**
+ * Post a bunch of required parameters grouped
+ *
+ * @param parameterGroupingPostRequiredParameters Additional parameters for the operation
+ * @throws ServiceException the exception wrapped in ServiceException if failed.
+ */
+ public void postRequired(ParameterGroupingPostRequiredParameters parameterGroupingPostRequiredParameters) throws ServiceException {
+ if (parameterGroupingPostRequiredParameters == null) {
+ throw new ServiceException(
+ new IllegalArgumentException("Parameter parameterGroupingPostRequiredParameters is required and cannot be null."));
+ }
+ Validator.validate(parameterGroupingPostRequiredParameters);
+ try {
+ Call call = service.postRequired(this.client.getAcceptLanguage());
+ ServiceResponse response = postRequiredDelegate(call.execute(), null);
+ response.getBody();
+ } catch (ServiceException ex) {
+ throw ex;
+ } catch (Exception ex) {
+ throw new ServiceException(ex);
+ }
+ }
+
+ /**
+ * Post a bunch of required parameters grouped
+ *
+ * @param parameterGroupingPostRequiredParameters Additional parameters for the operation
+ * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
+ */
+ public Call postRequiredAsync(ParameterGroupingPostRequiredParameters parameterGroupingPostRequiredParameters, final ServiceCallback serviceCallback) {
+ if (parameterGroupingPostRequiredParameters == null) {
+ serviceCallback.failure(new ServiceException(
+ new IllegalArgumentException("Parameter parameterGroupingPostRequiredParameters is required and cannot be null.")));
+ }
+ Validator.validate(parameterGroupingPostRequiredParameters, serviceCallback);
+ Call call = service.postRequired(this.client.getAcceptLanguage());
+ call.enqueue(new ServiceResponseCallback(serviceCallback) {
+ @Override
+ public void onResponse(Response response, Retrofit retrofit) {
+ try {
+ serviceCallback.success(postRequiredDelegate(response, retrofit));
+ } catch (ServiceException exception) {
+ serviceCallback.failure(exception);
+ }
+ }
+ });
+ return call;
+ }
+
+ private ServiceResponse postRequiredDelegate(Response response, Retrofit retrofit) throws ServiceException {
+ return new ServiceResponseBuilder()
+ .register(200, new TypeToken(){}.getType())
+ .registerError(new TypeToken(){}.getType())
+ .build(response, retrofit);
+ }
+
+ /**
+ * Post a bunch of optional parameters grouped
+ *
+ * @param parameterGroupingPostOptionalParameters Additional parameters for the operation
+ * @throws ServiceException the exception wrapped in ServiceException if failed.
+ */
+ public void postOptional(ParameterGroupingPostOptionalParameters parameterGroupingPostOptionalParameters) throws ServiceException {
+ try {
+ Call call = service.postOptional(this.client.getAcceptLanguage());
+ ServiceResponse response = postOptionalDelegate(call.execute(), null);
+ response.getBody();
+ } catch (ServiceException ex) {
+ throw ex;
+ } catch (Exception ex) {
+ throw new ServiceException(ex);
+ }
+ }
+
+ /**
+ * Post a bunch of optional parameters grouped
+ *
+ * @param parameterGroupingPostOptionalParameters Additional parameters for the operation
+ * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
+ */
+ public Call postOptionalAsync(ParameterGroupingPostOptionalParameters parameterGroupingPostOptionalParameters, final ServiceCallback serviceCallback) {
+ Call call = service.postOptional(this.client.getAcceptLanguage());
+ call.enqueue(new ServiceResponseCallback(serviceCallback) {
+ @Override
+ public void onResponse(Response response, Retrofit retrofit) {
+ try {
+ serviceCallback.success(postOptionalDelegate(response, retrofit));
+ } catch (ServiceException exception) {
+ serviceCallback.failure(exception);
+ }
+ }
+ });
+ return call;
+ }
+
+ private ServiceResponse postOptionalDelegate(Response response, Retrofit retrofit) throws ServiceException {
+ return new ServiceResponseBuilder()
+ .register(200, new TypeToken(){}.getType())
+ .registerError(new TypeToken(){}.getType())
+ .build(response, retrofit);
+ }
+
+ /**
+ * Post parameters from multiple different parameter groups
+ *
+ * @param firstParameterGroup Additional parameters for the operation
+ * @param secondParameterGroup Additional parameters for the operation
+ * @throws ServiceException the exception wrapped in ServiceException if failed.
+ */
+ public void postMultipleParameterGroups(FirstParameterGroup firstParameterGroup, SecondParameterGroup secondParameterGroup) throws ServiceException {
+ try {
+ Call call = service.postMultipleParameterGroups(this.client.getAcceptLanguage());
+ ServiceResponse response = postMultipleParameterGroupsDelegate(call.execute(), null);
+ response.getBody();
+ } catch (ServiceException ex) {
+ throw ex;
+ } catch (Exception ex) {
+ throw new ServiceException(ex);
+ }
+ }
+
+ /**
+ * Post parameters from multiple different parameter groups
+ *
+ * @param firstParameterGroup Additional parameters for the operation
+ * @param secondParameterGroup Additional parameters for the operation
+ * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
+ */
+ public Call postMultipleParameterGroupsAsync(FirstParameterGroup firstParameterGroup, SecondParameterGroup secondParameterGroup, final ServiceCallback serviceCallback) {
+ Call call = service.postMultipleParameterGroups(this.client.getAcceptLanguage());
+ call.enqueue(new ServiceResponseCallback(serviceCallback) {
+ @Override
+ public void onResponse(Response response, Retrofit retrofit) {
+ try {
+ serviceCallback.success(postMultipleParameterGroupsDelegate(response, retrofit));
+ } catch (ServiceException exception) {
+ serviceCallback.failure(exception);
+ }
+ }
+ });
+ return call;
+ }
+
+ private ServiceResponse postMultipleParameterGroupsDelegate(Response response, Retrofit retrofit) throws ServiceException {
+ return new ServiceResponseBuilder()
+ .register(200, new TypeToken(){}.getType())
+ .registerError(new TypeToken(){}.getType())
+ .build(response, retrofit);
+ }
+
+}
diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/CloudError.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/CloudError.java
new file mode 100644
index 0000000000..f1d4ff9e7e
--- /dev/null
+++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/CloudError.java
@@ -0,0 +1,18 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+ * Changes may cause incorrect behavior and will be lost if the code is
+ * regenerated.
+ */
+
+package fixtures.azureparametergrouping.models;
+
+
+/**
+ * The CloudError model.
+ */
+public class CloudError {
+}
diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/Error.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/Error.java
new file mode 100644
index 0000000000..c948b03d49
--- /dev/null
+++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/Error.java
@@ -0,0 +1,64 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+ * Changes may cause incorrect behavior and will be lost if the code is
+ * regenerated.
+ */
+
+package fixtures.azureparametergrouping.models;
+
+
+/**
+ * The Error model.
+ */
+public class Error {
+ /**
+ * The status property.
+ */
+ private Integer status;
+
+ /**
+ * The message property.
+ */
+ private String message;
+
+ /**
+ * Get the status value.
+ *
+ * @return the status value
+ */
+ public Integer getStatus() {
+ return this.status;
+ }
+
+ /**
+ * Set the status value.
+ *
+ * @param status the status value to set
+ */
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+
+ /**
+ * Get the message value.
+ *
+ * @return the message value
+ */
+ public String getMessage() {
+ return this.message;
+ }
+
+ /**
+ * Set the message value.
+ *
+ * @param message the message value to set
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+}
diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/FirstParameterGroup.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/FirstParameterGroup.java
new file mode 100644
index 0000000000..a4ffdd12dc
--- /dev/null
+++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/FirstParameterGroup.java
@@ -0,0 +1,67 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+ * Changes may cause incorrect behavior and will be lost if the code is
+ * regenerated.
+ */
+
+package fixtures.azureparametergrouping.models;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Additional parameters for the postMultipleParameterGroups operation.
+ */
+public class FirstParameterGroup {
+ /**
+ * The headerOne property.
+ */
+ @JsonProperty(value = "")
+ private String headerOne;
+
+ /**
+ * Query parameter with default
+ */
+ @JsonProperty(value = "")
+ private Integer queryOne;
+
+ /**
+ * Get the headerOne value.
+ *
+ * @return the headerOne value
+ */
+ public String getHeaderOne() {
+ return this.headerOne;
+ }
+
+ /**
+ * Set the headerOne value.
+ *
+ * @param headerOne the headerOne value to set
+ */
+ public void setHeaderOne(String headerOne) {
+ this.headerOne = headerOne;
+ }
+
+ /**
+ * Get the queryOne value.
+ *
+ * @return the queryOne value
+ */
+ public Integer getQueryOne() {
+ return this.queryOne;
+ }
+
+ /**
+ * Set the queryOne value.
+ *
+ * @param queryOne the queryOne value to set
+ */
+ public void setQueryOne(Integer queryOne) {
+ this.queryOne = queryOne;
+ }
+
+}
diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ParameterGroupingPostOptionalParameters.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ParameterGroupingPostOptionalParameters.java
new file mode 100644
index 0000000000..d1d0d2970d
--- /dev/null
+++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ParameterGroupingPostOptionalParameters.java
@@ -0,0 +1,67 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+ * Changes may cause incorrect behavior and will be lost if the code is
+ * regenerated.
+ */
+
+package fixtures.azureparametergrouping.models;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Additional parameters for the postOptional operation.
+ */
+public class ParameterGroupingPostOptionalParameters {
+ /**
+ * The customHeader property.
+ */
+ @JsonProperty(value = "")
+ private String customHeader;
+
+ /**
+ * Query parameter with default
+ */
+ @JsonProperty(value = "")
+ private Integer query;
+
+ /**
+ * Get the customHeader value.
+ *
+ * @return the customHeader value
+ */
+ public String getCustomHeader() {
+ return this.customHeader;
+ }
+
+ /**
+ * Set the customHeader value.
+ *
+ * @param customHeader the customHeader value to set
+ */
+ public void setCustomHeader(String customHeader) {
+ this.customHeader = customHeader;
+ }
+
+ /**
+ * Get the query value.
+ *
+ * @return the query value
+ */
+ public Integer getQuery() {
+ return this.query;
+ }
+
+ /**
+ * Set the query value.
+ *
+ * @param query the query value to set
+ */
+ public void setQuery(Integer query) {
+ this.query = query;
+ }
+
+}
diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ParameterGroupingPostRequiredParameters.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ParameterGroupingPostRequiredParameters.java
new file mode 100644
index 0000000000..fee2a7f414
--- /dev/null
+++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ParameterGroupingPostRequiredParameters.java
@@ -0,0 +1,115 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+ * Changes may cause incorrect behavior and will be lost if the code is
+ * regenerated.
+ */
+
+package fixtures.azureparametergrouping.models;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Additional parameters for the postRequired operation.
+ */
+public class ParameterGroupingPostRequiredParameters {
+ /**
+ * The body property.
+ */
+ @JsonProperty(value = "", required = true)
+ private int body;
+
+ /**
+ * The customHeader property.
+ */
+ @JsonProperty(value = "")
+ private String customHeader;
+
+ /**
+ * Query parameter with default
+ */
+ @JsonProperty(value = "")
+ private Integer query;
+
+ /**
+ * Path parameter
+ */
+ @JsonProperty(value = "", required = true)
+ private String path;
+
+ /**
+ * Get the body value.
+ *
+ * @return the body value
+ */
+ public int getBody() {
+ return this.body;
+ }
+
+ /**
+ * Set the body value.
+ *
+ * @param body the body value to set
+ */
+ public void setBody(int body) {
+ this.body = body;
+ }
+
+ /**
+ * Get the customHeader value.
+ *
+ * @return the customHeader value
+ */
+ public String getCustomHeader() {
+ return this.customHeader;
+ }
+
+ /**
+ * Set the customHeader value.
+ *
+ * @param customHeader the customHeader value to set
+ */
+ public void setCustomHeader(String customHeader) {
+ this.customHeader = customHeader;
+ }
+
+ /**
+ * Get the query value.
+ *
+ * @return the query value
+ */
+ public Integer getQuery() {
+ return this.query;
+ }
+
+ /**
+ * Set the query value.
+ *
+ * @param query the query value to set
+ */
+ public void setQuery(Integer query) {
+ this.query = query;
+ }
+
+ /**
+ * Get the path value.
+ *
+ * @return the path value
+ */
+ public String getPath() {
+ return this.path;
+ }
+
+ /**
+ * Set the path value.
+ *
+ * @param path the path value to set
+ */
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+}
diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/SecondParameterGroup.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/SecondParameterGroup.java
new file mode 100644
index 0000000000..d82226cdea
--- /dev/null
+++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/SecondParameterGroup.java
@@ -0,0 +1,67 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+ * Changes may cause incorrect behavior and will be lost if the code is
+ * regenerated.
+ */
+
+package fixtures.azureparametergrouping.models;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Additional parameters for the postMultipleParameterGroups operation.
+ */
+public class SecondParameterGroup {
+ /**
+ * The headerTwo property.
+ */
+ @JsonProperty(value = "")
+ private String headerTwo;
+
+ /**
+ * Query parameter with default
+ */
+ @JsonProperty(value = "")
+ private Integer queryTwo;
+
+ /**
+ * Get the headerTwo value.
+ *
+ * @return the headerTwo value
+ */
+ public String getHeaderTwo() {
+ return this.headerTwo;
+ }
+
+ /**
+ * Set the headerTwo value.
+ *
+ * @param headerTwo the headerTwo value to set
+ */
+ public void setHeaderTwo(String headerTwo) {
+ this.headerTwo = headerTwo;
+ }
+
+ /**
+ * Get the queryTwo value.
+ *
+ * @return the queryTwo value
+ */
+ public Integer getQueryTwo() {
+ return this.queryTwo;
+ }
+
+ /**
+ * Set the queryTwo value.
+ *
+ * @param queryTwo the queryTwo value to set
+ */
+ public void setQueryTwo(Integer queryTwo) {
+ this.queryTwo = queryTwo;
+ }
+
+}
diff --git a/AutoRest/Generators/Java/Java/GlobalSuppressions.cs b/AutoRest/Generators/Java/Java/GlobalSuppressions.cs
index 702dc989b6..cc5367baab 100644
--- a/AutoRest/Generators/Java/Java/GlobalSuppressions.cs
+++ b/AutoRest/Generators/Java/Java/GlobalSuppressions.cs
@@ -117,3 +117,4 @@
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Scope = "member", Target = "Microsoft.Rest.Generator.Java.ServiceClientTemplateModel.#InterfaceImports")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Scope = "member", Target = "Microsoft.Rest.Generator.Java.MethodGroupTemplateModel.#TypeImports(System.Collections.Generic.IList`1)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Scope = "member", Target = "Microsoft.Rest.Generator.Java.TemplateModels.ClientModelExtensions.#TypeImports(System.Collections.Generic.IList`1,System.String)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Scope = "member", Target = "Microsoft.Rest.Generator.Java.MethodGroupTemplateModel.#ImplImports")]
diff --git a/AutoRest/Generators/Java/Java/TemplateModels/MethodGroupTemplateModel.cs b/AutoRest/Generators/Java/Java/TemplateModels/MethodGroupTemplateModel.cs
index 29bbb1d491..7454b1830c 100644
--- a/AutoRest/Generators/Java/Java/TemplateModels/MethodGroupTemplateModel.cs
+++ b/AutoRest/Generators/Java/Java/TemplateModels/MethodGroupTemplateModel.cs
@@ -47,8 +47,8 @@ public IEnumerable ImplImports
{
get
{
- var parameters = this.MethodTemplateModels
- .SelectMany(m => m.ParameterTemplateModels);
+ //Omit parameter group types for now since they don't get generated
+ var parameters = this.MethodTemplateModels.SelectMany(m => m.Parameters);
var types = parameters.Select(p => p.Type)
.Concat(this.MethodTemplateModels.SelectMany(mtm => mtm.Responses.Select(res => res.Value)))
@@ -63,7 +63,7 @@ public IEnumerable ImplImports
classes.Add("com.microsoft.rest.Validator");
}
- IEnumerable nonBodyParams = parameters.Where(p => p.Location != ParameterLocation.Body);
+ var nonBodyParams = parameters.Where(p => p.Location != ParameterLocation.Body);
foreach (var param in nonBodyParams)
{
diff --git a/AutoRest/Generators/Java/Java/TemplateModels/MethodTemplateModel.cs b/AutoRest/Generators/Java/Java/TemplateModels/MethodTemplateModel.cs
index 913a4d2145..75fd265730 100644
--- a/AutoRest/Generators/Java/Java/TemplateModels/MethodTemplateModel.cs
+++ b/AutoRest/Generators/Java/Java/TemplateModels/MethodTemplateModel.cs
@@ -37,7 +37,7 @@ public MethodTemplateModel(Method source, ServiceClient serviceClient)
public ServiceClient ServiceClient { get; set; }
public List ParameterTemplateModels { get; private set; }
-
+
public IScopeProvider Scope
{
get { return _scopeProvider; }
@@ -51,7 +51,7 @@ public string MethodParameterApiDeclaration
get
{
List declarations = new List();
- foreach (var parameter in ParameterTemplateModels)
+ foreach (var parameter in ParameterTemplateModels.Where(p => p.Location != ParameterLocation.None))
{
StringBuilder declarationBuilder = new StringBuilder();
if (Url.Contains("{" + parameter.Name + "}"))
@@ -112,7 +112,7 @@ public string MethodParameterInvocation
get
{
List declarations = new List();
- foreach (var parameter in ParameterTemplateModels)
+ foreach (var parameter in ParameterTemplateModels.Where(p => p.Location != ParameterLocation.None))
{
if ((parameter.Location != ParameterLocation.Body)
&& parameter.Type.NeedsSpecialSerialization())
@@ -232,6 +232,7 @@ public IEnumerable LocalParameters
{
get
{
+ //Omit parameter-group properties for now since Java doesn't support them yet
return ParameterTemplateModels.Where(
p => p != null && p.ClientProperty == null && !string.IsNullOrWhiteSpace(p.Name))
.OrderBy(item => !item.IsRequired);
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/AcceptanceTests/coverage.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/AcceptanceTests/coverage.js
index ba7c546c00..4ff42172c0 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/AcceptanceTests/coverage.js
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/AcceptanceTests/coverage.js
@@ -29,6 +29,7 @@ describe('nodejs', function () {
testClient.getReport(function (error, result) {
should.not.exist(error);
//console.log('The test coverage for azure is ' + util.inspect(result));
+
var total = _.keys(result).length;
var passed = 0;
_.keys(result).forEach(function(item) {
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/AcceptanceTests/parameterGrouping.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/AcceptanceTests/parameterGrouping.js
new file mode 100644
index 0000000000..ba00761ca5
--- /dev/null
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/AcceptanceTests/parameterGrouping.js
@@ -0,0 +1,102 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+
+'use strict';
+
+var should = require('should');
+var http = require('http');
+var util = require('util');
+var assert = require('assert');
+var msRestAzure = require('ms-rest-azure');
+
+var parametersTestClient = require('../Expected/AcceptanceTests/AzureParameterGrouping/autoRestParameterGroupingTestService');
+var dummyToken = 'dummy12321343423';
+var credentials = new msRestAzure.TokenCredentials(dummyToken);
+
+var clientOptions = {};
+var baseUri = 'http://localhost:3000';
+
+describe('nodejs', function () {
+ var body = 1234;
+ var header = "header";
+ var query = 21;
+ var path = "path";
+
+ describe('Azure Parameter Grouping', function () {
+ var testClient = new parametersTestClient(credentials, baseUri, clientOptions);
+ it('should accept valid required parameters', function (done) {
+ testClient.parameterGrouping.postRequired({body: body, customHeader: header, query: query, path: path},
+ function (error, result, request, response) {
+ should.not.exist(error);
+ response.statusCode.should.equal(200);
+ done();
+ });
+ });
+
+ it('should accept required parameters but null optional parameters', function (done) {
+ testClient.parameterGrouping.postRequired({body: body, path: path},
+ function (error, result, request, response) {
+ should.not.exist(error);
+ response.statusCode.should.equal(200);
+ done();
+ });
+ });
+
+ it('should reject required parameters with missing required property', function (done) {
+ testClient.parameterGrouping.postRequired({path: path},
+ function (error, result, request, response) {
+ should.exist(error);
+ error.message.should.match(/.*cannot be null or undefined.*/);
+ should.not.exist(result);
+ should.not.exist(response);
+ done();
+ });
+ });
+
+ it('should reject null required parameters', function (done) {
+ testClient.parameterGrouping.postRequired(null, function (error, result, request, response) {
+ should.exist(error);
+ error.message.should.match(/.*cannot be null or undefined.*/);
+ should.not.exist(result);
+ should.not.exist(response);
+ done();
+ });
+ });
+
+ it('should accept valid optional parameters', function (done) {
+ testClient.parameterGrouping.postOptional({customHeader: header, query: query},
+ function (error, result, request, response) {
+ should.not.exist(error);
+ response.statusCode.should.equal(200);
+ done();
+ });
+ });
+
+ it('should accept null optional parameters', function (done) {
+ testClient.parameterGrouping.postOptional(null, function (error, result, request, response) {
+ should.not.exist(error);
+ response.statusCode.should.equal(200);
+ done();
+ });
+ });
+
+ it('should allow multiple parameter groups', function (done) {
+ testClient.parameterGrouping.postMultipleParameterGroups({headerOne: header, queryOne: query}, {headerTwo: "header2", queryTwo: 42},
+ function (error, result, request, response) {
+ should.not.exist(error);
+ response.statusCode.should.equal(200);
+ done();
+ });
+ });
+
+ it('should allow multiple parameter groups with some defaults omitted', function (done) {
+ testClient.parameterGrouping.postMultipleParameterGroups({headerOne: header}, {queryTwo: 42},
+ function (error, result, request, response) {
+ should.not.exist(error);
+ response.statusCode.should.equal(200);
+ done();
+ });
+ });
+
+ });
+});
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/AcceptanceTests/testlist.txt b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/AcceptanceTests/testlist.txt
index 1339a2dd39..6506c9244f 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/AcceptanceTests/testlist.txt
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/AcceptanceTests/testlist.txt
@@ -8,5 +8,6 @@ head.js
resourceFlattening.js
subscriptionIdApiVersion.js
azureSpecialProperties.js
+parameterGrouping.js
#####The following test will always be executed as the last test to get test coverage
coverage.js
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Azure.NodeJS.Tests.njsproj b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Azure.NodeJS.Tests.njsproj
index e628aa3e39..291a04747a 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Azure.NodeJS.Tests.njsproj
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Azure.NodeJS.Tests.njsproj
@@ -19,6 +19,9 @@
+
+ Mocha
+
@@ -38,76 +41,7 @@
Mocha
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -148,6 +82,9 @@
+
+
+
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autoRestParameterGroupingTestService.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autoRestParameterGroupingTestService.js
new file mode 100644
index 0000000000..e9a5d57fe3
--- /dev/null
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autoRestParameterGroupingTestService.js
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+ * Changes may cause incorrect behavior and will be lost if the code is
+ * regenerated.
+ */
+
+/* jshint latedef:false */
+/* jshint forin:false */
+/* jshint noempty:false */
+
+'use strict';
+
+var util = require('util');
+var msRest = require('ms-rest');
+var msRestAzure = require('ms-rest-azure');
+var ServiceClient = msRestAzure.AzureServiceClient;
+var WebResource = msRest.WebResource;
+
+var models = require('./models');
+var operations = require('./operations');
+
+/**
+ * @class
+ * Initializes a new instance of the AutoRestParameterGroupingTestService class.
+ * @constructor
+ *
+ * @param {ServiceClientCredentials} credentials The management credentials for Azure.
+ *
+ * @param {string} [baseUri] - The base URI of the service.
+ *
+ * @param {object} [options] - The parameter options
+ *
+ * @param {Array} [options.filters] - Filters to be added to the request pipeline
+ *
+ * @param {object} [options.requestOptions] - Options for the underlying request object
+ * {@link https://github.com/request/request#requestoptions-callback Options doc}
+ *
+ * @param {bool} [options.noRetryPolicy] - If set to true, turn off default retry policy
+ */
+function AutoRestParameterGroupingTestService(credentials, baseUri, options) {
+ if (credentials === null || credentials === undefined) {
+ throw new Error('\'credentials\' cannot be null.');
+ }
+
+ if (!options) options = {};
+
+ AutoRestParameterGroupingTestService['super_'].call(this, credentials, options);
+ this.baseUri = baseUri;
+ if (!this.baseUri) {
+ this.baseUri = 'https://localhost';
+ }
+ this.credentials = credentials;
+
+ if(!this.acceptLanguage) {
+ this.acceptLanguage = 'en-US';
+ }
+ this.parameterGrouping = new operations.ParameterGrouping(this);
+ this._models = models;
+}
+
+util.inherits(AutoRestParameterGroupingTestService, ServiceClient);
+
+module.exports = AutoRestParameterGroupingTestService;
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/models/errorModel.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/models/errorModel.js
new file mode 100644
index 0000000000..02fb5059d5
--- /dev/null
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/models/errorModel.js
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+ * Changes may cause incorrect behavior and will be lost if the code is
+ * regenerated.
+ */
+
+'use strict';
+
+/**
+ * @class
+ * Initializes a new instance of the ErrorModel class.
+ * @constructor
+ * @member {number} [status]
+ *
+ * @member {string} [message]
+ *
+ */
+function ErrorModel(parameters) {
+ if (parameters !== null && parameters !== undefined) {
+ if (parameters.status !== undefined) {
+ this.status = parameters.status;
+ }
+ if (parameters.message !== undefined) {
+ this.message = parameters.message;
+ }
+ }
+}
+
+
+/**
+ * Validate the payload against the ErrorModel schema
+ *
+ * @param {JSON} payload
+ *
+ */
+ErrorModel.prototype.serialize = function () {
+ var payload = {};
+ if (this['status'] !== null && this['status'] !== undefined) {
+ if (typeof this['status'] !== 'number') {
+ throw new Error('this[\'status\'] must be of type number.');
+ }
+ payload['status'] = this['status'];
+ }
+
+ if (this['message'] !== null && this['message'] !== undefined) {
+ if (typeof this['message'].valueOf() !== 'string') {
+ throw new Error('this[\'message\'] must be of type string.');
+ }
+ payload['message'] = this['message'];
+ }
+
+ return payload;
+};
+
+/**
+ * Deserialize the instance to ErrorModel schema
+ *
+ * @param {JSON} instance
+ *
+ */
+ErrorModel.prototype.deserialize = function (instance) {
+ if (instance) {
+ if (instance['status'] !== undefined) {
+ this['status'] = instance['status'];
+ }
+
+ if (instance['message'] !== undefined) {
+ this['message'] = instance['message'];
+ }
+ }
+
+ return this;
+};
+
+module.exports = ErrorModel;
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/models/firstParameterGroup.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/models/firstParameterGroup.js
new file mode 100644
index 0000000000..eb1f51da25
--- /dev/null
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/models/firstParameterGroup.js
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+ * Changes may cause incorrect behavior and will be lost if the code is
+ * regenerated.
+ */
+
+'use strict';
+
+/**
+ * @class
+ * Initializes a new instance of the FirstParameterGroup class.
+ * @constructor
+ * Additional parameters for the postMultipleParameterGroups operation.
+ * @member {string} [headerOne]
+ *
+ * @member {number} [queryOne] Query parameter with default
+ *
+ */
+function FirstParameterGroup(parameters) {
+ if (parameters !== null && parameters !== undefined) {
+ if (parameters.headerOne !== undefined) {
+ this.headerOne = parameters.headerOne;
+ }
+ if (parameters.queryOne !== undefined) {
+ this.queryOne = parameters.queryOne;
+ }
+ }
+}
+
+
+
+module.exports = FirstParameterGroup;
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/models/index.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/models/index.js
new file mode 100644
index 0000000000..d18b90b6e5
--- /dev/null
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/models/index.js
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+ * Changes may cause incorrect behavior and will be lost if the code is
+ * regenerated.
+ */
+
+/* jshint latedef:false */
+/* jshint forin:false */
+/* jshint noempty:false */
+
+'use strict';
+
+var msRestAzure = require('ms-rest-azure');
+
+exports.Resource = msRestAzure.Resource;
+exports.SubResource = msRestAzure.SubResource;
+exports.CloudError = msRestAzure.CloudError;
+exports.ErrorModel = require('./errorModel');
+exports.ParameterGroupingPostRequiredParameters = require('./parameterGroupingPostRequiredParameters');
+exports.ParameterGroupingPostOptionalParameters = require('./parameterGroupingPostOptionalParameters');
+exports.FirstParameterGroup = require('./firstParameterGroup');
+exports.SecondParameterGroup = require('./secondParameterGroup');
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/models/parameterGroupingPostOptionalParameters.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/models/parameterGroupingPostOptionalParameters.js
new file mode 100644
index 0000000000..7414138483
--- /dev/null
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/models/parameterGroupingPostOptionalParameters.js
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+ * Changes may cause incorrect behavior and will be lost if the code is
+ * regenerated.
+ */
+
+'use strict';
+
+/**
+ * @class
+ * Initializes a new instance of the ParameterGroupingPostOptionalParameters class.
+ * @constructor
+ * Additional parameters for the postOptional operation.
+ * @member {string} [customHeader]
+ *
+ * @member {number} [query] Query parameter with default
+ *
+ */
+function ParameterGroupingPostOptionalParameters(parameters) {
+ if (parameters !== null && parameters !== undefined) {
+ if (parameters.customHeader !== undefined) {
+ this.customHeader = parameters.customHeader;
+ }
+ if (parameters.query !== undefined) {
+ this.query = parameters.query;
+ }
+ }
+}
+
+
+
+module.exports = ParameterGroupingPostOptionalParameters;
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/models/parameterGroupingPostRequiredParameters.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/models/parameterGroupingPostRequiredParameters.js
new file mode 100644
index 0000000000..eefabf5640
--- /dev/null
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/models/parameterGroupingPostRequiredParameters.js
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+ * Changes may cause incorrect behavior and will be lost if the code is
+ * regenerated.
+ */
+
+'use strict';
+
+/**
+ * @class
+ * Initializes a new instance of the ParameterGroupingPostRequiredParameters class.
+ * @constructor
+ * Additional parameters for the postRequired operation.
+ * @member {number} body
+ *
+ * @member {string} [customHeader]
+ *
+ * @member {number} [query] Query parameter with default
+ *
+ * @member {string} path Path parameter
+ *
+ */
+function ParameterGroupingPostRequiredParameters(parameters) {
+ if (parameters !== null && parameters !== undefined) {
+ if (parameters.body !== undefined) {
+ this.body = parameters.body;
+ }
+ if (parameters.customHeader !== undefined) {
+ this.customHeader = parameters.customHeader;
+ }
+ if (parameters.query !== undefined) {
+ this.query = parameters.query;
+ }
+ if (parameters.path !== undefined) {
+ this.path = parameters.path;
+ }
+ }
+}
+
+
+
+module.exports = ParameterGroupingPostRequiredParameters;
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/models/secondParameterGroup.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/models/secondParameterGroup.js
new file mode 100644
index 0000000000..7e50557e64
--- /dev/null
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/models/secondParameterGroup.js
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+ * Changes may cause incorrect behavior and will be lost if the code is
+ * regenerated.
+ */
+
+'use strict';
+
+/**
+ * @class
+ * Initializes a new instance of the SecondParameterGroup class.
+ * @constructor
+ * Additional parameters for the postMultipleParameterGroups operation.
+ * @member {string} [headerTwo]
+ *
+ * @member {number} [queryTwo] Query parameter with default
+ *
+ */
+function SecondParameterGroup(parameters) {
+ if (parameters !== null && parameters !== undefined) {
+ if (parameters.headerTwo !== undefined) {
+ this.headerTwo = parameters.headerTwo;
+ }
+ if (parameters.queryTwo !== undefined) {
+ this.queryTwo = parameters.queryTwo;
+ }
+ }
+}
+
+
+
+module.exports = SecondParameterGroup;
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/operations/index.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/operations/index.js
new file mode 100644
index 0000000000..8929e0cd63
--- /dev/null
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/operations/index.js
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+ * Changes may cause incorrect behavior and will be lost if the code is
+ * regenerated.
+ */
+
+/* jshint latedef:false */
+/* jshint forin:false */
+/* jshint noempty:false */
+
+'use strict';
+
+exports.ParameterGrouping = require('./parameterGrouping');
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/operations/parameterGrouping.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/operations/parameterGrouping.js
new file mode 100644
index 0000000000..7949a3ba62
--- /dev/null
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureParameterGrouping/operations/parameterGrouping.js
@@ -0,0 +1,455 @@
+/*
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
+ * Changes may cause incorrect behavior and will be lost if the code is
+ * regenerated.
+ */
+
+'use strict';
+
+var util = require('util');
+var msRest = require('ms-rest');
+var msRestAzure = require('ms-rest-azure');
+var ServiceClient = msRest.ServiceClient;
+var WebResource = msRest.WebResource;
+
+var models = require('../models');
+
+/**
+ * @class
+ * ParameterGrouping
+ * __NOTE__: An instance of this class is automatically created for an
+ * instance of the AutoRestParameterGroupingTestService.
+ * Initializes a new instance of the ParameterGrouping class.
+ * @constructor
+ *
+ * @param {AutoRestParameterGroupingTestService} client Reference to the service client.
+ */
+function ParameterGrouping(client) {
+ this.client = client;
+}
+
+/**
+ * Post a bunch of required parameters grouped
+ *
+ * @param {object} parameterGroupingPostRequiredParameters Additional
+ * parameters for the operation
+ *
+ * @param {number} [parameterGroupingPostRequiredParameters.body]
+ *
+ * @param {string} [parameterGroupingPostRequiredParameters.customHeader]
+ *
+ * @param {number} [parameterGroupingPostRequiredParameters.query] Query
+ * parameter with default
+ *
+ * @param {string} [parameterGroupingPostRequiredParameters.path] Path
+ * parameter
+ *
+ * @param {object} [options]
+ *
+ * @param {object} [options.customHeaders] headers that will be added to
+ * request
+ *
+ * @param {function} callback
+ *
+ * @returns {function} callback(err, result, request, response)
+ *
+ * {Error} err - The Error object if an error occurred, null otherwise.
+ *
+ * {null} [result] - The deserialized result object.
+ *
+ * {object} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {stream} [response] - The HTTP Response stream if an error did not occur.
+ */
+ParameterGrouping.prototype.postRequired = function (parameterGroupingPostRequiredParameters, options, callback) {
+ var client = this.client;
+ if(!callback && typeof options === 'function') {
+ callback = options;
+ options = null;
+ }
+ if (!callback) {
+ throw new Error('callback cannot be null.');
+ }
+ var body = (parameterGroupingPostRequiredParameters ? parameterGroupingPostRequiredParameters.body : undefined);
+ var customHeader = (parameterGroupingPostRequiredParameters ? parameterGroupingPostRequiredParameters.customHeader : undefined);
+ var query = (parameterGroupingPostRequiredParameters ? parameterGroupingPostRequiredParameters.query : undefined);
+ var path = (parameterGroupingPostRequiredParameters ? parameterGroupingPostRequiredParameters.path : undefined);
+ // Validate
+ try {
+ if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') {
+ throw new Error('this.client.acceptLanguage must be of type string.');
+ }
+ if (body === null || body === undefined || typeof body !== 'number') {
+ throw new Error('body cannot be null or undefined and it must be of type number.');
+ }
+ if (customHeader !== null && customHeader !== undefined && typeof customHeader.valueOf() !== 'string') {
+ throw new Error('customHeader must be of type string.');
+ }
+ if (query !== null && query !== undefined && typeof query !== 'number') {
+ throw new Error('query must be of type number.');
+ }
+ if (path === null || path === undefined || typeof path.valueOf() !== 'string') {
+ throw new Error('path cannot be null or undefined and it must be of type string.');
+ }
+ } catch (error) {
+ return callback(error);
+ }
+
+ // Construct URL
+ var requestUrl = this.client.baseUri +
+ '//parameterGrouping/postRequired/{path}';
+ requestUrl = requestUrl.replace('{path}', encodeURIComponent(path));
+ var queryParameters = [];
+ if (query !== null && query !== undefined) {
+ queryParameters.push('query=' + encodeURIComponent(query.toString()));
+ }
+ if (queryParameters.length > 0) {
+ requestUrl += '?' + queryParameters.join('&');
+ }
+ // trim all duplicate forward slashes in the url
+ var regex = /([^:]\/)\/+/gi;
+ requestUrl = requestUrl.replace(regex, '$1');
+
+ // Create HTTP transport objects
+ var httpRequest = new WebResource();
+ httpRequest.method = 'POST';
+ httpRequest.headers = {};
+ httpRequest.url = requestUrl;
+ // Set Headers
+ httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
+ httpRequest.headers['accept-language'] = this.client.acceptLanguage;
+ }
+ if (customHeader !== undefined && customHeader !== null) {
+ httpRequest.headers['customHeader'] = customHeader;
+ }
+ if(options) {
+ for(var headerName in options['customHeaders']) {
+ if (options['customHeaders'].hasOwnProperty(headerName)) {
+ httpRequest.headers[headerName] = options['customHeaders'][headerName];
+ }
+ }
+ }
+ httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
+ // Serialize Request
+ var requestContent = null;
+ var requestModel = null;
+ try {
+ if (body === null || body === undefined || typeof body !== 'number') {
+ throw new Error('body cannot be null or undefined and it must be of type number.');
+ }
+ requestModel = body;
+ requestContent = JSON.stringify(requestModel);
+ } catch (error) {
+ var serializationError = new Error(util.format('Error "%s" occurred in serializing the payload - "%s"', error, util.inspect(requestModel, {depth: null})));
+ return callback(serializationError);
+ }
+ httpRequest.body = requestContent;
+ httpRequest.headers['Content-Length'] = Buffer.isBuffer(requestContent) ? requestContent.length : Buffer.byteLength(requestContent, 'UTF8');
+ // Send Request
+ return client.pipeline(httpRequest, function (err, response, responseBody) {
+ if (err) {
+ return callback(err);
+ }
+ var statusCode = response.statusCode;
+ if (statusCode !== 200) {
+ var error = new Error(responseBody);
+ error.statusCode = response.statusCode;
+ error.request = httpRequest;
+ error.response = response;
+ if (responseBody === '') responseBody = null;
+ var parsedErrorResponse;
+ try {
+ parsedErrorResponse = JSON.parse(responseBody);
+ error.body = new client._models['ErrorModel']();
+ if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
+ error.body.deserialize(parsedErrorResponse);
+ }
+ } catch (defaultError) {
+ error.message = util.format('Error "%s" occurred in deserializing the responseBody - "%s" for the default response.', defaultError, responseBody);
+ return callback(error);
+ }
+ return callback(error);
+ }
+ // Create Result
+ var result = null;
+ if (responseBody === '') responseBody = null;
+
+ return callback(null, result, httpRequest, response);
+ });
+};
+
+/**
+ * Post a bunch of optional parameters grouped
+ *
+ * @param {object} [parameterGroupingPostOptionalParameters] Additional
+ * parameters for the operation
+ *
+ * @param {string} [parameterGroupingPostOptionalParameters.customHeader]
+ *
+ * @param {number} [parameterGroupingPostOptionalParameters.query] Query
+ * parameter with default
+ *
+ * @param {object} [options]
+ *
+ * @param {object} [options.customHeaders] headers that will be added to
+ * request
+ *
+ * @param {function} callback
+ *
+ * @returns {function} callback(err, result, request, response)
+ *
+ * {Error} err - The Error object if an error occurred, null otherwise.
+ *
+ * {null} [result] - The deserialized result object.
+ *
+ * {object} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {stream} [response] - The HTTP Response stream if an error did not occur.
+ */
+ParameterGrouping.prototype.postOptional = function (parameterGroupingPostOptionalParameters, options, callback) {
+ var client = this.client;
+ if(!callback && typeof options === 'function') {
+ callback = options;
+ options = null;
+ }
+ if (!callback) {
+ throw new Error('callback cannot be null.');
+ }
+ var customHeader = (parameterGroupingPostOptionalParameters ? parameterGroupingPostOptionalParameters.customHeader : undefined);
+ var query = (parameterGroupingPostOptionalParameters ? parameterGroupingPostOptionalParameters.query : undefined);
+ // Validate
+ try {
+ if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') {
+ throw new Error('this.client.acceptLanguage must be of type string.');
+ }
+ if (customHeader !== null && customHeader !== undefined && typeof customHeader.valueOf() !== 'string') {
+ throw new Error('customHeader must be of type string.');
+ }
+ if (query !== null && query !== undefined && typeof query !== 'number') {
+ throw new Error('query must be of type number.');
+ }
+ } catch (error) {
+ return callback(error);
+ }
+
+ // Construct URL
+ var requestUrl = this.client.baseUri +
+ '//parameterGrouping/postOptional';
+ var queryParameters = [];
+ if (query !== null && query !== undefined) {
+ queryParameters.push('query=' + encodeURIComponent(query.toString()));
+ }
+ if (queryParameters.length > 0) {
+ requestUrl += '?' + queryParameters.join('&');
+ }
+ // trim all duplicate forward slashes in the url
+ var regex = /([^:]\/)\/+/gi;
+ requestUrl = requestUrl.replace(regex, '$1');
+
+ // Create HTTP transport objects
+ var httpRequest = new WebResource();
+ httpRequest.method = 'POST';
+ httpRequest.headers = {};
+ httpRequest.url = requestUrl;
+ // Set Headers
+ httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
+ httpRequest.headers['accept-language'] = this.client.acceptLanguage;
+ }
+ if (customHeader !== undefined && customHeader !== null) {
+ httpRequest.headers['customHeader'] = customHeader;
+ }
+ if(options) {
+ for(var headerName in options['customHeaders']) {
+ if (options['customHeaders'].hasOwnProperty(headerName)) {
+ httpRequest.headers[headerName] = options['customHeaders'][headerName];
+ }
+ }
+ }
+ httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
+ httpRequest.body = null;
+ httpRequest.headers['Content-Length'] = 0;
+ // Send Request
+ return client.pipeline(httpRequest, function (err, response, responseBody) {
+ if (err) {
+ return callback(err);
+ }
+ var statusCode = response.statusCode;
+ if (statusCode !== 200) {
+ var error = new Error(responseBody);
+ error.statusCode = response.statusCode;
+ error.request = httpRequest;
+ error.response = response;
+ if (responseBody === '') responseBody = null;
+ var parsedErrorResponse;
+ try {
+ parsedErrorResponse = JSON.parse(responseBody);
+ error.body = new client._models['ErrorModel']();
+ if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
+ error.body.deserialize(parsedErrorResponse);
+ }
+ } catch (defaultError) {
+ error.message = util.format('Error "%s" occurred in deserializing the responseBody - "%s" for the default response.', defaultError, responseBody);
+ return callback(error);
+ }
+ return callback(error);
+ }
+ // Create Result
+ var result = null;
+ if (responseBody === '') responseBody = null;
+
+ return callback(null, result, httpRequest, response);
+ });
+};
+
+/**
+ * Post parameters from multiple different parameter groups
+ *
+ * @param {object} [firstParameterGroup] Additional parameters for the
+ * operation
+ *
+ * @param {string} [firstParameterGroup.headerOne]
+ *
+ * @param {number} [firstParameterGroup.queryOne] Query parameter with default
+ *
+ * @param {object} [secondParameterGroup] Additional parameters for the
+ * operation
+ *
+ * @param {string} [secondParameterGroup.headerTwo]
+ *
+ * @param {number} [secondParameterGroup.queryTwo] Query parameter with default
+ *
+ * @param {object} [options]
+ *
+ * @param {object} [options.customHeaders] headers that will be added to
+ * request
+ *
+ * @param {function} callback
+ *
+ * @returns {function} callback(err, result, request, response)
+ *
+ * {Error} err - The Error object if an error occurred, null otherwise.
+ *
+ * {null} [result] - The deserialized result object.
+ *
+ * {object} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {stream} [response] - The HTTP Response stream if an error did not occur.
+ */
+ParameterGrouping.prototype.postMultipleParameterGroups = function (firstParameterGroup, secondParameterGroup, options, callback) {
+ var client = this.client;
+ if(!callback && typeof options === 'function') {
+ callback = options;
+ options = null;
+ }
+ if (!callback) {
+ throw new Error('callback cannot be null.');
+ }
+ var headerOne = (firstParameterGroup ? firstParameterGroup.headerOne : undefined);
+ var queryOne = (firstParameterGroup ? firstParameterGroup.queryOne : undefined);
+ var headerTwo = (secondParameterGroup ? secondParameterGroup.headerTwo : undefined);
+ var queryTwo = (secondParameterGroup ? secondParameterGroup.queryTwo : undefined);
+ // Validate
+ try {
+ if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') {
+ throw new Error('this.client.acceptLanguage must be of type string.');
+ }
+ if (headerOne !== null && headerOne !== undefined && typeof headerOne.valueOf() !== 'string') {
+ throw new Error('headerOne must be of type string.');
+ }
+ if (queryOne !== null && queryOne !== undefined && typeof queryOne !== 'number') {
+ throw new Error('queryOne must be of type number.');
+ }
+ if (headerTwo !== null && headerTwo !== undefined && typeof headerTwo.valueOf() !== 'string') {
+ throw new Error('headerTwo must be of type string.');
+ }
+ if (queryTwo !== null && queryTwo !== undefined && typeof queryTwo !== 'number') {
+ throw new Error('queryTwo must be of type number.');
+ }
+ } catch (error) {
+ return callback(error);
+ }
+
+ // Construct URL
+ var requestUrl = this.client.baseUri +
+ '//parameterGrouping/postMultipleParameterGroups';
+ var queryParameters = [];
+ if (queryOne !== null && queryOne !== undefined) {
+ queryParameters.push('query-one=' + encodeURIComponent(queryOne.toString()));
+ }
+ if (queryTwo !== null && queryTwo !== undefined) {
+ queryParameters.push('query-two=' + encodeURIComponent(queryTwo.toString()));
+ }
+ if (queryParameters.length > 0) {
+ requestUrl += '?' + queryParameters.join('&');
+ }
+ // trim all duplicate forward slashes in the url
+ var regex = /([^:]\/)\/+/gi;
+ requestUrl = requestUrl.replace(regex, '$1');
+
+ // Create HTTP transport objects
+ var httpRequest = new WebResource();
+ httpRequest.method = 'POST';
+ httpRequest.headers = {};
+ httpRequest.url = requestUrl;
+ // Set Headers
+ httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
+ httpRequest.headers['accept-language'] = this.client.acceptLanguage;
+ }
+ if (headerOne !== undefined && headerOne !== null) {
+ httpRequest.headers['header-one'] = headerOne;
+ }
+ if (headerTwo !== undefined && headerTwo !== null) {
+ httpRequest.headers['header-two'] = headerTwo;
+ }
+ if(options) {
+ for(var headerName in options['customHeaders']) {
+ if (options['customHeaders'].hasOwnProperty(headerName)) {
+ httpRequest.headers[headerName] = options['customHeaders'][headerName];
+ }
+ }
+ }
+ httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
+ httpRequest.body = null;
+ httpRequest.headers['Content-Length'] = 0;
+ // Send Request
+ return client.pipeline(httpRequest, function (err, response, responseBody) {
+ if (err) {
+ return callback(err);
+ }
+ var statusCode = response.statusCode;
+ if (statusCode !== 200) {
+ var error = new Error(responseBody);
+ error.statusCode = response.statusCode;
+ error.request = httpRequest;
+ error.response = response;
+ if (responseBody === '') responseBody = null;
+ var parsedErrorResponse;
+ try {
+ parsedErrorResponse = JSON.parse(responseBody);
+ error.body = new client._models['ErrorModel']();
+ if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
+ error.body.deserialize(parsedErrorResponse);
+ }
+ } catch (defaultError) {
+ error.message = util.format('Error "%s" occurred in deserializing the responseBody - "%s" for the default response.', defaultError, responseBody);
+ return callback(error);
+ }
+ return callback(error);
+ }
+ // Create Result
+ var result = null;
+ if (responseBody === '') responseBody = null;
+
+ return callback(null, result, httpRequest, response);
+ });
+};
+
+
+module.exports = ParameterGrouping;
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureReport/autoRestReportServiceForAzure.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureReport/autoRestReportServiceForAzure.js
index 5f2db354a5..d0cab1fca8 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureReport/autoRestReportServiceForAzure.js
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureReport/autoRestReportServiceForAzure.js
@@ -118,7 +118,7 @@ AutoRestReportServiceForAzure.prototype.getReport = function (options, callback)
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.acceptLanguage !== null) {
+ if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.acceptLanguage;
}
if(options) {
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/apiVersionDefault.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/apiVersionDefault.js
index e24a3fa053..66c11ac130 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/apiVersionDefault.js
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/apiVersionDefault.js
@@ -92,7 +92,7 @@ ApiVersionDefault.prototype.getMethodGlobalValid = function (options, callback)
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -198,7 +198,7 @@ ApiVersionDefault.prototype.getMethodGlobalNotProvidedValid = function (options,
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -304,7 +304,7 @@ ApiVersionDefault.prototype.getPathGlobalValid = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -410,7 +410,7 @@ ApiVersionDefault.prototype.getSwaggerGlobalValid = function (options, callback)
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/apiVersionLocal.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/apiVersionLocal.js
index 4f93def19f..ec3a058dae 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/apiVersionLocal.js
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/apiVersionLocal.js
@@ -96,7 +96,7 @@ ApiVersionLocal.prototype.getMethodLocalValid = function (apiVersion, options, c
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -208,7 +208,7 @@ ApiVersionLocal.prototype.getMethodLocalNull = function (apiVersion, options, ca
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -318,7 +318,7 @@ ApiVersionLocal.prototype.getPathLocalValid = function (apiVersion, options, cal
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -428,7 +428,7 @@ ApiVersionLocal.prototype.getSwaggerLocalValid = function (apiVersion, options,
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/header.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/header.js
index 614e8abfd8..3e0a821e0f 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/header.js
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/header.js
@@ -94,10 +94,10 @@ Header.prototype.customNamedRequestId = function (fooClientRequestId, options, c
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['foo-client-request-id'] = msRestAzure.generateUuid();
- if (fooClientRequestId !== null) {
+ if (fooClientRequestId !== undefined && fooClientRequestId !== null) {
httpRequest.headers['foo-client-request-id'] = fooClientRequestId;
}
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/skipUrlEncoding.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/skipUrlEncoding.js
index 7edb673bd5..77c7d11753 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/skipUrlEncoding.js
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/skipUrlEncoding.js
@@ -95,7 +95,7 @@ SkipUrlEncoding.prototype.getMethodPathValid = function (unencodedPathParam, opt
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -204,7 +204,7 @@ SkipUrlEncoding.prototype.getPathPathValid = function (unencodedPathParam, optio
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -314,7 +314,7 @@ SkipUrlEncoding.prototype.getSwaggerPathValid = function (unencodedPathParam, op
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -424,7 +424,7 @@ SkipUrlEncoding.prototype.getMethodQueryValid = function (q1, options, callback)
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -534,7 +534,7 @@ SkipUrlEncoding.prototype.getMethodQueryNull = function (q1, options, callback)
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -644,7 +644,7 @@ SkipUrlEncoding.prototype.getPathQueryValid = function (q1, options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -757,7 +757,7 @@ SkipUrlEncoding.prototype.getSwaggerQueryValid = function (q1, options, callback
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/subscriptionInCredentials.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/subscriptionInCredentials.js
index f7adff6d39..f947659677 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/subscriptionInCredentials.js
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/subscriptionInCredentials.js
@@ -93,7 +93,7 @@ SubscriptionInCredentials.prototype.postMethodGlobalValid = function (options, c
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -201,7 +201,7 @@ SubscriptionInCredentials.prototype.postMethodGlobalNull = function (options, ca
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -312,7 +312,7 @@ SubscriptionInCredentials.prototype.postMethodGlobalNotProvidedValid = function
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -419,7 +419,7 @@ SubscriptionInCredentials.prototype.postPathGlobalValid = function (options, cal
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -526,7 +526,7 @@ SubscriptionInCredentials.prototype.postSwaggerGlobalValid = function (options,
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/subscriptionInMethod.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/subscriptionInMethod.js
index 359ec08b20..f4a8b358c3 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/subscriptionInMethod.js
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/subscriptionInMethod.js
@@ -96,7 +96,7 @@ SubscriptionInMethod.prototype.postMethodLocalValid = function (subscriptionId,
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -207,7 +207,7 @@ SubscriptionInMethod.prototype.postMethodLocalNull = function (subscriptionId, o
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -317,7 +317,7 @@ SubscriptionInMethod.prototype.postPathLocalValid = function (subscriptionId, op
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -427,7 +427,7 @@ SubscriptionInMethod.prototype.postSwaggerLocalValid = function (subscriptionId,
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/xMsClientRequestId.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/xMsClientRequestId.js
index 2ad0c2cec9..d0990195c9 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/xMsClientRequestId.js
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureSpecials/operations/xMsClientRequestId.js
@@ -89,7 +89,7 @@ XMsClientRequestId.prototype.get = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -198,10 +198,10 @@ XMsClientRequestId.prototype.paramGet = function (xMsClientRequestId, options, c
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (xMsClientRequestId !== null) {
+ if (xMsClientRequestId !== undefined && xMsClientRequestId !== null) {
httpRequest.headers['x-ms-client-request-id'] = xMsClientRequestId;
}
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Head/operations/httpSuccess.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Head/operations/httpSuccess.js
index 7d6cef2646..77b72c1034 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Head/operations/httpSuccess.js
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Head/operations/httpSuccess.js
@@ -88,7 +88,7 @@ HttpSuccess.prototype.head204 = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -191,7 +191,7 @@ HttpSuccess.prototype.head404 = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Lro/operations/lRORetrys.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Lro/operations/lRORetrys.js
index 18c146c2f3..f4b57db5b8 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Lro/operations/lRORetrys.js
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Lro/operations/lRORetrys.js
@@ -187,7 +187,7 @@ LRORetrys.prototype.beginPut201CreatingSucceeded200 = function (product, options
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -442,7 +442,7 @@ LRORetrys.prototype.beginPutAsyncRelativeRetrySucceeded = function (product, opt
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -662,7 +662,7 @@ LRORetrys.prototype.beginDeleteProvisioning202Accepted200Succeeded = function (o
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -865,7 +865,7 @@ LRORetrys.prototype.beginDelete202Retry200 = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1030,7 +1030,7 @@ LRORetrys.prototype.beginDeleteAsyncRelativeRetrySucceeded = function (options,
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1211,7 +1211,7 @@ LRORetrys.prototype.beginPost202Retry200 = function (product, options, callback)
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1410,7 +1410,7 @@ LRORetrys.prototype.beginPostAsyncRelativeRetrySucceeded = function (product, op
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Lro/operations/lROSADs.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Lro/operations/lROSADs.js
index ce72066977..3886cb2f2f 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Lro/operations/lROSADs.js
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Lro/operations/lROSADs.js
@@ -181,7 +181,7 @@ LROSADs.prototype.beginPutNonRetry400 = function (product, options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -432,7 +432,7 @@ LROSADs.prototype.beginPutNonRetry201Creating400 = function (product, options, c
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -685,7 +685,7 @@ LROSADs.prototype.beginPutAsyncRelativeRetry400 = function (product, options, ca
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -881,7 +881,7 @@ LROSADs.prototype.beginDeleteNonRetry400 = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1042,7 +1042,7 @@ LROSADs.prototype.beginDelete202NonRetry400 = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1207,7 +1207,7 @@ LROSADs.prototype.beginDeleteAsyncRelativeRetry400 = function (options, callback
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1384,7 +1384,7 @@ LROSADs.prototype.beginPostNonRetry400 = function (product, options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1577,7 +1577,7 @@ LROSADs.prototype.beginPost202NonRetry400 = function (product, options, callback
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1774,7 +1774,7 @@ LROSADs.prototype.beginPostAsyncRelativeRetry400 = function (product, options, c
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1987,7 +1987,7 @@ LROSADs.prototype.beginPutError201NoProvisioningStatePayload = function (product
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -2240,7 +2240,7 @@ LROSADs.prototype.beginPutAsyncRelativeRetryNoStatus = function (product, option
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -2474,7 +2474,7 @@ LROSADs.prototype.beginPutAsyncRelativeRetryNoStatusPayload = function (product,
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -2672,7 +2672,7 @@ LROSADs.prototype.beginDelete204Succeeded = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -2837,7 +2837,7 @@ LROSADs.prototype.beginDeleteAsyncRelativeRetryNoStatus = function (options, cal
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -3016,7 +3016,7 @@ LROSADs.prototype.beginPost202NoLocation = function (product, options, callback)
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -3213,7 +3213,7 @@ LROSADs.prototype.beginPostAsyncRelativeRetryNoPayload = function (product, opti
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -3426,7 +3426,7 @@ LROSADs.prototype.beginPut200InvalidJson = function (product, options, callback)
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -3660,7 +3660,7 @@ LROSADs.prototype.beginPutAsyncRelativeRetryInvalidHeader = function (product, o
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -3894,7 +3894,7 @@ LROSADs.prototype.beginPutAsyncRelativeRetryInvalidJsonPolling = function (produ
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -4092,7 +4092,7 @@ LROSADs.prototype.beginDelete202RetryInvalidHeader = function (options, callback
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -4255,7 +4255,7 @@ LROSADs.prototype.beginDeleteAsyncRelativeRetryInvalidHeader = function (options
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -4420,7 +4420,7 @@ LROSADs.prototype.beginDeleteAsyncRelativeRetryInvalidJsonPolling = function (op
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -4599,7 +4599,7 @@ LROSADs.prototype.beginPost202RetryInvalidHeader = function (product, options, c
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -4796,7 +4796,7 @@ LROSADs.prototype.beginPostAsyncRelativeRetryInvalidHeader = function (product,
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -4993,7 +4993,7 @@ LROSADs.prototype.beginPostAsyncRelativeRetryInvalidJsonPolling = function (prod
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Lro/operations/lROs.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Lro/operations/lROs.js
index 0bb3b6b0fa..e3cc2f2b4d 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Lro/operations/lROs.js
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Lro/operations/lROs.js
@@ -183,7 +183,7 @@ LROs.prototype.beginPut200Succeeded = function (product, options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -415,7 +415,7 @@ LROs.prototype.beginPut200SucceededNoState = function (product, options, callbac
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -649,7 +649,7 @@ LROs.prototype.beginPut202Retry200 = function (product, options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -885,7 +885,7 @@ LROs.prototype.beginPut201CreatingSucceeded200 = function (product, options, cal
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1140,7 +1140,7 @@ LROs.prototype.beginPut200UpdatingSucceeded204 = function (product, options, cal
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1376,7 +1376,7 @@ LROs.prototype.beginPut201CreatingFailed200 = function (product, options, callba
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1631,7 +1631,7 @@ LROs.prototype.beginPut200Acceptedcanceled200 = function (product, options, call
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1865,7 +1865,7 @@ LROs.prototype.beginPutNoHeaderInRetry = function (product, options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -2099,7 +2099,7 @@ LROs.prototype.beginPutAsyncRetrySucceeded = function (product, options, callbac
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -2333,7 +2333,7 @@ LROs.prototype.beginPutAsyncNoRetrySucceeded = function (product, options, callb
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -2567,7 +2567,7 @@ LROs.prototype.beginPutAsyncRetryFailed = function (product, options, callback)
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -2801,7 +2801,7 @@ LROs.prototype.beginPutAsyncNoRetrycanceled = function (product, options, callba
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -3035,7 +3035,7 @@ LROs.prototype.beginPutAsyncNoHeaderInRetry = function (product, options, callba
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -3261,7 +3261,7 @@ LROs.prototype.beginPutNonResource = function (sku, options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -3487,7 +3487,7 @@ LROs.prototype.beginPutAsyncNonResource = function (sku, options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -3709,7 +3709,7 @@ LROs.prototype.beginPutSubResource = function (product, options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -3931,7 +3931,7 @@ LROs.prototype.beginPutAsyncSubResource = function (product, options, callback)
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -4151,7 +4151,7 @@ LROs.prototype.beginDeleteProvisioning202Accepted200Succeeded = function (option
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -4374,7 +4374,7 @@ LROs.prototype.beginDeleteProvisioning202DeletingFailed200 = function (options,
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -4597,7 +4597,7 @@ LROs.prototype.beginDeleteProvisioning202Deletingcanceled200 = function (options
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -4796,7 +4796,7 @@ LROs.prototype.beginDelete204Succeeded = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -4979,7 +4979,7 @@ LROs.prototype.beginDelete202Retry200 = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -5181,7 +5181,7 @@ LROs.prototype.beginDelete202NoRetry204 = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -5365,7 +5365,7 @@ LROs.prototype.beginDeleteNoHeaderInRetry = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -5530,7 +5530,7 @@ LROs.prototype.beginDeleteAsyncNoHeaderInRetry = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -5695,7 +5695,7 @@ LROs.prototype.beginDeleteAsyncRetrySucceeded = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -5860,7 +5860,7 @@ LROs.prototype.beginDeleteAsyncNoRetrySucceeded = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -6025,7 +6025,7 @@ LROs.prototype.beginDeleteAsyncRetryFailed = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -6190,7 +6190,7 @@ LROs.prototype.beginDeleteAsyncRetrycanceled = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -6373,7 +6373,7 @@ LROs.prototype.beginPost200WithPayload = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -6592,7 +6592,7 @@ LROs.prototype.beginPost202Retry200 = function (product, options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -6805,7 +6805,7 @@ LROs.prototype.beginPost202NoRetry204 = function (product, options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -7039,7 +7039,7 @@ LROs.prototype.beginPostAsyncRetrySucceeded = function (product, options, callba
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -7273,7 +7273,7 @@ LROs.prototype.beginPostAsyncNoRetrySucceeded = function (product, options, call
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -7489,7 +7489,7 @@ LROs.prototype.beginPostAsyncRetryFailed = function (product, options, callback)
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -7686,7 +7686,7 @@ LROs.prototype.beginPostAsyncRetrycanceled = function (product, options, callbac
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Lro/operations/lROsCustomHeader.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Lro/operations/lROsCustomHeader.js
index 1745e18289..884246c89f 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Lro/operations/lROsCustomHeader.js
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Lro/operations/lROsCustomHeader.js
@@ -189,7 +189,7 @@ LROsCustomHeader.prototype.beginPutAsyncRetrySucceeded = function (product, opti
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -427,7 +427,7 @@ LROsCustomHeader.prototype.beginPut201CreatingSucceeded200 = function (product,
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -664,7 +664,7 @@ LROsCustomHeader.prototype.beginPost202Retry200 = function (product, options, ca
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -865,7 +865,7 @@ LROsCustomHeader.prototype.beginPostAsyncRetrySucceeded = function (product, opt
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Paging/operations/paging.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Paging/operations/paging.js
index 246ff665c1..5a39fbea51 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Paging/operations/paging.js
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/Paging/operations/paging.js
@@ -89,7 +89,7 @@ Paging.prototype.getSinglePages = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -211,7 +211,7 @@ Paging.prototype.getMultiplePages = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -334,7 +334,7 @@ Paging.prototype.getMultiplePagesRetryFirst = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -458,7 +458,7 @@ Paging.prototype.getMultiplePagesRetrySecond = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -580,7 +580,7 @@ Paging.prototype.getSinglePagesFailure = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -702,7 +702,7 @@ Paging.prototype.getMultiplePagesFailure = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -824,7 +824,7 @@ Paging.prototype.getMultiplePagesFailureUri = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -948,7 +948,7 @@ Paging.prototype.getSinglePagesNext = function (nextPageLink, options, callback)
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1072,7 +1072,7 @@ Paging.prototype.getMultiplePagesNext = function (nextPageLink, options, callbac
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1197,7 +1197,7 @@ Paging.prototype.getMultiplePagesRetryFirstNext = function (nextPageLink, option
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1323,7 +1323,7 @@ Paging.prototype.getMultiplePagesRetrySecondNext = function (nextPageLink, optio
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1447,7 +1447,7 @@ Paging.prototype.getSinglePagesFailureNext = function (nextPageLink, options, ca
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1571,7 +1571,7 @@ Paging.prototype.getMultiplePagesFailureNext = function (nextPageLink, options,
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1695,7 +1695,7 @@ Paging.prototype.getMultiplePagesFailureUriNext = function (nextPageLink, option
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/ResourceFlattening/autoRestResourceFlatteningTestService.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/ResourceFlattening/autoRestResourceFlatteningTestService.js
index f14bba46c2..7ceb7bc1a3 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/ResourceFlattening/autoRestResourceFlatteningTestService.js
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/ResourceFlattening/autoRestResourceFlatteningTestService.js
@@ -120,7 +120,7 @@ AutoRestResourceFlatteningTestService.prototype.putArray = function (resourceArr
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.acceptLanguage !== null) {
+ if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.acceptLanguage;
}
if(options) {
@@ -249,7 +249,7 @@ AutoRestResourceFlatteningTestService.prototype.getArray = function (options, ca
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.acceptLanguage !== null) {
+ if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.acceptLanguage;
}
if(options) {
@@ -384,7 +384,7 @@ AutoRestResourceFlatteningTestService.prototype.putDictionary = function (resour
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.acceptLanguage !== null) {
+ if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.acceptLanguage;
}
if(options) {
@@ -513,7 +513,7 @@ AutoRestResourceFlatteningTestService.prototype.getDictionary = function (option
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.acceptLanguage !== null) {
+ if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.acceptLanguage;
}
if(options) {
@@ -663,7 +663,7 @@ AutoRestResourceFlatteningTestService.prototype.putResourceCollection = function
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.acceptLanguage !== null) {
+ if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.acceptLanguage;
}
if(options) {
@@ -782,7 +782,7 @@ AutoRestResourceFlatteningTestService.prototype.getResourceCollection = function
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.acceptLanguage !== null) {
+ if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.acceptLanguage;
}
if(options) {
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/StorageManagementClient/operations/storageAccounts.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/StorageManagementClient/operations/storageAccounts.js
index dddf5f6925..7f52566a2f 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/StorageManagementClient/operations/storageAccounts.js
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/StorageManagementClient/operations/storageAccounts.js
@@ -109,7 +109,7 @@ StorageAccounts.prototype.checkNameAvailability = function (accountName, options
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -386,7 +386,7 @@ StorageAccounts.prototype.beginCreate = function (resourceGroupName, accountName
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -546,7 +546,7 @@ StorageAccounts.prototype.deleteMethod = function (resourceGroupName, accountNam
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -670,7 +670,7 @@ StorageAccounts.prototype.getProperties = function (resourceGroupName, accountNa
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -854,7 +854,7 @@ StorageAccounts.prototype.update = function (resourceGroupName, accountName, par
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1012,7 +1012,7 @@ StorageAccounts.prototype.listKeys = function (resourceGroupName, accountName, o
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1144,7 +1144,7 @@ StorageAccounts.prototype.list = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1284,7 +1284,7 @@ StorageAccounts.prototype.listByResourceGroup = function (resourceGroupName, opt
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1438,7 +1438,7 @@ StorageAccounts.prototype.regenerateKey = function (resourceGroupName, accountNa
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1580,7 +1580,7 @@ StorageAccounts.prototype.listNext = function (nextPageLink, options, callback)
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
@@ -1707,7 +1707,7 @@ StorageAccounts.prototype.listByResourceGroupNext = function (nextPageLink, opti
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/StorageManagementClient/operations/usageOperations.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/StorageManagementClient/operations/usageOperations.js
index 2a122928ef..3e8d2ff0cc 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/StorageManagementClient/operations/usageOperations.js
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/StorageManagementClient/operations/usageOperations.js
@@ -98,7 +98,7 @@ UsageOperations.prototype.list = function (options, callback) {
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/operations/group.js b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/operations/group.js
index 9920e851b3..beaffd9e15 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/operations/group.js
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/operations/group.js
@@ -103,7 +103,7 @@ Group.prototype.getSampleResourceGroup = function (resourceGroupName, options, c
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
- if (this.client.acceptLanguage !== null) {
+ if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS/AutoRest.Generator.Azure.NodeJS.csproj b/AutoRest/Generators/NodeJS/Azure.NodeJS/AutoRest.Generator.Azure.NodeJS.csproj
index 3b01f3d2e3..57ba41e842 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS/AutoRest.Generator.Azure.NodeJS.csproj
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS/AutoRest.Generator.Azure.NodeJS.csproj
@@ -83,4 +83,4 @@
-
+
\ No newline at end of file
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS/AzureNodeJSCodeGenerator.cs b/AutoRest/Generators/NodeJS/Azure.NodeJS/AzureNodeJSCodeGenerator.cs
index 2de1e0aa26..8973e81a41 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS/AzureNodeJSCodeGenerator.cs
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS/AzureNodeJSCodeGenerator.cs
@@ -57,6 +57,9 @@ public override string ImplementationFileExtension
public override void NormalizeClientModel(ServiceClient serviceClient)
{
//please do not change the following sequence as it may have undesirable results.
+
+ //TODO: Why is this list duplicated from AzureCodeGenerator.NormalizeClientModel?
+
Settings.AddCredentials = true;
AzureCodeGenerator.UpdateHeadMethods(serviceClient);
AzureCodeGenerator.ParseODataExtension(serviceClient);
@@ -64,6 +67,7 @@ public override void NormalizeClientModel(ServiceClient serviceClient)
AzureCodeGenerator.AddPageableMethod(serviceClient);
AzureCodeGenerator.AddAzureProperties(serviceClient);
AzureCodeGenerator.SetDefaultResponses(serviceClient);
+ AzureCodeGenerator.AddParameterGroups(serviceClient);
base.NormalizeClientModel(serviceClient);
AzureCodeGenerator.AddLongRunningOperations(serviceClient);
NormalizeApiVersion(serviceClient);
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS/GlobalSuppressions.cs b/AutoRest/Generators/NodeJS/Azure.NodeJS/GlobalSuppressions.cs
index a0f52b5f1f..b746531006 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS/GlobalSuppressions.cs
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS/GlobalSuppressions.cs
@@ -22,3 +22,4 @@
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Microsoft.Rest.Generator.Utilities.IndentedStringBuilder.AppendLine(System.String)", Scope = "member", Target = "Microsoft.Rest.Generator.Azure.NodeJS.AzureMethodTemplateModel.#InitializeResponseBody",
Justification = "Required for Azure customization.")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Microsoft.Rest.Generator.Utilities.IndentedStringBuilder.AppendLine(System.String)", Scope = "member", Target = "Microsoft.Rest.Generator.Azure.NodeJS.AzureMethodTemplateModel.#InitializeResult")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.Rest.Generator.NodeJS")]
diff --git a/AutoRest/Generators/NodeJS/Azure.NodeJS/TemplateModels/AzureMethodTemplateModel.cs b/AutoRest/Generators/NodeJS/Azure.NodeJS/TemplateModels/AzureMethodTemplateModel.cs
index 30f49dc765..aa1cc39774 100644
--- a/AutoRest/Generators/NodeJS/Azure.NodeJS/TemplateModels/AzureMethodTemplateModel.cs
+++ b/AutoRest/Generators/NodeJS/Azure.NodeJS/TemplateModels/AzureMethodTemplateModel.cs
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
+using System;
using Microsoft.Rest.Generator.ClientModel;
using Microsoft.Rest.Generator.NodeJS;
using Microsoft.Rest.Generator.Utilities;
@@ -12,6 +13,11 @@ public class AzureMethodTemplateModel : MethodTemplateModel
public AzureMethodTemplateModel(Method source, ServiceClient serviceClient)
: base(source, serviceClient)
{
+ if (source == null)
+ {
+ throw new ArgumentNullException("source");
+ }
+
this.ClientRequestIdString = AzureCodeGenerator.GetClientRequestIdString(source);
this.RequestIdString = AzureCodeGenerator.GetRequestIdString(source);
}
diff --git a/AutoRest/Generators/NodeJS/NodeJS.Tests/Expected/AcceptanceTests/Header/operations/header.js b/AutoRest/Generators/NodeJS/NodeJS.Tests/Expected/AcceptanceTests/Header/operations/header.js
index 1af4ac7558..f31d7ead4c 100644
--- a/AutoRest/Generators/NodeJS/NodeJS.Tests/Expected/AcceptanceTests/Header/operations/header.js
+++ b/AutoRest/Generators/NodeJS/NodeJS.Tests/Expected/AcceptanceTests/Header/operations/header.js
@@ -86,7 +86,7 @@ Header.prototype.paramExistingKey = function (userAgent, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (userAgent !== null) {
+ if (userAgent !== undefined && userAgent !== null) {
httpRequest.headers['User-Agent'] = userAgent;
}
if(options) {
@@ -272,7 +272,7 @@ Header.prototype.paramProtectedKey = function (contentType, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (contentType !== null) {
+ if (contentType !== undefined && contentType !== null) {
httpRequest.headers['Content-Type'] = contentType;
}
if(options) {
@@ -464,10 +464,10 @@ Header.prototype.paramInteger = function (scenario, value, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
- if (value !== null) {
+ if (value !== undefined && value !== null) {
httpRequest.headers['value'] = value.toString();
}
if(options) {
@@ -567,7 +567,7 @@ Header.prototype.responseInteger = function (scenario, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
if(options) {
@@ -673,10 +673,10 @@ Header.prototype.paramLong = function (scenario, value, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
- if (value !== null) {
+ if (value !== undefined && value !== null) {
httpRequest.headers['value'] = value.toString();
}
if(options) {
@@ -776,7 +776,7 @@ Header.prototype.responseLong = function (scenario, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
if(options) {
@@ -882,10 +882,10 @@ Header.prototype.paramFloat = function (scenario, value, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
- if (value !== null) {
+ if (value !== undefined && value !== null) {
httpRequest.headers['value'] = value.toString();
}
if(options) {
@@ -985,7 +985,7 @@ Header.prototype.responseFloat = function (scenario, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
if(options) {
@@ -1091,10 +1091,10 @@ Header.prototype.paramDouble = function (scenario, value, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
- if (value !== null) {
+ if (value !== undefined && value !== null) {
httpRequest.headers['value'] = value.toString();
}
if(options) {
@@ -1194,7 +1194,7 @@ Header.prototype.responseDouble = function (scenario, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
if(options) {
@@ -1300,10 +1300,10 @@ Header.prototype.paramBool = function (scenario, value, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
- if (value !== null) {
+ if (value !== undefined && value !== null) {
httpRequest.headers['value'] = value.toString();
}
if(options) {
@@ -1403,7 +1403,7 @@ Header.prototype.responseBool = function (scenario, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
if(options) {
@@ -1511,10 +1511,10 @@ Header.prototype.paramString = function (scenario, value, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
- if (value !== null) {
+ if (value !== undefined && value !== null) {
httpRequest.headers['value'] = value;
}
if(options) {
@@ -1615,7 +1615,7 @@ Header.prototype.responseString = function (scenario, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
if(options) {
@@ -1723,10 +1723,10 @@ Header.prototype.paramDate = function (scenario, value, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
- if (value !== null) {
+ if (value !== undefined && value !== null) {
httpRequest.headers['value'] = msRest.serializeObject(value).replace(/[Tt].*[Zz]/, '');
}
if(options) {
@@ -1826,7 +1826,7 @@ Header.prototype.responseDate = function (scenario, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
if(options) {
@@ -1935,10 +1935,10 @@ Header.prototype.paramDatetime = function (scenario, value, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
- if (value !== null) {
+ if (value !== undefined && value !== null) {
httpRequest.headers['value'] = msRest.serializeObject(value);
}
if(options) {
@@ -2039,7 +2039,7 @@ Header.prototype.responseDatetime = function (scenario, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
if(options) {
@@ -2148,10 +2148,10 @@ Header.prototype.paramDatetimeRfc1123 = function (scenario, value, options, call
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
- if (value !== null) {
+ if (value !== undefined && value !== null) {
httpRequest.headers['value'] = value.toUTCString();
}
if(options) {
@@ -2252,7 +2252,7 @@ Header.prototype.responseDatetimeRfc1123 = function (scenario, options, callback
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
if(options) {
@@ -2359,10 +2359,10 @@ Header.prototype.paramDuration = function (scenario, value, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
- if (value !== null) {
+ if (value !== undefined && value !== null) {
httpRequest.headers['value'] = value.toISOString();
}
if(options) {
@@ -2462,7 +2462,7 @@ Header.prototype.responseDuration = function (scenario, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
if(options) {
@@ -2568,10 +2568,10 @@ Header.prototype.paramByte = function (scenario, value, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
- if (value !== null) {
+ if (value !== undefined && value !== null) {
httpRequest.headers['value'] = msRest.serializeObject(value);
}
if(options) {
@@ -2671,7 +2671,7 @@ Header.prototype.responseByte = function (scenario, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
if(options) {
@@ -2781,10 +2781,10 @@ Header.prototype.paramEnum = function (scenario, value, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
- if (value !== null) {
+ if (value !== undefined && value !== null) {
httpRequest.headers['value'] = value;
}
if(options) {
@@ -2884,7 +2884,7 @@ Header.prototype.responseEnum = function (scenario, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (scenario !== null) {
+ if (scenario !== undefined && scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
if(options) {
diff --git a/AutoRest/Generators/NodeJS/NodeJS.Tests/Expected/AcceptanceTests/RequiredOptional/operations/explicit.js b/AutoRest/Generators/NodeJS/NodeJS.Tests/Expected/AcceptanceTests/RequiredOptional/operations/explicit.js
index defa7c72c5..53b8fe5acd 100644
--- a/AutoRest/Generators/NodeJS/NodeJS.Tests/Expected/AcceptanceTests/RequiredOptional/operations/explicit.js
+++ b/AutoRest/Generators/NodeJS/NodeJS.Tests/Expected/AcceptanceTests/RequiredOptional/operations/explicit.js
@@ -564,7 +564,7 @@ Explicit.prototype.postRequiredIntegerHeader = function (headerParameter, option
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (headerParameter !== null) {
+ if (headerParameter !== undefined && headerParameter !== null) {
httpRequest.headers['headerParameter'] = headerParameter.toString();
}
if(options) {
@@ -680,7 +680,7 @@ Explicit.prototype.postOptionalIntegerHeader = function (headerParameter, option
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (headerParameter !== null) {
+ if (headerParameter !== undefined && headerParameter !== null) {
httpRequest.headers['headerParameter'] = headerParameter.toString();
}
if(options) {
@@ -1259,7 +1259,7 @@ Explicit.prototype.postRequiredStringHeader = function (headerParameter, options
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (headerParameter !== null) {
+ if (headerParameter !== undefined && headerParameter !== null) {
httpRequest.headers['headerParameter'] = headerParameter;
}
if(options) {
@@ -1375,7 +1375,7 @@ Explicit.prototype.postOptionalStringHeader = function (bodyParameter, options,
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (bodyParameter !== null) {
+ if (bodyParameter !== undefined && bodyParameter !== null) {
httpRequest.headers['bodyParameter'] = bodyParameter;
}
if(options) {
@@ -2471,7 +2471,7 @@ Explicit.prototype.postRequiredArrayHeader = function (headerParameter, options,
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (headerParameter !== null) {
+ if (headerParameter !== undefined && headerParameter !== null) {
httpRequest.headers['headerParameter'] = headerParameter.toString();
}
if(options) {
@@ -2591,7 +2591,7 @@ Explicit.prototype.postOptionalArrayHeader = function (headerParameter, options,
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (headerParameter !== null) {
+ if (headerParameter !== undefined && headerParameter !== null) {
httpRequest.headers['headerParameter'] = headerParameter.toString();
}
if(options) {
diff --git a/AutoRest/Generators/NodeJS/NodeJS.Tests/Expected/AcceptanceTests/RequiredOptional/operations/implicit.js b/AutoRest/Generators/NodeJS/NodeJS.Tests/Expected/AcceptanceTests/RequiredOptional/operations/implicit.js
index 73f7fd2a12..591005bf83 100644
--- a/AutoRest/Generators/NodeJS/NodeJS.Tests/Expected/AcceptanceTests/RequiredOptional/operations/implicit.js
+++ b/AutoRest/Generators/NodeJS/NodeJS.Tests/Expected/AcceptanceTests/RequiredOptional/operations/implicit.js
@@ -301,7 +301,7 @@ Implicit.prototype.putOptionalHeader = function (queryParameter, options, callba
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
- if (queryParameter !== null) {
+ if (queryParameter !== undefined && queryParameter !== null) {
httpRequest.headers['queryParameter'] = queryParameter;
}
if(options) {
diff --git a/AutoRest/Generators/NodeJS/NodeJS/ClientModelExtensions.cs b/AutoRest/Generators/NodeJS/NodeJS/ClientModelExtensions.cs
index cadd8a6233..2a2ec968be 100644
--- a/AutoRest/Generators/NodeJS/NodeJS/ClientModelExtensions.cs
+++ b/AutoRest/Generators/NodeJS/NodeJS/ClientModelExtensions.cs
@@ -9,6 +9,8 @@
using System.Text.RegularExpressions;
namespace Microsoft.Rest.Generator.NodeJS.TemplateModels
{
+ using System.Collections.Generic;
+
public static class ClientModelExtensions
{
public static string GetHttpMethod(this HttpMethod method)
diff --git a/AutoRest/Generators/NodeJS/NodeJS/GlobalSuppressions.cs b/AutoRest/Generators/NodeJS/NodeJS/GlobalSuppressions.cs
index 0e565ca744..6a902650a6 100644
--- a/AutoRest/Generators/NodeJS/NodeJS/GlobalSuppressions.cs
+++ b/AutoRest/Generators/NodeJS/NodeJS/GlobalSuppressions.cs
@@ -147,3 +147,4 @@
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Microsoft.Rest.Generator.Utilities.IndentedStringBuilder.AppendLine(System.String)", Scope = "member", Target = "Microsoft.Rest.Generator.NodeJS.MethodTemplateModel.#ValidationString")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Microsoft.Rest.Generator.Utilities.IndentedStringBuilder.AppendLine(System.String)", Scope = "member", Target = "Microsoft.Rest.Generator.NodeJS.TemplateModels.ClientModelExtensions.#ValidateCompositeType(Microsoft.Rest.Generator.NodeJS.IScopeProvider,System.String,System.Boolean)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.Rest.Generator.NodeJS.ModelTemplateModel.#isSpecial(Microsoft.Rest.Generator.ClientModel.IType)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Scope = "member", Target = "Microsoft.Rest.Generator.NodeJS.MethodTemplateModel.#GroupedParameterTemplateModels")]
diff --git a/AutoRest/Generators/NodeJS/NodeJS/TemplateModels/MethodTemplateModel.cs b/AutoRest/Generators/NodeJS/NodeJS/TemplateModels/MethodTemplateModel.cs
index c29732f333..d1a4fa3433 100644
--- a/AutoRest/Generators/NodeJS/NodeJS/TemplateModels/MethodTemplateModel.cs
+++ b/AutoRest/Generators/NodeJS/NodeJS/TemplateModels/MethodTemplateModel.cs
@@ -22,7 +22,9 @@ public MethodTemplateModel(Method source, ServiceClient serviceClient)
{
this.LoadFrom(source);
ParameterTemplateModels = new List();
+ GroupedParameterTemplateModels = new List();
source.Parameters.ForEach(p => ParameterTemplateModels.Add(new ParameterTemplateModel(p)));
+
ServiceClient = serviceClient;
if (source.Group != null)
{
@@ -38,7 +40,9 @@ public MethodTemplateModel(Method source, ServiceClient serviceClient)
public ServiceClient ServiceClient { get; set; }
- public List ParameterTemplateModels { get; private set; }
+ protected List ParameterTemplateModels { get; private set; }
+
+ protected List GroupedParameterTemplateModels { get; private set; }
public IScopeProvider Scope
{
@@ -424,7 +428,7 @@ public string ValidationString
get
{
var builder = new IndentedStringBuilder(" ");
- foreach (var parameter in ParameterTemplateModels)
+ foreach (var parameter in LogicalParameters)
{
if ((HttpMethod == HttpMethod.Patch && parameter.Type is CompositeType))
{
@@ -511,7 +515,10 @@ public string DeserializeResponse(IType type, string valueReference = "result",
///
public ParameterTemplateModel RequestBody
{
- get { return ParameterTemplateModels.FirstOrDefault(p => p.Location == ParameterLocation.Body); }
+ get
+ {
+ return this.Body != null ? new ParameterTemplateModel(this.Body) : null;
+ }
}
///
@@ -564,7 +571,7 @@ private static void AddQueryParametersToUrl(string variableName, IndentedStringB
/// True if a query string is possible given the method parameters, otherwise false
protected virtual bool HasQueryParameters()
{
- return ParameterTemplateModels.Any(p => p.Location == ParameterLocation.Query);
+ return LogicalParameters.Any(p => p.Location == ParameterLocation.Query);
}
///
@@ -580,7 +587,7 @@ protected virtual void BuildQueryParameterArray(IndentedStringBuilder builder)
}
builder.AppendLine("var queryParameters = [];");
- foreach (var queryParameter in ParameterTemplateModels
+ foreach (var queryParameter in LogicalParameters
.Where(p => p.Location == ParameterLocation.Query))
{
var queryAddFormat = "queryParameters.push('{0}=' + encodeURIComponent({1}));";
@@ -616,7 +623,7 @@ protected virtual void BuildPathParameters(string variableName, IndentedStringBu
throw new ArgumentNullException("builder");
}
- foreach (var pathParameter in ParameterTemplateModels.Where(p => p.Location == ParameterLocation.Path))
+ foreach (var pathParameter in LogicalParameters.Where(p => p.Location == ParameterLocation.Path))
{
var pathReplaceFormat = "{0} = {0}.replace('{{{1}}}', encodeURIComponent({2}));";
if (pathParameter.SkipUrlEncoding())
diff --git a/AutoRest/Generators/NodeJS/NodeJS/TemplateModels/ModelTemplateModel.cs b/AutoRest/Generators/NodeJS/NodeJS/TemplateModels/ModelTemplateModel.cs
index a532b823a7..27e210d9e9 100644
--- a/AutoRest/Generators/NodeJS/NodeJS/TemplateModels/ModelTemplateModel.cs
+++ b/AutoRest/Generators/NodeJS/NodeJS/TemplateModels/ModelTemplateModel.cs
@@ -67,6 +67,11 @@ public IEnumerable ComposedProperties
}
}
+ public IEnumerable SerializableProperties
+ {
+ get { return this.Properties.Where(p => !string.IsNullOrEmpty(p.SerializedName)); }
+ }
+
public bool IsPolymorphic
{
get
diff --git a/AutoRest/Generators/NodeJS/NodeJS/Templates/MethodTemplate.cshtml b/AutoRest/Generators/NodeJS/NodeJS/Templates/MethodTemplate.cshtml
index 50517b8c8a..cbc758edae 100644
--- a/AutoRest/Generators/NodeJS/NodeJS/Templates/MethodTemplate.cshtml
+++ b/AutoRest/Generators/NodeJS/NodeJS/Templates/MethodTemplate.cshtml
@@ -1,5 +1,7 @@
@using System
+@using System.Globalization
@using System.Linq;
+@using Microsoft.Rest.Generator
@using Microsoft.Rest.Generator.ClientModel
@using Microsoft.Rest.Generator.Utilities
@using Microsoft.Rest.Generator.NodeJS
@@ -52,7 +54,15 @@
if (!callback) {
throw new Error('callback cannot be null.');
}
- @if (Model.ParameterTemplateModels.Any())
+ @foreach (var mapping in Model.InputParameterMappings)
+ {
+ @:var @(mapping.OutputParameter.Name) = @string.Format(CultureInfo.InvariantCulture,
+ "({0} ? {0}.{1} : undefined)",
+ mapping.InputParameter.Name,
+ mapping.InputParameterProperty);
+ }
+
+ @if (Model.LogicalParameters.Any())
{
var validationBlock = Model.ValidationString;
if (!string.IsNullOrWhiteSpace(validationBlock))
@@ -89,9 +99,9 @@
// Set Headers
@(Model.SetDefaultHeaders)
- @foreach (var parameter in Model.Parameters.Where(p => p.Location == ParameterLocation.Header))
+ @foreach (var parameter in Model.LogicalParameters.Where(p => p.Location == ParameterLocation.Header))
{
- @:if (@(parameter.Name) !== null) {
+ @:if (@(parameter.Name) !== undefined && @(parameter.Name) !== null) {
@: httpRequest.headers['@(parameter.SerializedName)'] = @parameter.Type.ToString(parameter.Name);
@:}
}
diff --git a/AutoRest/Generators/NodeJS/NodeJS/Templates/ModelTemplate.cshtml b/AutoRest/Generators/NodeJS/NodeJS/Templates/ModelTemplate.cshtml
index f453c89b8b..45b101d756 100644
--- a/AutoRest/Generators/NodeJS/NodeJS/Templates/ModelTemplate.cshtml
+++ b/AutoRest/Generators/NodeJS/NodeJS/Templates/ModelTemplate.cshtml
@@ -64,14 +64,16 @@ if (Model.BaseModelType != null)
}
}
@EmptyLine
-/**
- * Validate the payload against the @Model.Name schema
- *
- * @@param {JSON} payload
- *
- */
-@(Model.Name).prototype.serialize = function () {
-@{
+@if(Model.SerializableProperties.Any())
+{
+@:/**
+@: * Validate the payload against the @Model.Name schema
+@: *
+@: * @@param {JSON} payload
+@: *
+@: */
+@:@(Model.Name).prototype.serialize = function () {
+{
if (Model.BaseModelType != null)
{
@:var payload = @(Model.Name)['super_'].prototype.serialize.call(this);
@@ -80,7 +82,7 @@ if (Model.BaseModelType != null)
{
@:var payload = {};
}
- var serializationPropertyList = new List(Model.Properties);
+ var serializationPropertyList = new List(Model.SerializableProperties);
for (int i = 0; i < serializationPropertyList.Count; i++)
{
@:@(Model.SerializeProperty("this", "payload", serializationPropertyList[i]))
@@ -92,16 +94,17 @@ if (Model.BaseModelType != null)
@EmptyLine
@:return payload;
}
-};
+@:};
@EmptyLine
-/**
- * Deserialize the instance to @Model.Name schema
- *
- * @@param {JSON} instance
- *
- */
-@(Model.Name).prototype.deserialize = function (instance) {
- @{
+
+@:/**
+@: * Deserialize the instance to @Model.Name schema
+@: *
+@: * @@param {JSON} instance
+@: *
+@: */
+@:@(Model.Name).prototype.deserialize = function (instance) {
+ {
if (Model.BaseModelType != null)
{
@:@(Model.Name)['super_'].prototype.deserialize.call(this, instance);
@@ -110,7 +113,7 @@ if (Model.BaseModelType != null)
if (properties.Count > 0)
{
@:if (instance) {
- var propertiesList = new List(Model.Properties);
+ var propertiesList = new List(Model.SerializableProperties);
for (int i = 0; i < propertiesList.Count; i++)
{
@:@(Model.DeserializeProperty("this", "instance", propertiesList[i]))
@@ -123,7 +126,8 @@ if (Model.BaseModelType != null)
}
}
@EmptyLine
- return this;
-};
+ @:return this;
+@:};
+}
@EmptyLine
module.exports = @(Model.Name);
\ No newline at end of file
diff --git a/AutoRest/Generators/Ruby/Ruby/TemplateModels/MethodTemplateModel.cs b/AutoRest/Generators/Ruby/Ruby/TemplateModels/MethodTemplateModel.cs
index 6efb3834be..37650df85e 100644
--- a/AutoRest/Generators/Ruby/Ruby/TemplateModels/MethodTemplateModel.cs
+++ b/AutoRest/Generators/Ruby/Ruby/TemplateModels/MethodTemplateModel.cs
@@ -146,13 +146,14 @@ public string MethodParameterInvocation
}
///
- /// Get the parameters that are actually method parameters in the order they apopear in the method signatur
+ /// Get the parameters that are actually method parameters in the order they appear in the method signature
/// exclude global parameters
///
public IEnumerable LocalParameters
{
get
{
+ //Omit parameter group parameters for now since AutoRest-Ruby doesn't support them
return
ParameterTemplateModels.Where(
p => p != null && p.ClientProperty == null && !string.IsNullOrWhiteSpace(p.Name))
@@ -161,7 +162,7 @@ public IEnumerable LocalParameters
}
///
- /// Gets the return type name for the underlyign interface method
+ /// Gets the return type name for the underlying interface method
///
public virtual string OperationResponseReturnTypeString
{
diff --git a/AutoRest/TestServer/server/SwaggerBATServer.njsproj b/AutoRest/TestServer/server/SwaggerBATServer.njsproj
index b3862181be..2639091d9f 100644
--- a/AutoRest/TestServer/server/SwaggerBATServer.njsproj
+++ b/AutoRest/TestServer/server/SwaggerBATServer.njsproj
@@ -45,6 +45,7 @@
+
diff --git a/AutoRest/TestServer/server/app.js b/AutoRest/TestServer/server/app.js
index 7a0a0726e4..dda24f6cc6 100644
--- a/AutoRest/TestServer/server/app.js
+++ b/AutoRest/TestServer/server/app.js
@@ -32,6 +32,7 @@ var paging = require('./routes/paging');
var resourceFlatten = require('./routes/resource-flatten');
var azureUrl = require('./routes/azureUrl');
var azureSpecial = require('./routes/azureSpecials');
+var parameterGrouping = require('./routes/azureParameterGrouping.js');
var util = require('util');
var app = express();
@@ -446,6 +447,7 @@ app.use('/azure/resource-flatten', new resourceFlatten(azurecoverage).router);
app.use('/azurespecials', new azureSpecial(azurecoverage).router);
app.use('/report', new report(coverage, azurecoverage).router);
app.use('/subscriptions', new azureUrl(azurecoverage).router);
+app.use('/parameterGrouping', new parameterGrouping(azurecoverage).router);
// catch 404 and forward to error handler
app.use(function(req, res, next) {
diff --git a/AutoRest/TestServer/server/routes/azureParameterGrouping.js b/AutoRest/TestServer/server/routes/azureParameterGrouping.js
new file mode 100644
index 0000000000..8387ed177b
--- /dev/null
+++ b/AutoRest/TestServer/server/routes/azureParameterGrouping.js
@@ -0,0 +1,50 @@
+var express = require('express');
+var router = express.Router();
+var util = require('util');
+var utils = require('../util/utils')
+
+var parameterGrouping = function(coverage) {
+ coverage['postParameterGroupingOptionalParameters'] = 0;
+ coverage['postParameterGroupingRequiredParameters'] = 0;
+ coverage['postParameterGroupingMultipleParameterGroups'] = 0;
+
+ router.post('/postRequired/:path', function(req, res, next) {
+ if (req.body === 1234 && req.params.path === 'path' &&
+ (req.get('customHeader') === 'header' || req.get('customHeader') === undefined) &&
+ (req.query['query'] === '21' || req.query['query'] === undefined)) {
+ coverage['postParameterGroupingRequiredParameters']++;
+ res.status(200).end();
+ } else {
+ utils.send400(res, next, "Did not like the values in the req. Body: " + util.inspect(req.body) +
+ ", Path: " + req.params.path + ", customHeader: " + req.get('customHeader') + ", query: " + req.query['query']);
+ }
+ });
+
+ router.post('/postOptional', function(req, res, next) {
+ if ((req.get('customHeader') === 'header' || req.get('customHeader') === undefined) &&
+ (req.query['query'] === '21' || req.query['query'] === undefined)) {
+ coverage['postParameterGroupingOptionalParameters']++;
+ res.status(200).end();
+ } else {
+ utils.send400(res, next, "Did not like the values in the req. header: " + req.get('customHeader') + ", query: " + req.query['query']);
+ }
+ });
+
+ router.post('/postMultipleParameterGroups', function(req, res, next) {
+ if ((req.get('headerOne') === 'header' || req.get('headerOne') === undefined) &&
+ (req.query['queryOne'] === '21' || req.query['queryOne'] === undefined) &&
+ (req.query['headerTwo'] === 'header2' || req.query['headerTwo'] === undefined) &&
+ (req.query['queryTwo'] === '42' || req.query['queryTwo'] === undefined)
+ ) {
+ coverage['postParameterGroupingMultipleParameterGroups']++;
+ res.status(200).end();
+ } else {
+ utils.send400(res, next, "Did not like the values in the req. headerOne: " + req.get('headerOne') + ", queryOne: " + req.query['queryOne'] +
+ ", headerTwo: " + req.get('headerTwo') + ", queryTwo: " + req.get('queryTwo'));
+ }
+ });
+}
+
+parameterGrouping.prototype.router = router;
+
+module.exports = parameterGrouping;
\ No newline at end of file
diff --git a/AutoRest/TestServer/swagger/azure-parameter-grouping.json b/AutoRest/TestServer/swagger/azure-parameter-grouping.json
new file mode 100644
index 0000000000..d5ffc5c635
--- /dev/null
+++ b/AutoRest/TestServer/swagger/azure-parameter-grouping.json
@@ -0,0 +1,191 @@
+{
+ "swagger": "2.0",
+ "info": {
+ "title": "AutoRest Parameter Grouping Test Service",
+ "description": "Test Infrastructure for AutoRest",
+ "version": "1.0.0"
+ },
+ "host": "localhost",
+ "schemes": [
+ "https"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "consumes": [
+ "application/json"
+ ],
+ "paths": {
+ "/parameterGrouping/postRequired/{path}": {
+ "post": {
+ "operationId": "parameterGrouping_postRequired",
+ "description": "Post a bunch of required parameters grouped",
+ "parameters": [
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "type": "integer",
+ "format": "int32"
+ },
+ "required": true,
+ "x-ms-parameter-grouping": {
+ }
+ },
+ {
+ "name": "customHeader",
+ "in": "header",
+ "type": "string",
+ "required": false,
+ "x-ms-parameter-grouping": {
+ }
+ },
+ {
+ "name": "query",
+ "in": "query",
+ "required": false,
+ "type": "integer",
+ "format": "int32",
+ "default": 30,
+ "description": "Query parameter with default",
+ "x-ms-parameter-grouping": {
+ }
+ },
+ {
+ "name": "path",
+ "in": "path",
+ "required": true,
+ "type": "string",
+ "description": "Path parameter",
+ "x-ms-parameter-grouping": {
+ "value": true
+ }
+ },
+ ],
+ "responses": {
+ "200": {
+ "description": "Success"
+ },
+ "default": {
+ "description": "Unexpected error",
+ "schema": {
+ "$ref": "#/definitions/Error"
+ }
+ }
+ }
+ }
+ },
+ "/parameterGrouping/postOptional": {
+ "post": {
+ "operationId": "parameterGrouping_postOptional",
+ "description": "Post a bunch of optional parameters grouped",
+ "parameters": [
+ {
+ "name": "customHeader",
+ "in": "header",
+ "type": "string",
+ "required": false,
+ "x-ms-parameter-grouping": {
+ }
+ },
+ {
+ "name": "query",
+ "in": "query",
+ "required": false,
+ "type": "integer",
+ "format": "int32",
+ "default": 30,
+ "description": "Query parameter with default",
+ "x-ms-parameter-grouping": {
+ }
+ },
+ ],
+ "responses": {
+ "200": {
+ "description": "Success"
+ },
+ "default": {
+ "description": "Unexpected error",
+ "schema": {
+ "$ref": "#/definitions/Error"
+ }
+ }
+ }
+ }
+ },
+ "/parameterGrouping/postMultipleParameterGroups": {
+ "post": {
+ "operationId": "parameterGrouping_postMultipleParameterGroups",
+ "description": "Post parameters from multiple different parameter groups",
+ "parameters": [
+ {
+ "name": "header-one",
+ "in": "header",
+ "type": "string",
+ "required": false,
+ "x-ms-parameter-grouping": {
+ "name": "first-parameter-group"
+ }
+ },
+ {
+ "name": "query-one",
+ "in": "query",
+ "required": false,
+ "type": "integer",
+ "format": "int32",
+ "default": 30,
+ "description": "Query parameter with default",
+ "x-ms-parameter-grouping": {
+ "name": "first-parameter-group"
+ }
+ },
+ {
+ "name": "header-two",
+ "in": "header",
+ "type": "string",
+ "required": false,
+ "x-ms-parameter-grouping": {
+ "name": "second-parameter-group"
+ }
+ },
+ {
+ "name": "query-two",
+ "in": "query",
+ "required": false,
+ "type": "integer",
+ "format": "int32",
+ "default": 30,
+ "description": "Query parameter with default",
+ "x-ms-parameter-grouping": {
+ "name": "second-parameter-group"
+ }
+ },
+ ],
+ "responses": {
+ "200": {
+ "description": "Success"
+ },
+ "default": {
+ "description": "Unexpected error",
+ "schema": {
+ "$ref": "#/definitions/Error"
+ }
+ }
+ }
+ }
+ },
+ },
+ "definitions": {
+ "Error": {
+ "properties": {
+ "status": {
+ "type": "integer",
+ "format": "int32"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/ClientRuntimes/CSharp/ClientRuntime.Azure/Microsoft.Rest.ClientRuntime.Azure/project.lock.json b/ClientRuntimes/CSharp/ClientRuntime.Azure/Microsoft.Rest.ClientRuntime.Azure/project.lock.json
index d584e840b5..5c2f4ff81e 100644
--- a/ClientRuntimes/CSharp/ClientRuntime.Azure/Microsoft.Rest.ClientRuntime.Azure/project.lock.json
+++ b/ClientRuntimes/CSharp/ClientRuntime.Azure/Microsoft.Rest.ClientRuntime.Azure/project.lock.json
@@ -1859,7 +1859,7 @@
},
"Newtonsoft.Json/6.0.8": {
"type": "package",
- "sha512": "7ut47NDedTW19EbL0JpFDYUP62fcuz27hJrehCDNajdCS5NtqL+E39+7Um3OkNc2wl2ym7K8Ln5eNuLus6mVGQ==",
+ "sha512": "nZX7xCBl3PXpxRCxVtVfUXn63gSzrT8aO0VB9Tp24q656IUup9EGE8SGlo0UJ9if48OacJU34ZEtKEGWIdNCzg==",
"files": [
"lib/net20/Newtonsoft.Json.dll",
"lib/net20/Newtonsoft.Json.xml",
diff --git a/ClientRuntimes/CSharp/ClientRuntime/Microsoft.Rest.ClientRuntime/project.lock.json b/ClientRuntimes/CSharp/ClientRuntime/Microsoft.Rest.ClientRuntime/project.lock.json
index e61d2ebc26..08a9805eba 100644
--- a/ClientRuntimes/CSharp/ClientRuntime/Microsoft.Rest.ClientRuntime/project.lock.json
+++ b/ClientRuntimes/CSharp/ClientRuntime/Microsoft.Rest.ClientRuntime/project.lock.json
@@ -1819,7 +1819,7 @@
},
"Newtonsoft.Json/6.0.8": {
"type": "package",
- "sha512": "7ut47NDedTW19EbL0JpFDYUP62fcuz27hJrehCDNajdCS5NtqL+E39+7Um3OkNc2wl2ym7K8Ln5eNuLus6mVGQ==",
+ "sha512": "nZX7xCBl3PXpxRCxVtVfUXn63gSzrT8aO0VB9Tp24q656IUup9EGE8SGlo0UJ9if48OacJU34ZEtKEGWIdNCzg==",
"files": [
"lib/net20/Newtonsoft.Json.dll",
"lib/net20/Newtonsoft.Json.xml",
diff --git a/gulpfile.js b/gulpfile.js
index 13ca158bde..16f4ca5135 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -86,6 +86,7 @@ var defaultAzureMappings = {
'AcceptanceTests/Lro': '../../../TestServer/swagger/lro.json',
'AcceptanceTests/Paging': '../../../TestServer/swagger/paging.json',
'AcceptanceTests/AzureReport': '../../../TestServer/swagger/azure-report.json',
+ 'AcceptanceTests/AzureParameterGrouping': '../../../TestServer/swagger/azure-parameter-grouping.json',
'AcceptanceTests/ResourceFlattening': '../../../TestServer/swagger/resource-flattening.json',
'AcceptanceTests/Head': '../../../TestServer/swagger/head.json',
'AcceptanceTests/SubscriptionIdApiVersion': '../../../TestServer/swagger/subscriptionId-apiVersion.json',