Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
c3ad768
Initial plan
Copilot Sep 29, 2026
c843255
fix(http-client-csharp): normalize operation parameter acronyms safely
Copilot Sep 29, 2026
830bb8e
fix(http-client-csharp): retain existing date parameter compatibility
Copilot Sep 29, 2026
d758e39
test(http-client-csharp): cover restored named argument targets
Copilot Sep 29, 2026
e6dd983
refactor(http-client-csharp): address parameter naming review feedback
jorgerangel-msft Oct 7, 2026
07fd0ec
fix(http-client-csharp): construct operation parameters per signature
jorgerangel-msft Oct 7, 2026
065de99
refactor(http-client-csharp): simplify parameter signature construction
jorgerangel-msft Oct 8, 2026
1472ffe
test(http-client-csharp): cover preserved spread parameter signatures
jorgerangel-msft Oct 8, 2026
70604a8
chore: merge latest main and regenerate the sample code model
jorgerangel-msft Oct 8, 2026
e57a7a0
Merge remote-tracking branch 'origin/main' into copilot/http-client-c…
Copilot Oct 9, 2026
ed2db4f
Simplify operation parameter matching
Copilot Oct 9, 2026
4d831a2
refactor(http-client-csharp): use final callee signatures for argumen…
jorgerangel-msft Oct 9, 2026
cd59955
chore: integrate concurrent PR updates
jorgerangel-msft Oct 9, 2026
4238574
fix(http-client-csharp): preserve client-scoped parameter names
jorgerangel-msft Oct 9, 2026
de8f9c6
fix(http-client-csharp): preserve legacy parameter signature compatib…
jorgerangel-msft Oct 9, 2026
d1b8024
fix(http-client-csharp): preserve published parameter identities and …
jorgerangel-msft Oct 9, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,21 @@ internal static class ScmKnownParameters
public static readonly ParameterProvider Data = new("data", FormattableStringHelpers.Empty, typeof(BinaryData));
public static ParameterProvider ClientOptions(CSharpType clientOptionsType)
=> new("options", $"The options for configuring the client.", clientOptionsType, initializationValue: New.Instance(clientOptionsType));
public static readonly ParameterProvider OptionalRequestOptions = new(
public static readonly ParameterProvider OptionalRequestOptions = CreateRequestOptions(optional: true);
public static readonly ParameterProvider RequestOptions = CreateRequestOptions();
public static readonly ParameterProvider CancellationToken = CreateCancellationToken();

public static ParameterProvider CreateRequestOptions(bool optional = false) => new(
ScmCodeModelGenerator.Instance.TypeFactory.HttpRequestOptionsApi.ParameterName,
$"The request options, which can override default behaviors of the client pipeline on a per-call basis.",
ScmCodeModelGenerator.Instance.TypeFactory.HttpRequestOptionsApi.HttpRequestOptionsType,
defaultValue: Null);
public static readonly ParameterProvider RequestOptions = new(ScmCodeModelGenerator.Instance.TypeFactory.HttpRequestOptionsApi.ParameterName, $"The request options, which can override default behaviors of the client pipeline on a per-call basis.", ScmCodeModelGenerator.Instance.TypeFactory.HttpRequestOptionsApi.HttpRequestOptionsType);
public static readonly ParameterProvider CancellationToken = new("cancellationToken", $"The cancellation token that can be used to cancel the operation.", new CSharpType(typeof(CancellationToken)), defaultValue: Default);
Comment thread
jorgerangel-msft marked this conversation as resolved.
defaultValue: optional ? Null : null);

public static ParameterProvider CreateCancellationToken() => new(
Comment thread
jorgerangel-msft marked this conversation as resolved.
"cancellationToken",
$"The cancellation token that can be used to cancel the operation.",
new CSharpType(typeof(CancellationToken)),
defaultValue: Default);
Comment thread
jorgerangel-msft marked this conversation as resolved.

private static readonly FormattableString RequestContentDescription = $"The content to send as the body of the request.";
private const string RequestContentParameterName = "content";
Expand Down Expand Up @@ -66,20 +74,15 @@ public static ParameterProvider ClientOptions(CSharpType clientOptionsType)
private static readonly FormattableString ContentTypeDescription = $"The contentType to use which has the multipart/form-data boundary.";
private static readonly PropertyWireInformation ContentTypeWireInfo = new(SerializationFormat.Default, true, false, false, false, "Content-Type", false, false);

public static readonly ParameterProvider ContentType = new(
ContentTypeParameterName,
ContentTypeDescription,
typeof(string),
wireInfo: ContentTypeWireInfo)
{
Validation = ParameterValidationType.AssertNotNullOrEmpty,
};
public static readonly ParameterProvider ContentType = CreateContentType(isRequired: true);
public static readonly ParameterProvider OptionalContentType = CreateContentType(isRequired: false);

public static readonly ParameterProvider OptionalContentType = new(
public static ParameterProvider CreateContentType(bool isRequired) => new(
ContentTypeParameterName,
ContentTypeDescription,
typeof(string),
wireInfo: ContentTypeWireInfo);
wireInfo: ContentTypeWireInfo,
validation: isRequired ? ParameterValidationType.AssertNotNullOrEmpty : ParameterValidationType.None);

public static readonly ParameterProvider NextPage =
new ParameterProvider("nextPage", $"The url of the next page of responses.", typeof(Uri));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1489,7 +1489,7 @@ protected sealed override IReadOnlyList<MethodProvider> BuildMethodsForBackCompa
foreach (var (method, originalSignature) in originalSignatures)
{
if (method.Signature.Name.Equals(originalSignature.Name)
&& !MethodSignatureHelper.HaveSameParametersInSameOrder(method.Signature, originalSignature))
&& !method.Signature.Parameters.SequenceEqual(originalSignature.Parameters, ReferenceEqualityComparer.Instance))
{
updatedSignatureToOriginal.TryAdd(method.Signature, originalSignature);
methodsWithReorderedParams.Add(method);
Expand Down Expand Up @@ -1860,23 +1860,34 @@ private static void ReorderMethodInvocationArguments(
MethodSignature updatedSignature)
{
var argumentCount = invocation.Arguments.Count;
if (argumentCount != originalSignature.Parameters.Count)
if (argumentCount > originalSignature.Parameters.Count)
{
return;
}

var argumentsByName = new Dictionary<string, ValueExpression>(argumentCount);
for (int i = 0; i < argumentCount; i++)
{
argumentsByName.TryAdd(originalSignature.Parameters[i].Name, invocation.Arguments[i]);
var argument = invocation.Arguments[i];
var parameterName = argument is PositionalParameterReferenceExpression named
? named.ParameterName
: originalSignature.Parameters[i].Name;
argumentsByName.Add(parameterName, argument);
}

var reorderedArgs = new List<ValueExpression>(updatedSignature.Parameters.Count);
bool requireNamedArgs = false;
foreach (var param in updatedSignature.Parameters)
{
if (argumentsByName.TryGetValue(param.Name, out var arg))
{
reorderedArgs.Add(arg);
reorderedArgs.Add(requireNamedArgs && arg is not PositionalParameterReferenceExpression
? param.PositionalReference(arg)
: arg);
}
else
{
requireNamedArgs = true;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ protected override ScmMethodProvider[] BuildMethods()

private ScmMethodProvider BuildCreateRequestMethod(InputServiceMethod serviceMethod, bool isNextLinkRequest = false)
{
var options = ScmKnownParameters.RequestOptions;
var options = ScmKnownParameters.CreateRequestOptions();
var parameters = GetMethodParameters(serviceMethod, ScmMethodKind.CreateRequest, ClientProvider);

if (isNextLinkRequest)
Expand Down Expand Up @@ -266,7 +266,7 @@ private MethodBodyStatements BuildMessage(
{
// Create required components
var pipelineField = ClientProvider.PipelineProperty.ToApi<ClientPipelineApi>();
var options = ScmKnownParameters.RequestOptions;
var options = signature.Parameters[^1];
var operation = serviceMethod.Operation;
var classifier = GetClassifier(operation);

Expand Down Expand Up @@ -1417,7 +1417,7 @@ internal static List<ParameterProvider> GetMethodParameters(
{
bool bodyIsRequired = methodType == ScmMethodKind.Protocol
&& operation.Parameters.OfType<InputBodyParameter>().Any(p => p.IsRequired);
sortedParams.Add(contentType++, bodyIsRequired ? ScmKnownParameters.ContentType : ScmKnownParameters.OptionalContentType);
sortedParams.Add(contentType++, ScmKnownParameters.CreateContentType(bodyIsRequired));
}

if (methodType == ScmMethodKind.CreateRequest)
Expand Down
Loading
Loading