Skip to content

Commit

Permalink
Fix python code gen bug in handling "." in property name. (Azure#1144)
Browse files Browse the repository at this point in the history
  • Loading branch information
xingwu1 authored and tbombach committed Jun 14, 2016
1 parent 29ba650 commit 6b8360d
Show file tree
Hide file tree
Showing 73 changed files with 2,165 additions and 189 deletions.
10 changes: 10 additions & 0 deletions AutoRest/Generators/CSharp/Azure.CSharp.Tests/AcceptanceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,16 @@ public void PagingHappyPathTests()
}
Assert.Equal(10, count);

result = client.Paging.GetOdataMultiplePages();
Assert.NotNull(result.NextPageLink);
count = 1;
while (result.NextPageLink != null)
{
result = client.Paging.GetOdataMultiplePagesNext(result.NextPageLink);
count++;
}
Assert.Equal(10, count);

var options = new Fixtures.Azure.AcceptanceTestsPaging.Models.PagingGetMultiplePagesWithOffsetOptions();
options.Offset = 100;
result = client.Paging.GetMultiplePagesWithOffset(options, "client-id");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ internal HeaderOperations(AutoRestAzureSpecialParametersTestClient client)
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="ErrorException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ public partial interface IHeaderOperations
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="ErrorException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationHeaderResponse<HeaderCustomNamedRequestIdParamGroupingHeaders>> CustomNamedRequestIdParamGroupingWithHttpMessagesAsync(HeaderCustomNamedRequestIdParamGroupingParameters headerCustomNamedRequestIdParamGroupingParameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ public HeaderCustomNamedRequestIdParamGroupingParameters(string fooClientRequest
public string FooClientRequestId { get; set; }

/// <summary>
/// Validate the object. Throws ValidationException if validation fails.
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (FooClientRequestId == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,28 @@ public partial interface IPagingOperations
/// </exception>
Task<AzureOperationResponse<IPage<Product>>> GetMultiplePagesWithHttpMessagesAsync(string clientRequestId = default(string), PagingGetMultiplePagesOptions pagingGetMultiplePagesOptions = default(PagingGetMultiplePagesOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// A paging operation that includes a nextLink in odata format that
/// has 10 pages
/// </summary>
/// <param name='clientRequestId'>
/// </param>
/// <param name='pagingGetOdataMultiplePagesOptions'>
/// Additional parameters for the operation
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
Task<AzureOperationResponse<IPage<Product>>> GetOdataMultiplePagesWithHttpMessagesAsync(string clientRequestId = default(string), PagingGetOdataMultiplePagesOptions pagingGetOdataMultiplePagesOptions = default(PagingGetOdataMultiplePagesOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// A paging operation that includes a nextLink that has 10 pages
/// </summary>
/// <param name='pagingGetMultiplePagesWithOffsetOptions'>
Expand Down Expand Up @@ -219,6 +241,34 @@ public partial interface IPagingOperations
/// </exception>
Task<AzureOperationResponse<IPage<Product>>> GetMultiplePagesNextWithHttpMessagesAsync(string nextPageLink, string clientRequestId = default(string), PagingGetMultiplePagesOptions pagingGetMultiplePagesOptions = default(PagingGetMultiplePagesOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// A paging operation that includes a nextLink in odata format that
/// has 10 pages
/// </summary>
/// <param name='nextPageLink'>
/// The NextLink from the previous successful call to List operation.
/// </param>
/// <param name='clientRequestId'>
/// </param>
/// <param name='pagingGetOdataMultiplePagesOptions'>
/// Additional parameters for the operation
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse<IPage<Product>>> GetOdataMultiplePagesNextWithHttpMessagesAsync(string nextPageLink, string clientRequestId = default(string), PagingGetOdataMultiplePagesOptions pagingGetOdataMultiplePagesOptions = default(PagingGetOdataMultiplePagesOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// A paging operation that includes a nextLink that has 10 pages
/// </summary>
/// <param name='nextPageLink'>
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

namespace Fixtures.Azure.AcceptanceTestsPaging.Models
{
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Microsoft.Rest.Azure;

/// <summary>
/// Defines a page in Azure responses.
/// </summary>
/// <typeparam name="T">Type of the page content items</typeparam>
[JsonObject]
public class Page1<T> : IPage<T>
{
/// <summary>
/// Gets the link to the next page.
/// </summary>
[JsonProperty("odata.nextLink")]
public string NextPageLink { get; private set; }

[JsonProperty("values")]
private IList<T> Items{ get; set; }

/// <summary>
/// Returns an enumerator that iterates through the collection.
/// </summary>
/// <returns>A an enumerator that can be used to iterate through the collection.</returns>
public IEnumerator<T> GetEnumerator()
{
return (Items == null) ? Enumerable.Empty<T>().GetEnumerator() : Items.GetEnumerator();
}

/// <summary>
/// Returns an enumerator that iterates through the collection.
/// </summary>
/// <returns>A an enumerator that can be used to iterate through the collection.</returns>
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// 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.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

namespace Fixtures.Azure.AcceptanceTestsPaging.Models
{
using System;
using System.Linq;
using System.Collections.Generic;
using Newtonsoft.Json;
using Microsoft.Rest;
using Microsoft.Rest.Serialization;
using Microsoft.Rest.Azure;

/// <summary>
/// Additional parameters for the Paging_getOdataMultiplePages operation.
/// </summary>
public partial class PagingGetOdataMultiplePagesOptions
{
/// <summary>
/// Initializes a new instance of the
/// PagingGetOdataMultiplePagesOptions class.
/// </summary>
public PagingGetOdataMultiplePagesOptions() { }

/// <summary>
/// Initializes a new instance of the
/// PagingGetOdataMultiplePagesOptions class.
/// </summary>
public PagingGetOdataMultiplePagesOptions(int? maxresults = default(int?), int? timeout = default(int?))
{
Maxresults = maxresults;
Timeout = timeout;
}

/// <summary>
/// Gets or sets sets the maximum number of items to return in the
/// response.
/// </summary>
[JsonProperty(PropertyName = "")]
public int? Maxresults { get; set; }

/// <summary>
/// Gets or sets sets the maximum time that the server can spend
/// processing the request, in seconds. The default is 30 seconds.
/// </summary>
[JsonProperty(PropertyName = "")]
public int? Timeout { get; set; }

}
}
Loading

0 comments on commit 6b8360d

Please sign in to comment.