Skip to content

Commit 5a2eb13

Browse files
committed
Fix python code gen bug in handling "." in property name.
1 parent 29ba650 commit 5a2eb13

File tree

73 files changed

+2165
-189
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+2165
-189
lines changed

AutoRest/Generators/CSharp/Azure.CSharp.Tests/AcceptanceTests.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,16 @@ public void PagingHappyPathTests()
384384
}
385385
Assert.Equal(10, count);
386386

387+
result = client.Paging.GetOdataMultiplePages();
388+
Assert.NotNull(result.NextPageLink);
389+
count = 1;
390+
while (result.NextPageLink != null)
391+
{
392+
result = client.Paging.GetOdataMultiplePagesNext(result.NextPageLink);
393+
count++;
394+
}
395+
Assert.Equal(10, count);
396+
387397
var options = new Fixtures.Azure.AcceptanceTestsPaging.Models.PagingGetMultiplePagesWithOffsetOptions();
388398
options.Offset = 100;
389399
result = client.Paging.GetMultiplePagesWithOffset(options, "client-id");

AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureSpecials/HeaderOperations.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,12 @@ internal HeaderOperations(AutoRestAzureSpecialParametersTestClient client)
229229
/// <param name='cancellationToken'>
230230
/// The cancellation token.
231231
/// </param>
232+
/// <exception cref="ErrorException">
233+
/// Thrown when the operation returned an invalid status code
234+
/// </exception>
235+
/// <exception cref="ValidationException">
236+
/// Thrown when a required parameter is null
237+
/// </exception>
232238
/// <return>
233239
/// A response object containing the response body and response headers.
234240
/// </return>

AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureSpecials/IHeaderOperations.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ public partial interface IHeaderOperations
5555
/// <param name='cancellationToken'>
5656
/// The cancellation token.
5757
/// </param>
58+
/// <exception cref="ErrorException">
59+
/// Thrown when the operation returned an invalid status code
60+
/// </exception>
61+
/// <exception cref="ValidationException">
62+
/// Thrown when a required parameter is null
63+
/// </exception>
5864
Task<AzureOperationHeaderResponse<HeaderCustomNamedRequestIdParamGroupingHeaders>> CustomNamedRequestIdParamGroupingWithHttpMessagesAsync(HeaderCustomNamedRequestIdParamGroupingParameters headerCustomNamedRequestIdParamGroupingParameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
5965
}
6066
}

AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureSpecials/Models/HeaderCustomNamedRequestIdParamGroupingParameters.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,11 @@ public HeaderCustomNamedRequestIdParamGroupingParameters(string fooClientRequest
4444
public string FooClientRequestId { get; set; }
4545

4646
/// <summary>
47-
/// Validate the object. Throws ValidationException if validation fails.
47+
/// Validate the object.
4848
/// </summary>
49+
/// <exception cref="ValidationException">
50+
/// Thrown if validation fails
51+
/// </exception>
4952
public virtual void Validate()
5053
{
5154
if (FooClientRequestId == null)

AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Paging/IPagingOperations.cs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,28 @@ public partial interface IPagingOperations
6161
/// </exception>
6262
Task<AzureOperationResponse<IPage<Product>>> GetMultiplePagesWithHttpMessagesAsync(string clientRequestId = default(string), PagingGetMultiplePagesOptions pagingGetMultiplePagesOptions = default(PagingGetMultiplePagesOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
6363
/// <summary>
64+
/// A paging operation that includes a nextLink in odata format that
65+
/// has 10 pages
66+
/// </summary>
67+
/// <param name='clientRequestId'>
68+
/// </param>
69+
/// <param name='pagingGetOdataMultiplePagesOptions'>
70+
/// Additional parameters for the operation
71+
/// </param>
72+
/// <param name='customHeaders'>
73+
/// The headers that will be added to request.
74+
/// </param>
75+
/// <param name='cancellationToken'>
76+
/// The cancellation token.
77+
/// </param>
78+
/// <exception cref="CloudException">
79+
/// Thrown when the operation returned an invalid status code
80+
/// </exception>
81+
/// <exception cref="SerializationException">
82+
/// Thrown when unable to deserialize the response
83+
/// </exception>
84+
Task<AzureOperationResponse<IPage<Product>>> GetOdataMultiplePagesWithHttpMessagesAsync(string clientRequestId = default(string), PagingGetOdataMultiplePagesOptions pagingGetOdataMultiplePagesOptions = default(PagingGetOdataMultiplePagesOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
85+
/// <summary>
6486
/// A paging operation that includes a nextLink that has 10 pages
6587
/// </summary>
6688
/// <param name='pagingGetMultiplePagesWithOffsetOptions'>
@@ -219,6 +241,34 @@ public partial interface IPagingOperations
219241
/// </exception>
220242
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));
221243
/// <summary>
244+
/// A paging operation that includes a nextLink in odata format that
245+
/// has 10 pages
246+
/// </summary>
247+
/// <param name='nextPageLink'>
248+
/// The NextLink from the previous successful call to List operation.
249+
/// </param>
250+
/// <param name='clientRequestId'>
251+
/// </param>
252+
/// <param name='pagingGetOdataMultiplePagesOptions'>
253+
/// Additional parameters for the operation
254+
/// </param>
255+
/// <param name='customHeaders'>
256+
/// The headers that will be added to request.
257+
/// </param>
258+
/// <param name='cancellationToken'>
259+
/// The cancellation token.
260+
/// </param>
261+
/// <exception cref="CloudException">
262+
/// Thrown when the operation returned an invalid status code
263+
/// </exception>
264+
/// <exception cref="SerializationException">
265+
/// Thrown when unable to deserialize the response
266+
/// </exception>
267+
/// <exception cref="ValidationException">
268+
/// Thrown when a required parameter is null
269+
/// </exception>
270+
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));
271+
/// <summary>
222272
/// A paging operation that includes a nextLink that has 10 pages
223273
/// </summary>
224274
/// <param name='nextPageLink'>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for
3+
// license information.
4+
//
5+
// Code generated by Microsoft (R) AutoRest Code Generator.
6+
// Changes may cause incorrect behavior and will be lost if the code is
7+
// regenerated.
8+
9+
namespace Fixtures.Azure.AcceptanceTestsPaging.Models
10+
{
11+
using System.Collections.Generic;
12+
using System.Linq;
13+
using Newtonsoft.Json;
14+
using Microsoft.Rest.Azure;
15+
16+
/// <summary>
17+
/// Defines a page in Azure responses.
18+
/// </summary>
19+
/// <typeparam name="T">Type of the page content items</typeparam>
20+
[JsonObject]
21+
public class Page1<T> : IPage<T>
22+
{
23+
/// <summary>
24+
/// Gets the link to the next page.
25+
/// </summary>
26+
[JsonProperty("odata.nextLink")]
27+
public string NextPageLink { get; private set; }
28+
29+
[JsonProperty("values")]
30+
private IList<T> Items{ get; set; }
31+
32+
/// <summary>
33+
/// Returns an enumerator that iterates through the collection.
34+
/// </summary>
35+
/// <returns>A an enumerator that can be used to iterate through the collection.</returns>
36+
public IEnumerator<T> GetEnumerator()
37+
{
38+
return (Items == null) ? Enumerable.Empty<T>().GetEnumerator() : Items.GetEnumerator();
39+
}
40+
41+
/// <summary>
42+
/// Returns an enumerator that iterates through the collection.
43+
/// </summary>
44+
/// <returns>A an enumerator that can be used to iterate through the collection.</returns>
45+
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
46+
{
47+
return GetEnumerator();
48+
}
49+
}
50+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for
3+
// license information.
4+
//
5+
// Code generated by Microsoft (R) AutoRest Code Generator.
6+
// Changes may cause incorrect behavior and will be lost if the code is
7+
// regenerated.
8+
9+
namespace Fixtures.Azure.AcceptanceTestsPaging.Models
10+
{
11+
using System;
12+
using System.Linq;
13+
using System.Collections.Generic;
14+
using Newtonsoft.Json;
15+
using Microsoft.Rest;
16+
using Microsoft.Rest.Serialization;
17+
using Microsoft.Rest.Azure;
18+
19+
/// <summary>
20+
/// Additional parameters for the Paging_getOdataMultiplePages operation.
21+
/// </summary>
22+
public partial class PagingGetOdataMultiplePagesOptions
23+
{
24+
/// <summary>
25+
/// Initializes a new instance of the
26+
/// PagingGetOdataMultiplePagesOptions class.
27+
/// </summary>
28+
public PagingGetOdataMultiplePagesOptions() { }
29+
30+
/// <summary>
31+
/// Initializes a new instance of the
32+
/// PagingGetOdataMultiplePagesOptions class.
33+
/// </summary>
34+
public PagingGetOdataMultiplePagesOptions(int? maxresults = default(int?), int? timeout = default(int?))
35+
{
36+
Maxresults = maxresults;
37+
Timeout = timeout;
38+
}
39+
40+
/// <summary>
41+
/// Gets or sets sets the maximum number of items to return in the
42+
/// response.
43+
/// </summary>
44+
[JsonProperty(PropertyName = "")]
45+
public int? Maxresults { get; set; }
46+
47+
/// <summary>
48+
/// Gets or sets sets the maximum time that the server can spend
49+
/// processing the request, in seconds. The default is 30 seconds.
50+
/// </summary>
51+
[JsonProperty(PropertyName = "")]
52+
public int? Timeout { get; set; }
53+
54+
}
55+
}

0 commit comments

Comments
 (0)