Skip to content

Commit e6559dc

Browse files
ArcturusZhangJoshLove-msftjorgerangel-msft
authored
Update UnbrandedGeneratorVersion to 1.0.0-alpha.20250813.1 (Azure#51962)
* update dependency * try to fix the issue * adopt mtg updates * upgrade * revert * regen * fix tests --------- Co-authored-by: jolov <[email protected]> Co-authored-by: Jorge Rangel <[email protected]>
1 parent 887b63b commit e6559dc

File tree

55 files changed

+148
-100
lines changed

Some content is hidden

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

55 files changed

+148
-100
lines changed

eng/Packages.Data.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@
457457

458458
<PropertyGroup>
459459
<TestProxyVersion>1.0.0-dev.20250805.1</TestProxyVersion>
460-
<UnbrandedGeneratorVersion>1.0.0-alpha.20250811.4</UnbrandedGeneratorVersion>
460+
<UnbrandedGeneratorVersion>1.0.0-alpha.20250813.1</UnbrandedGeneratorVersion>
461461
<AzureGeneratorVersion>1.0.0-alpha.20250729.4</AzureGeneratorVersion>
462462
</PropertyGroup>
463463
</Project>

eng/http-client-csharp-emitter-package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eng/http-client-csharp-emitter-package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"main": "dist/src/index.js",
33
"dependencies": {
44
"client-plugin": "file:../../../../eng/packages/plugins/client",
5-
"@typespec/http-client-csharp": "1.0.0-alpha.20250811.4"
5+
"@typespec/http-client-csharp": "1.0.0-alpha.20250813.1"
66
},
77
"devDependencies": {
88
"@azure-tools/typespec-azure-core": "0.59.0",

eng/packages/http-client-csharp/generator/Azure.Generator/src/Providers/AzureCollectionResultDefinition.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,26 +117,27 @@ private MethodBodyStatement[] BuildAsPagesMethodBody()
117117
This.Invoke(_getNextResponseMethodName, [PageSizeHintParameter, nextPageVariable], IsAsync),
118118
out var responseVariable),
119119
// Early exit if response is null
120-
new IfStatement(responseVariable.Is(Null)) { new YieldBreakStatement() }
120+
new IfStatement(responseVariable.Is(Null)) { new YieldBreakStatement() },
121+
Declare("result", ResponseModelType, responseVariable.CastTo(ResponseModelType), out var resultVariable),
121122
};
122123

123124
var nextPageExpression = _paging.NextLink != null ? nextPageVariable.NullConditional().Property("AbsoluteUri") : nextPageVariable;
124125
if (_isProtocol)
125126
{
126127
// Convert items to BinaryData
127-
whileStatement.Add(ConvertItemsToListOfBinaryData(responseVariable, out var itemsVariable));
128+
whileStatement.Add(ConvertItemsToListOfBinaryData(resultVariable, out var itemsVariable));
128129

129130
// Create and yield the page
130131
whileStatement.Add(YieldReturn(Static(new CSharpType(typeof(Page<>), [_itemModelType])).Invoke("FromValues", [itemsVariable, nextPageExpression, responseVariable])));
131132
}
132133
else
133134
{
134135
// Create and yield the page
135-
whileStatement.Add(YieldReturn(Static(new CSharpType(typeof(Page<>), [_itemModelType])).Invoke("FromValues", [BuildGetPropertyExpression(Paging.ItemPropertySegments, responseVariable).CastTo(new CSharpType(typeof(IReadOnlyList<>), _itemModelType)), nextPageExpression, responseVariable])));
136+
whileStatement.Add(YieldReturn(Static(new CSharpType(typeof(Page<>), [_itemModelType])).Invoke("FromValues", [BuildGetPropertyExpression(Paging.ItemPropertySegments, resultVariable).CastTo(new CSharpType(typeof(IReadOnlyList<>), _itemModelType)), nextPageExpression, responseVariable])));
136137
}
137138

138139
// Extract next page
139-
whileStatement.Add(AssignAndCheckNextPageVariable(responseVariable.ToApi<ClientResponseApi>(), nextPageVariable));
140+
whileStatement.Add(AssignAndCheckNextPageVariable(responseVariable.ToApi<ClientResponseApi>(), resultVariable, nextPageVariable));
140141

141142
statements.Add(whileStatement);
142143
return [.. statements];
@@ -162,17 +163,18 @@ private MethodBodyStatement[] BuildAsPagesSinglePageMethodBody()
162163
Declare("response", new CSharpType(typeof(Response), isNullable: true),
163164
This.Invoke(_getNextResponseMethodName, [PageSizeHintParameter, Null], IsAsync),
164165
out var responseVariable),
166+
Declare("result", ResponseModelType, responseVariable.CastTo(ResponseModelType), out var resultVariable),
165167
};
166168

167169
if (_isProtocol)
168170
{
169-
statements.Add(ConvertItemsToListOfBinaryData(responseVariable, out var itemsVariable));
171+
statements.Add(ConvertItemsToListOfBinaryData(resultVariable, out var itemsVariable));
170172
statements.Add(
171173
YieldReturn(Static(new CSharpType(typeof(Page<>), [_itemModelType])).Invoke("FromValues", [itemsVariable, Null, responseVariable])));
172174
}
173175
else
174176
{
175-
statements.Add(YieldReturn(Static(new CSharpType(typeof(Page<>), [_itemModelType])).Invoke("FromValues", [BuildGetPropertyExpression(Paging.ItemPropertySegments, responseVariable).CastTo(new CSharpType(typeof(IReadOnlyList<>), _itemModelType)), Null, responseVariable])));
177+
statements.Add(YieldReturn(Static(new CSharpType(typeof(Page<>), [_itemModelType])).Invoke("FromValues", [BuildGetPropertyExpression(Paging.ItemPropertySegments, resultVariable).CastTo(new CSharpType(typeof(IReadOnlyList<>), _itemModelType)), Null, responseVariable])));
176178
}
177179

178180
return [..statements];

eng/packages/http-client-csharp/generator/Azure.Generator/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInBody.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,14 @@ public CatClientGetCatsCollectionResult(global::Samples.CatClient client, string
4949
{
5050
yield break;
5151
}
52+
global::Samples.Models.Page result = ((global::Samples.Models.Page)response);
5253
global::System.Collections.Generic.List<global::System.BinaryData> items = new global::System.Collections.Generic.List<global::System.BinaryData>();
53-
foreach (var item in ((global::Samples.Models.Page)response).Cats)
54+
foreach (var item in result.Cats)
5455
{
5556
items.Add(global::System.BinaryData.FromObjectAsJson(item));
5657
}
5758
yield return global::Azure.Page<global::System.BinaryData>.FromValues(items, nextPage, response);
58-
nextPage = ((global::Samples.Models.Page)response).NextPage;
59+
nextPage = result.NextPage;
5960
if ((nextPage == null))
6061
{
6162
yield break;

eng/packages/http-client-csharp/generator/Azure.Generator/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInBodyAsync.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,14 @@ public CatClientGetCatsAsyncCollectionResult(global::Samples.CatClient client, s
5050
{
5151
yield break;
5252
}
53+
global::Samples.Models.Page result = ((global::Samples.Models.Page)response);
5354
global::System.Collections.Generic.List<global::System.BinaryData> items = new global::System.Collections.Generic.List<global::System.BinaryData>();
54-
foreach (var item in ((global::Samples.Models.Page)response).Cats)
55+
foreach (var item in result.Cats)
5556
{
5657
items.Add(global::System.BinaryData.FromObjectAsJson(item));
5758
}
5859
yield return global::Azure.Page<global::System.BinaryData>.FromValues(items, nextPage, response);
59-
nextPage = ((global::Samples.Models.Page)response).NextPage;
60+
nextPage = result.NextPage;
6061
if ((nextPage == null))
6162
{
6263
yield break;

eng/packages/http-client-csharp/generator/Azure.Generator/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInBodyOfT.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ public CatClientGetCatsCollectionResultOfT(global::Samples.CatClient client, str
4949
{
5050
yield break;
5151
}
52-
yield return global::Azure.Page<global::Samples.Models.Cat>.FromValues(((global::System.Collections.Generic.IReadOnlyList<global::Samples.Models.Cat>)((global::Samples.Models.Page)response).Cats), nextPage, response);
53-
nextPage = ((global::Samples.Models.Page)response).NextPage;
52+
global::Samples.Models.Page result = ((global::Samples.Models.Page)response);
53+
yield return global::Azure.Page<global::Samples.Models.Cat>.FromValues(((global::System.Collections.Generic.IReadOnlyList<global::Samples.Models.Cat>)result.Cats), nextPage, response);
54+
nextPage = result.NextPage;
5455
if ((nextPage == null))
5556
{
5657
yield break;

eng/packages/http-client-csharp/generator/Azure.Generator/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInBodyOfTAsync.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ public CatClientGetCatsAsyncCollectionResultOfT(global::Samples.CatClient client
5050
{
5151
yield break;
5252
}
53-
yield return global::Azure.Page<global::Samples.Models.Cat>.FromValues(((global::System.Collections.Generic.IReadOnlyList<global::Samples.Models.Cat>)((global::Samples.Models.Page)response).Cats), nextPage, response);
54-
nextPage = ((global::Samples.Models.Page)response).NextPage;
53+
global::Samples.Models.Page result = ((global::Samples.Models.Page)response);
54+
yield return global::Azure.Page<global::Samples.Models.Cat>.FromValues(((global::System.Collections.Generic.IReadOnlyList<global::Samples.Models.Cat>)result.Cats), nextPage, response);
55+
nextPage = result.NextPage;
5556
if ((nextPage == null))
5657
{
5758
yield break;

eng/packages/http-client-csharp/generator/Azure.Generator/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInHeader.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ public CatClientGetCatsCollectionResult(global::Samples.CatClient client, string
4949
{
5050
yield break;
5151
}
52+
global::Samples.Models.Page result = ((global::Samples.Models.Page)response);
5253
global::System.Collections.Generic.List<global::System.BinaryData> items = new global::System.Collections.Generic.List<global::System.BinaryData>();
53-
foreach (var item in ((global::Samples.Models.Page)response).Cats)
54+
foreach (var item in result.Cats)
5455
{
5556
items.Add(global::System.BinaryData.FromObjectAsJson(item));
5657
}

eng/packages/http-client-csharp/generator/Azure.Generator/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInHeaderAsync.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ public CatClientGetCatsAsyncCollectionResult(global::Samples.CatClient client, s
5050
{
5151
yield break;
5252
}
53+
global::Samples.Models.Page result = ((global::Samples.Models.Page)response);
5354
global::System.Collections.Generic.List<global::System.BinaryData> items = new global::System.Collections.Generic.List<global::System.BinaryData>();
54-
foreach (var item in ((global::Samples.Models.Page)response).Cats)
55+
foreach (var item in result.Cats)
5556
{
5657
items.Add(global::System.BinaryData.FromObjectAsJson(item));
5758
}

0 commit comments

Comments
 (0)