Skip to content

Commit 62c6aee

Browse files
[Mgmt Generator] Bump base dependency to 1.0.0-alpha.20260403.3 (Azure#57846)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 6cae66e commit 62c6aee

File tree

103 files changed

+513
-305
lines changed

Some content is hidden

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

103 files changed

+513
-305
lines changed

doc/GeneratorVersions/Emitter_Version_Dashboard.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Emitter Version Dashboard
22

3-
> **Auto-generated** by `Emitter_Version_Dashboard` on 2026-04-04 01:49:57 UTC.
3+
> **Auto-generated** by `Emitter_Version_Dashboard` on 2026-04-07 03:39:51 UTC.
44
> Run that script to refresh this file after dependency version changes.
55
66
## Dependency Chain
77

88
```
9-
@typespec/http-client-csharp (alpha.20260403.13)
10-
└─ @azure-typespec/http-client-csharp (alpha.20260403.2)
9+
@typespec/http-client-csharp (alpha.20260406.8)
10+
└─ @azure-typespec/http-client-csharp (alpha.20260403.3)
1111
└─ @azure-typespec/http-client-csharp-mgmt (alpha.20260403.1)
1212
└─ @azure-typespec/http-client-csharp-provisioning (alpha.20260327.1)
1313
```
@@ -16,8 +16,8 @@
1616

1717
| Emitter | Depends On | Dependency Version | Latest on npm | Dependency Commit |
1818
|---|---|---|---|---|
19-
| `@azure-typespec/http-client-csharp` | `@typespec/http-client-csharp` | [1.0.0-alpha.20260403.13](https://www.npmjs.com/package/@typespec/http-client-csharp/v/1.0.0-alpha.20260403.13) | [1.0.0-alpha.20260403.13](https://www.npmjs.com/package/@typespec/http-client-csharp/v/1.0.0-alpha.20260403.13) | [051d4b8](https://github.com/microsoft/typespec/commit/051d4b89dafbaeaadf4e968f67d2e23ef3f46135) |
20-
| `@azure-typespec/http-client-csharp-mgmt` | `@azure-typespec/http-client-csharp` | [1.0.0-alpha.20260331.4](https://www.npmjs.com/package/@azure-typespec/http-client-csharp/v/1.0.0-alpha.20260331.4) | [1.0.0-alpha.20260403.2](https://www.npmjs.com/package/@azure-typespec/http-client-csharp/v/1.0.0-alpha.20260403.2) | [97c14b2](https://github.com/Azure/azure-sdk-for-net/commit/97c14b2679e311a9485d2a477b54813048c4d0d6) |
19+
| `@azure-typespec/http-client-csharp` | `@typespec/http-client-csharp` | [1.0.0-alpha.20260403.13](https://www.npmjs.com/package/@typespec/http-client-csharp/v/1.0.0-alpha.20260403.13) | [1.0.0-alpha.20260406.8](https://www.npmjs.com/package/@typespec/http-client-csharp/v/1.0.0-alpha.20260406.8) | [051d4b8](https://github.com/microsoft/typespec/commit/051d4b89dafbaeaadf4e968f67d2e23ef3f46135) |
20+
| `@azure-typespec/http-client-csharp-mgmt` | `@azure-typespec/http-client-csharp` | [1.0.0-alpha.20260403.3](https://www.npmjs.com/package/@azure-typespec/http-client-csharp/v/1.0.0-alpha.20260403.3) | [1.0.0-alpha.20260403.3](https://www.npmjs.com/package/@azure-typespec/http-client-csharp/v/1.0.0-alpha.20260403.3) | [f88a96e](https://github.com/Azure/azure-sdk-for-net/commit/f88a96e6903dd527e94ca0e56b8c38662cfb992c) |
2121
| `@azure-typespec/http-client-csharp-provisioning` | `@azure-typespec/http-client-csharp-mgmt` | [1.0.0-alpha.20260322.2](https://www.npmjs.com/package/@azure-typespec/http-client-csharp-mgmt/v/1.0.0-alpha.20260322.2) | [1.0.0-alpha.20260403.1](https://www.npmjs.com/package/@azure-typespec/http-client-csharp-mgmt/v/1.0.0-alpha.20260403.1) | [e413cb9](https://github.com/Azure/azure-sdk-for-net/commit/e413cb9dfdf6460c14915fe09126ca3b39f050e2) |
2222

2323
## Source Files

eng/centralpackagemanagement/Directory.Generation.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<PropertyGroup>
33
<UnbrandedGeneratorVersion>1.0.0-alpha.20260403.13</UnbrandedGeneratorVersion>
4-
<AzureGeneratorVersion>1.0.0-alpha.20260331.4</AzureGeneratorVersion>
4+
<AzureGeneratorVersion>1.0.0-alpha.20260403.3</AzureGeneratorVersion>
55
<AzureManagementGeneratorVersion>1.0.0-alpha.20260322.2</AzureManagementGeneratorVersion>
66
</PropertyGroup>
77

eng/packages/http-client-csharp-mgmt/generator/Azure.Generator.Management/src/ManagementClientGenerator.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Microsoft.TypeSpec.Generator;
88
using System;
99
using System.ComponentModel.Composition;
10+
using System.Threading.Tasks;
1011

1112
namespace Azure.Generator.Management
1213
{
@@ -91,5 +92,10 @@ internal bool IsSkipApiVersionOverrideEnabled()
9192
}
9293
return false;
9394
}
95+
96+
/// <summary>
97+
/// Management plane SDKs do not need ConfigurationSchema.json generation.
98+
/// </summary>
99+
public override Task WriteAdditionalFiles(string outputPath) => Task.CompletedTask;
94100
}
95101
}

eng/packages/http-client-csharp-mgmt/generator/Azure.Generator.Management/src/ManagementOutputLibrary.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ public class ManagementOutputLibrary : AzureOutputLibrary
3939
private CSharpType? _modelReaderWriterContextType;
4040
internal CSharpType ModelReaderWriterContextType => _modelReaderWriterContextType ??= new ModelReaderWriterContextDefinition().Type;
4141

42-
// TODO -- this is really a bad practice that this map is not built in one place, but we are building it while generating stuff and in the meantime we might read it.
43-
// but currently this is the best we could do right now.
44-
internal Dictionary<string, string> PageableMethodScopes { get; } = new();
45-
4642
private IReadOnlyDictionary<string, ResourceClientProvider>? _resourcesByIdDict;
4743
private IReadOnlyList<ResourceClientProvider>? _resources;
4844
private IReadOnlyList<ResourceCollectionClientProvider>? _resourceCollections;

eng/packages/http-client-csharp-mgmt/generator/Azure.Generator.Management/src/Providers/ArrayResponseCollectionResultDefinition.cs

Lines changed: 54 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
// Licensed under the MIT License.
33

44
using System;
5+
using System.ClientModel.Primitives;
56
using System.Collections.Generic;
7+
using System.IO;
68
using System.Linq;
9+
using System.Text;
10+
using System.Text.Json;
711
using System.Threading.Tasks;
812
using Azure;
913
using Azure.Core;
@@ -30,13 +34,16 @@ internal class ArrayResponseCollectionResultDefinition : TypeProvider
3034
private readonly ClientProvider _restClient;
3135
private readonly InputServiceMethod _serviceMethod;
3236
private readonly CSharpType _itemType;
33-
private readonly CSharpType _listType;
3437
private readonly bool _isAsync;
35-
private readonly string _scopeName;
3638
private readonly IReadOnlyList<ParameterProvider> _constructorParameters;
3739
private readonly string _methodName;
3840
private readonly string _enclosingTypeName;
3941

42+
private readonly FieldProvider _clientField;
43+
private readonly IReadOnlyList<FieldProvider> _parameterFields;
44+
private readonly FieldProvider _contextField;
45+
private readonly FieldProvider _diagnosticScopeField;
46+
4047
private static readonly ParameterProvider ContinuationTokenParameter =
4148
new("continuationToken", $"A continuation token indicating where to resume paging.", new CSharpType(typeof(string)));
4249
private static readonly ParameterProvider PageSizeHintParameter =
@@ -46,26 +53,43 @@ public ArrayResponseCollectionResultDefinition(
4653
ClientProvider restClient,
4754
InputServiceMethod serviceMethod,
4855
CSharpType itemType,
49-
CSharpType listType,
5056
bool isAsync,
51-
string scopeName,
5257
IReadOnlyList<ParameterProvider> constructorParameters,
5358
string methodName,
5459
string enclosingTypeName)
5560
{
5661
_restClient = restClient;
5762
_serviceMethod = serviceMethod;
5863
_itemType = itemType;
59-
_listType = listType;
6064
_isAsync = isAsync;
61-
_scopeName = scopeName;
6265
_constructorParameters = constructorParameters;
6366
_methodName = methodName;
6467
_enclosingTypeName = enclosingTypeName;
68+
69+
_clientField = new FieldProvider(
70+
FieldModifiers.Private | FieldModifiers.ReadOnly,
71+
_restClient.Type,
72+
"_client",
73+
this);
74+
_parameterFields = _constructorParameters.Select(p => new FieldProvider(
75+
FieldModifiers.Private | FieldModifiers.ReadOnly,
76+
p.Type,
77+
ToFieldName(p.Name),
78+
this)).ToArray();
79+
_contextField = new FieldProvider(
80+
FieldModifiers.Private | FieldModifiers.ReadOnly,
81+
typeof(RequestContext),
82+
"_context",
83+
this);
84+
_diagnosticScopeField = new FieldProvider(
85+
FieldModifiers.Private | FieldModifiers.ReadOnly,
86+
typeof(string),
87+
"_diagnosticScope",
88+
this);
6589
}
6690

6791
protected override string BuildRelativeFilePath() =>
68-
System.IO.Path.Combine("src", "Generated", "CollectionResults", $"{Name}.cs");
92+
Path.Combine("src", "Generated", "CollectionResults", $"{Name}.cs");
6993

7094
protected override string BuildName()
7195
{
@@ -89,33 +113,7 @@ protected override CSharpType[] BuildImplements()
89113

90114
protected override FieldProvider[] BuildFields()
91115
{
92-
var fields = new List<FieldProvider>
93-
{
94-
new FieldProvider(
95-
FieldModifiers.Private | FieldModifiers.ReadOnly,
96-
_restClient.Type,
97-
"_client",
98-
this)
99-
};
100-
101-
// Add fields for constructor parameters
102-
foreach (var param in _constructorParameters)
103-
{
104-
fields.Add(new FieldProvider(
105-
FieldModifiers.Private | FieldModifiers.ReadOnly,
106-
param.Type,
107-
ToFieldName(param.Name),
108-
this));
109-
}
110-
111-
// Add _context field
112-
fields.Add(new FieldProvider(
113-
FieldModifiers.Private | FieldModifiers.ReadOnly,
114-
typeof(RequestContext),
115-
"_context",
116-
this));
117-
118-
return [.. fields];
116+
return [_clientField, .. _parameterFields, _contextField, _diagnosticScopeField];
119117
}
120118

121119
protected override ConstructorProvider[] BuildConstructors()
@@ -126,8 +124,10 @@ protected override ConstructorProvider[] BuildConstructors()
126124
};
127125
parameters.AddRange(_constructorParameters);
128126
parameters.Add(new ParameterProvider("context", $"The request options, which can override default behaviors of the client pipeline on a per-call basis.", typeof(RequestContext)));
127+
parameters.Add(new ParameterProvider("diagnosticScope", $"The diagnostic scope name.", typeof(string)));
129128

130-
var contextParam = parameters.Last();
129+
var contextParam = parameters[^2];
130+
var scopeParam = parameters[^1];
131131

132132
var signature = new ConstructorSignature(
133133
Type,
@@ -137,15 +137,16 @@ protected override ConstructorProvider[] BuildConstructors()
137137

138138
var bodyStatements = new List<MethodBodyStatement>
139139
{
140-
This.Property("_client").Assign(parameters[0]).Terminate()
140+
_clientField.Assign(parameters[0]).Terminate()
141141
};
142142

143-
foreach (var param in _constructorParameters)
143+
for (int i = 0; i < _constructorParameters.Count; i++)
144144
{
145-
bodyStatements.Add(This.Property(ToFieldName(param.Name)).Assign(param).Terminate());
145+
bodyStatements.Add(_parameterFields[i].Assign(_constructorParameters[i]).Terminate());
146146
}
147147

148-
bodyStatements.Add(This.Property("_context").Assign(contextParam).Terminate());
148+
bodyStatements.Add(_contextField.Assign(contextParam).Terminate());
149+
bodyStatements.Add(_diagnosticScopeField.Assign(scopeParam).Terminate());
149150

150151
return [new ConstructorProvider(signature, bodyStatements.ToArray(), this)];
151152
}
@@ -225,30 +226,30 @@ private MethodBodyStatement[] BuildGetNextResponseMethodBody()
225226
var requestArgs = new List<ValueExpression>();
226227

227228
// Add arguments from fields
228-
foreach (var param in _constructorParameters)
229+
foreach (var field in _parameterFields)
229230
{
230-
requestArgs.Add(This.Property(ToFieldName(param.Name)));
231+
requestArgs.Add(field);
231232
}
232233

233234
// Add context parameter
234-
requestArgs.Add(This.Property("_context"));
235+
requestArgs.Add(_contextField);
235236

236237
var bodyStatements = new List<MethodBodyStatement>
237238
{
238239
Declare("message", typeof(HttpMessage),
239-
This.Property("_client").Invoke(createRequestMethodName, requestArgs),
240+
_clientField.Invoke(createRequestMethodName, requestArgs),
240241
out var messageVariable),
241242
UsingDeclare("scope", typeof(DiagnosticScope),
242-
This.Property("_client").Property("ClientDiagnostics").Invoke("CreateScope", [Literal(_scopeName)]),
243+
_clientField.Property("ClientDiagnostics").Invoke("CreateScope", [_diagnosticScopeField]),
243244
out var scopeVariable),
244245
scopeVariable.Invoke("Start").Terminate()
245246
};
246247

247248
var tryStatements = new List<MethodBodyStatement>
248249
{
249-
Return(This.Property("_client").Property("Pipeline").Invoke(
250+
Return(_clientField.Property("Pipeline").Invoke(
250251
_isAsync ? "ProcessMessageAsync" : "ProcessMessage",
251-
[messageVariable, This.Property("_context")],
252+
[messageVariable, _contextField],
252253
_isAsync))
253254
};
254255

@@ -280,8 +281,8 @@ private MethodProvider BuildParseArrayFromResponseMethod()
280281
var bodyStatements = new List<MethodBodyStatement>
281282
{
282283
// using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
283-
UsingDeclare("document", typeof(System.Text.Json.JsonDocument),
284-
Static(typeof(System.Text.Json.JsonDocument)).Invoke("Parse",
284+
UsingDeclare("document", typeof(JsonDocument),
285+
Static(typeof(JsonDocument)).Invoke("Parse",
285286
new ValueExpression[]
286287
{
287288
responseParam.Property("Content"),
@@ -290,7 +291,7 @@ private MethodProvider BuildParseArrayFromResponseMethod()
290291
out var documentVariable),
291292

292293
// var array = document.RootElement;
293-
Declare("array", typeof(System.Text.Json.JsonElement),
294+
Declare("array", typeof(JsonElement),
294295
documentVariable.Property("RootElement"),
295296
out var arrayVariable),
296297

@@ -300,8 +301,8 @@ private MethodProvider BuildParseArrayFromResponseMethod()
300301
out var resultVariable),
301302

302303
// foreach (var element in array.EnumerateArray())
303-
new Microsoft.TypeSpec.Generator.Statements.ForEachStatement(
304-
typeof(System.Text.Json.JsonElement),
304+
new ForEachStatement(
305+
typeof(JsonElement),
305306
"element",
306307
arrayVariable.Invoke("EnumerateArray"),
307308
isAsync: false,
@@ -312,11 +313,11 @@ private MethodProvider BuildParseArrayFromResponseMethod()
312313
resultVariable.Invoke("Add",
313314
new ValueExpression[]
314315
{
315-
Static(new CSharpType(typeof(System.ClientModel.Primitives.ModelReaderWriter))).Invoke("Read",
316+
Static(new CSharpType(typeof(ModelReaderWriter))).Invoke("Read",
316317
new ValueExpression[]
317318
{
318319
New.Instance(typeof(BinaryData),
319-
Static(typeof(System.Text.Encoding)).Property("UTF8").Invoke("GetBytes",
320+
Static(typeof(Encoding)).Property("UTF8").Invoke("GetBytes",
320321
elementVariable.Invoke("GetRawText"))),
321322
Static<ModelSerializationExtensionsDefinition>().Property("WireOptions"),
322323
Static(ManagementClientGenerator.Instance.OutputLibrary.ModelReaderWriterContextType).Property("Default")

eng/packages/http-client-csharp-mgmt/generator/Azure.Generator.Management/src/Providers/OperationMethodProviders/ArrayResponseOperationMethodProvider.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,6 @@ protected MethodSignature CreateSignature()
157157
var scopeName = ResourceHelpers.GetDiagnosticScope(_enclosingType, _methodName, _isAsync);
158158
var collectionResult = CreateCollectionResultDefinition(scopeName);
159159

160-
// Register the collection result with the output library
161-
ManagementClientGenerator.Instance.OutputLibrary.PageableMethodScopes.Add(collectionResult.Name, scopeName);
162-
163160
statements.Add(ResourceMethodSnippets.CreateRequestContext(KnownParameters.CancellationTokenParameter, out var contextVariable));
164161

165162
var requestMethod = _restClient.GetRequestMethodByOperation(_serviceMethod.Operation);
@@ -170,6 +167,7 @@ protected MethodSignature CreateSignature()
170167
};
171168

172169
arguments.AddRange(_parameterMapping.PopulateArguments(This.As<ArmResource>().Id(), requestMethod.Signature.Parameters, contextVariable, _signature.Parameters));
170+
arguments.Add(Literal(scopeName));
173171

174172
// Handle ResourceData type conversion if needed
175173
if (_itemResourceClient != null)
@@ -199,9 +197,7 @@ private ArrayResponseCollectionResultDefinition CreateCollectionResultDefinition
199197
_restClient,
200198
_serviceMethod,
201199
_itemType,
202-
_listType,
203200
_isAsync,
204-
scopeName,
205201
constructorParams,
206202
_methodName, // Pass the actual method name for proper class naming
207203
_enclosingType.Name); // Pass the enclosing type name (e.g., "FooResource")

eng/packages/http-client-csharp-mgmt/generator/Azure.Generator.Management/src/Providers/OperationMethodProviders/PageableOperationMethodProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ protected MethodBodyStatement[] BuildBodyStatements()
128128

129129
var collectionResult = ((ScmMethodProvider)_convenienceMethod).CollectionDefinition!;
130130
var diagnosticScope = ResourceHelpers.GetDiagnosticScope(_enclosingType, _methodName, _isAsync);
131-
ManagementClientGenerator.Instance.OutputLibrary.PageableMethodScopes.Add(collectionResult.Name, diagnosticScope);
132131

133132
var collectionResultOfT = collectionResult.Type;
134133
statements.Add(ResourceMethodSnippets.CreateRequestContext(KnownParameters.CancellationTokenParameter, out var contextVariable));
@@ -141,6 +140,7 @@ protected MethodBodyStatement[] BuildBodyStatements()
141140
};
142141

143142
arguments.AddRange(_parameterMappings.PopulateArguments(This.As<ArmResource>().Id(), requestMethod.Signature.Parameters, contextVariable, _signature.Parameters));
143+
arguments.Add(Literal(diagnosticScope));
144144

145145
// Handle ResourceData type conversion if needed
146146
if (_itemResourceClient != null)

0 commit comments

Comments
 (0)