Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix python code gen bug in handling "." in property name. #1144

Merged
merged 1 commit into from
Jun 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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