Skip to content

Commit

Permalink
Update to new ParameterGrouping model
Browse files Browse the repository at this point in the history
  • Loading branch information
matthchr committed Oct 22, 2015
1 parent 9fa0834 commit 357d061
Show file tree
Hide file tree
Showing 145 changed files with 2,268 additions and 83 deletions.
7 changes: 4 additions & 3 deletions AutoRest/AutoRest.Core/ClientModel/ParameterMapping.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Globalization;

namespace Microsoft.Rest.Generator.ClientModel
{
using System;
using System.Globalization;

/// <summary>
/// Defines a parameter mapping.
/// </summary>
public class ParameterMapping
public class ParameterMapping : ICloneable
{
/// <summary>
/// Gets or sets the input parameter.
Expand Down
1 change: 1 addition & 0 deletions AutoRest/AutoRest.Core/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
15 changes: 3 additions & 12 deletions AutoRest/Generators/CSharp/Azure.CSharp.Tests/AcceptanceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -717,30 +717,21 @@ public void ParameterGroupingTests()
new TokenCredentials(Guid.NewGuid().ToString())))
{
//Valid required parameters
ParameterGroupingPostRequiredParameters requiredParameters = new ParameterGroupingPostRequiredParameters
ParameterGroupingPostRequiredParameters requiredParameters = new ParameterGroupingPostRequiredParameters(bodyParameter, pathParameter)
{
Body = bodyParameter,
Path = pathParameter,
CustomHeader = headerParameter,
Query = queryParameter
};

client.ParameterGrouping.PostRequired(requiredParameters);

//Required parameters but null optional parameters
requiredParameters = new ParameterGroupingPostRequiredParameters
{
Body = bodyParameter,
Path = pathParameter
};
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
{
Path = pathParameter,
};
requiredParameters = new ParameterGroupingPostRequiredParameters(null, pathParameter);

Assert.Throws<ValidationException>(() => client.ParameterGrouping.PostRequired(requiredParameters));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ namespace Fixtures.Azure.AcceptanceTestsAzureBodyDuration.Models
/// </summary>
public partial class Error
{
/// <summary>
/// Initializes a new instance of the Error class.
/// </summary>
public Error() { }

/// <summary>
/// Initializes a new instance of the Error class.
/// </summary>
public Error(int? status = default(int?), string message = default(string))
{
Status = status;
Message = message;
}

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "status")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
// 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.

Expand Down Expand Up @@ -181,15 +181,23 @@ private void Initialize()
DateTimeZoneHandling = DateTimeZoneHandling.Utc,
NullValueHandling = NullValueHandling.Ignore,
ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver()
ContractResolver = new ReadOnlyJsonContractResolver(),
Converters = new List<JsonConverter>
{
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()
ContractResolver = new ReadOnlyJsonContractResolver(),
Converters = new List<JsonConverter>
{
new Iso8601TimeSpanConverter()
}
};
DeserializationSettings.Converters.Add(new ResourceJsonConverter());
DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
// 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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
// 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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
// 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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
// 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.

Expand All @@ -20,6 +20,20 @@ namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping.Models
/// </summary>
public partial class Error
{
/// <summary>
/// Initializes a new instance of the Error class.
/// </summary>
public Error() { }

/// <summary>
/// Initializes a new instance of the Error class.
/// </summary>
public Error(int? status = default(int?), string message = default(string))
{
Status = status;
Message = message;
}

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "status")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
// 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.

Expand All @@ -21,6 +21,20 @@ namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping.Models
/// </summary>
public partial class FirstParameterGroup
{
/// <summary>
/// Initializes a new instance of the FirstParameterGroup class.
/// </summary>
public FirstParameterGroup() { }

/// <summary>
/// Initializes a new instance of the FirstParameterGroup class.
/// </summary>
public FirstParameterGroup(string headerOne = default(string), int? queryOne = default(int?))
{
HeaderOne = headerOne;
QueryOne = queryOne;
}

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
// 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.

Expand All @@ -21,6 +21,22 @@ namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping.Models
/// </summary>
public partial class ParameterGroupingPostOptionalParameters
{
/// <summary>
/// Initializes a new instance of the
/// ParameterGroupingPostOptionalParameters class.
/// </summary>
public ParameterGroupingPostOptionalParameters() { }

/// <summary>
/// Initializes a new instance of the
/// ParameterGroupingPostOptionalParameters class.
/// </summary>
public ParameterGroupingPostOptionalParameters(string customHeader = default(string), int? query = default(int?))
{
CustomHeader = customHeader;
Query = query;
}

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
// 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.

Expand All @@ -21,6 +21,24 @@ namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping.Models
/// </summary>
public partial class ParameterGroupingPostRequiredParameters
{
/// <summary>
/// Initializes a new instance of the
/// ParameterGroupingPostRequiredParameters class.
/// </summary>
public ParameterGroupingPostRequiredParameters() { }

/// <summary>
/// Initializes a new instance of the
/// ParameterGroupingPostRequiredParameters class.
/// </summary>
public ParameterGroupingPostRequiredParameters(int? body, string path, string customHeader = default(string), int? query = default(int?))
{
Body = body;
CustomHeader = customHeader;
Query = query;
Path = path;
}

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
// 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.

Expand All @@ -21,6 +21,20 @@ namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping.Models
/// </summary>
public partial class SecondParameterGroup
{
/// <summary>
/// Initializes a new instance of the SecondParameterGroup class.
/// </summary>
public SecondParameterGroup() { }

/// <summary>
/// Initializes a new instance of the SecondParameterGroup class.
/// </summary>
public SecondParameterGroup(string headerTwo = default(string), int? queryTwo = default(int?))
{
HeaderTwo = headerTwo;
QueryTwo = queryTwo;
}

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
// 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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
// 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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ namespace Fixtures.Azure.AcceptanceTestsAzureReport.Models
/// </summary>
public partial class Error
{
/// <summary>
/// Initializes a new instance of the Error class.
/// </summary>
public Error() { }

/// <summary>
/// Initializes a new instance of the Error class.
/// </summary>
public Error(int? status = default(int?), string message = default(string))
{
Status = status;
Message = message;
}

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "status")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ namespace Fixtures.Azure.AcceptanceTestsAzureSpecials.Models
/// </summary>
public partial class Error
{
/// <summary>
/// Initializes a new instance of the Error class.
/// </summary>
public Error() { }

/// <summary>
/// Initializes a new instance of the Error class.
/// </summary>
public Error(int? status = default(int?), string message = default(string))
{
Status = status;
Message = message;
}

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "status")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ namespace Fixtures.Azure.AcceptanceTestsLro.Models
/// </summary>
public partial class OperationResult
{
/// <summary>
/// Initializes a new instance of the OperationResult class.
/// </summary>
public OperationResult() { }

/// <summary>
/// Initializes a new instance of the OperationResult class.
/// </summary>
public OperationResult(string status = default(string), OperationResultError error = default(OperationResultError))
{
Status = status;
Error = error;
}

/// <summary>
/// The status of the request. Possible values for this property
/// include: 'Succeeded', 'Failed', 'canceled', 'Accepted',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ namespace Fixtures.Azure.AcceptanceTestsLro.Models
/// </summary>
public partial class OperationResultError
{
/// <summary>
/// Initializes a new instance of the OperationResultError class.
/// </summary>
public OperationResultError() { }

/// <summary>
/// Initializes a new instance of the OperationResultError class.
/// </summary>
public OperationResultError(int? code = default(int?), string message = default(string))
{
Code = code;
Message = message;
}

/// <summary>
/// The error code for an operation failure
/// </summary>
Expand Down
Loading

0 comments on commit 357d061

Please sign in to comment.