diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/Abstractions/ClientPipelineApi.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/Abstractions/ClientPipelineApi.cs index c06c53292a0..65b5c1795de 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/Abstractions/ClientPipelineApi.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/Abstractions/ClientPipelineApi.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using Microsoft.TypeSpec.Generator.ClientModel.Snippets; using Microsoft.TypeSpec.Generator.Expressions; using Microsoft.TypeSpec.Generator.Primitives; using Microsoft.TypeSpec.Generator.Snippets; @@ -37,6 +38,21 @@ public abstract MethodBodyStatement[] CreateMessage( public abstract ValueExpression KeyAuthorizationPolicy(ValueExpression credential, ValueExpression headerName, ValueExpression? keyPrefix = null); public abstract ValueExpression TokenAuthorizationPolicy(ValueExpression credential, ValueExpression scopes); public virtual ValueExpression? UserAgentPolicy(CSharpType clientType) => null; + + /// + /// Gets whether the client options of this pipeline carry model proxies. When true, generated clients store + /// the options returned by and pass them to every model + /// they read and write in their operations. Pipelines whose client options don't carry model proxies keep the + /// default (false), and their clients use the shared wire options. + /// + public virtual bool SupportsModelProxies => false; + + /// + /// Gets the ModelReaderWriterOptions a generated client uses to read and write models in its operations, + /// built from its client options. Only called when is true. + /// + /// The client options expression. + public virtual ValueExpression GetModelReaderWriterOptions(ValueExpression clientOptions) => ModelSerializationExtensionsSnippets.Wire; public abstract ClientPipelineApi FromExpression(ValueExpression expression); public abstract ClientPipelineApi ToExpression(); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/BinaryContentHelperDefinition.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/BinaryContentHelperDefinition.cs index 9118211f1a6..82382572e9f 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/BinaryContentHelperDefinition.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/BinaryContentHelperDefinition.cs @@ -3,6 +3,7 @@ using System; using System.ClientModel; +using System.ClientModel.Primitives; using System.Collections.Generic; using System.IO; using System.Xml; @@ -35,6 +36,25 @@ public class BinaryContentHelperDefinition : InternalHelperProvider protected override IReadOnlyList BuildBodyDependencyTypes() => [ScmCodeModelGenerator.Instance.ModelSerializationExtensionsDefinition.Type]; + // Clients whose options carry model proxies pass their options so the proxies apply to the items written here. + // The parameter is optional so existing callers, such as custom code, keep writing with the wire options. + private static ParameterProvider? CreateOptionsParameter() + => ScmCodeModelGenerator.Instance.TypeFactory.ClientPipelineApi.ToExpression().SupportsModelProxies + ? new ParameterProvider("options", FormattableStringHelpers.Empty, typeof(ModelReaderWriterOptions), defaultValue: Null) + : null; + + private static ScopedApi GetOptions(ParameterProvider? optionsParameter) + => optionsParameter?.As() ?? ModelSerializationExtensionsSnippets.Wire; + + // options ??= ModelSerializationExtensions.WireOptions; + private static MethodBodyStatement DefaultOptions(ParameterProvider? optionsParameter) + => optionsParameter is null + ? MethodBodyStatement.Empty + : optionsParameter.Assign(ModelSerializationExtensionsSnippets.Wire, nullCoalesce: true).Terminate(); + + private static ParameterProvider[] WithOptions(ParameterProvider? optionsParameter, params ParameterProvider[] parameters) + => optionsParameter is null ? parameters : [.. parameters, optionsParameter]; + protected override MethodProvider[] BuildMethods() { var methods = new List @@ -61,10 +81,11 @@ private MethodProvider BuildFromEnumerableTMethod() var enumerableTType = typeof(IEnumerable<>); CSharpType tType = enumerableTType.GetGenericArguments()[0]; var enumerableParameter = new ParameterProvider("enumerable", FormattableStringHelpers.Empty, enumerableTType); + var optionsParameter = CreateOptionsParameter(); var signature = new MethodSignature( Name: _fromEnumerableName, Modifiers: _methodModifiers, - Parameters: [enumerableParameter], + Parameters: WithOptions(optionsParameter, enumerableParameter), ReturnType: _requestBodyType, GenericArguments: [tType], GenericParameterConstraints: [Where.NotNull(tType)], @@ -73,6 +94,7 @@ private MethodProvider BuildFromEnumerableTMethod() var body = new List { + DefaultOptions(optionsParameter), Declare("content", New.Instance(), out var content) }; var writer = content.JsonWriter(); @@ -81,7 +103,7 @@ private MethodProvider BuildFromEnumerableTMethod() writer.WriteStartArray(), new ForEachStatement("item", enumerableParameter.As(enumerableParameter.Type), out var item) { - writer.WriteObjectValue(item.As(tType), ModelSerializationExtensionsSnippets.Wire) + writer.WriteObjectValue(item.As(tType), GetOptions(optionsParameter)) }, writer.WriteEndArray(), MethodBodyStatement.EmptyLine, @@ -130,10 +152,11 @@ private MethodProvider BuildFromReadOnlySpanMethod() var spanType = typeof(ReadOnlySpan<>); CSharpType tType = spanType.GetGenericArguments()[0]; var spanParameter = new ParameterProvider("span", FormattableStringHelpers.Empty, spanType); + var optionsParameter = CreateOptionsParameter(); var signature = new MethodSignature( Name: _fromEnumerableName, Modifiers: _methodModifiers, - Parameters: [spanParameter], + Parameters: WithOptions(optionsParameter, spanParameter), ReturnType: _requestBodyType, GenericArguments: [tType], GenericParameterConstraints: [Where.NotNull(tType)], @@ -142,6 +165,7 @@ private MethodProvider BuildFromReadOnlySpanMethod() var body = new List { + DefaultOptions(optionsParameter), Declare("content", New.Instance(), out var content) }; var writer = content.JsonWriter(); @@ -151,7 +175,7 @@ private MethodProvider BuildFromReadOnlySpanMethod() Declare("i", Int(0), out var i), new ForStatement(null, i.LessThan(spanParameter.Property(nameof(ReadOnlySpan.Length))), i.Increment()) { - writer.WriteObjectValue(new IndexerExpression(spanParameter, i).As(tType), ModelSerializationExtensionsSnippets.Wire) + writer.WriteObjectValue(new IndexerExpression(spanParameter, i).As(tType), GetOptions(optionsParameter)) }, writer.WriteEndArray(), MethodBodyStatement.EmptyLine, @@ -166,10 +190,11 @@ private MethodProvider BuildFromDictionaryTMethod() var dictionaryTType = typeof(IDictionary<,>); CSharpType valueType = dictionaryTType.GetGenericArguments()[1]; var dictionaryParameter = new ParameterProvider("dictionary", FormattableStringHelpers.Empty, new CSharpType(dictionaryTType, typeof(string), valueType)); + var optionsParameter = CreateOptionsParameter(); var signature = new MethodSignature( Name: _fromDictionaryName, Modifiers: _methodModifiers, - Parameters: [dictionaryParameter], + Parameters: WithOptions(optionsParameter, dictionaryParameter), ReturnType: _requestBodyType, GenericArguments: [valueType], GenericParameterConstraints: [Where.NotNull(valueType)], @@ -178,6 +203,7 @@ private MethodProvider BuildFromDictionaryTMethod() var body = new List { + DefaultOptions(optionsParameter), Declare("content", New.Instance(), out var content) }; var writer = content.JsonWriter(); @@ -187,7 +213,7 @@ private MethodProvider BuildFromDictionaryTMethod() new ForEachStatement("item", dictionaryParameter.As(dictionaryParameter.Type), out var item) { writer.WritePropertyName(item.Property("Key")), - writer.WriteObjectValue(item.Property("Value").As(valueType), ModelSerializationExtensionsSnippets.Wire) + writer.WriteObjectValue(item.Property("Value").As(valueType), GetOptions(optionsParameter)) }, writer.WriteEndObject(), MethodBodyStatement.EmptyLine, @@ -285,10 +311,11 @@ private MethodProvider BuildFromEnumerableXmlMethod() var enumerableParameter = new ParameterProvider("enumerable", FormattableStringHelpers.Empty, enumerableTType); var rootNameHintParameter = new ParameterProvider("rootNameHint", FormattableStringHelpers.Empty, typeof(string)); var childNameHintParameter = new ParameterProvider("childNameHint", FormattableStringHelpers.Empty, typeof(string)); + var optionsParameter = CreateOptionsParameter(); var signature = new MethodSignature( Name: _fromEnumerableName, Modifiers: _methodModifiers, - Parameters: [enumerableParameter, rootNameHintParameter, childNameHintParameter], + Parameters: WithOptions(optionsParameter, enumerableParameter, rootNameHintParameter, childNameHintParameter), ReturnType: _requestBodyType, GenericArguments: [tType], GenericParameterConstraints: [Where.NotNull(tType)], @@ -304,7 +331,7 @@ private MethodProvider BuildFromEnumerableXmlMethod() xmlWriter.WriteStartElement(rootNameHintParameter), new ForEachStatement("item", enumerableParameter.As(enumerableParameter.Type), out var item) { - xmlWriter.WriteObjectValue(item.As(tType), ModelSerializationExtensionsSnippets.Wire, childNameHintParameter) + xmlWriter.WriteObjectValue(item.As(tType), GetOptions(optionsParameter), childNameHintParameter) }, xmlWriter.WriteEndElement(), ]); @@ -319,7 +346,7 @@ private MethodProvider BuildFromEnumerableXmlMethod() [Int(0), streamVar.Property(nameof(MemoryStream.Position)).CastTo(typeof(int))]))))) ]); - var body = new MethodBodyStatement[] { outerUsing }; + var body = new MethodBodyStatement[] { DefaultOptions(optionsParameter), outerUsing }; return new MethodProvider(signature, body, this); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientPipelineProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientPipelineProvider.cs index 6a93b77942e..2b9abe0b512 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientPipelineProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientPipelineProvider.cs @@ -3,6 +3,7 @@ using System.ClientModel; using System.ClientModel.Primitives; +using Microsoft.TypeSpec.Generator.ClientModel.Snippets; using Microsoft.TypeSpec.Generator.Expressions; using Microsoft.TypeSpec.Generator.Primitives; using Microsoft.TypeSpec.Generator.Snippets; @@ -33,6 +34,12 @@ public ClientPipelineProvider(ValueExpression original) : base(typeof(ClientPipe public override ValueExpression Create(ValueExpression options, ValueExpression perRetryPolicies) => Static().Invoke(nameof(ClientPipeline.Create), [options, New.Array(ScmCodeModelGenerator.Instance.TypeFactory.ClientPipelineApi.PipelinePolicyType), perRetryPolicies, New.Array(ScmCodeModelGenerator.Instance.TypeFactory.ClientPipelineApi.PipelinePolicyType)]).As(); + public override bool SupportsModelProxies => true; + + // Copies ClientPipelineOptions.ModelProxies into the client's options; creating the pipeline freezes them. + public override ValueExpression GetModelReaderWriterOptions(ValueExpression clientOptions) + => ModelSerializationExtensionsSnippets.ToWireOptions(clientOptions.Property(nameof(ClientPipelineOptions.ModelProxies))); + public override MethodBodyStatement[] CreateMessage( HttpRequestOptionsApi requestOptions, ValueExpression uri, diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs index 391b2bbe5ff..20584b13688 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs @@ -10,6 +10,7 @@ using System.Linq; using System.Threading; using Microsoft.TypeSpec.Generator.ClientModel.Primitives; +using Microsoft.TypeSpec.Generator.ClientModel.Snippets; using Microsoft.TypeSpec.Generator.ClientModel.Utilities; using Microsoft.TypeSpec.Generator.EmitterRpc; using Microsoft.TypeSpec.Generator.Expressions; @@ -41,6 +42,7 @@ private record ApiVersionFields(FieldProvider Field, PropertyProvider? Correspon private const string TokenProviderFieldName = "_tokenProvider"; private const string TokenCredentialFieldName = "_tokenCredential"; private const string EndpointFieldName = "_endpoint"; + private const string ModelReaderWriterOptionsFieldName = "_modelReaderWriterOptions"; private const string CredentialParamName = "credential"; private const string SettingsParamName = "settings"; private const string ClientSuffix = "Client"; @@ -182,6 +184,16 @@ public ClientProvider(InputClient inputClient) typeof(Uri), EndpointFieldName, this); + // Clients created through the mocking constructor skip the constructors that copy the client options' proxies, + // so the field starts with the shared wire options to keep their convenience methods working. + ModelReaderWriterOptionsField = ScmCodeModelGenerator.Instance.TypeFactory.ClientPipelineApi.ToExpression().SupportsModelProxies + ? new FieldProvider( + FieldModifiers.Private | FieldModifiers.ReadOnly, + typeof(ModelReaderWriterOptions), + ModelReaderWriterOptionsFieldName, + this, + initializationValue: ModelSerializationExtensionsSnippets.Wire) + : null; PipelineProperty = new( description: $"The HTTP pipeline for sending and receiving REST requests and responses.", modifiers: MethodSignatureModifiers.Public, @@ -515,6 +527,12 @@ private IReadOnlyList GetSubClientInternalConstructorParamete PipelineProperty.AsParameter }; + // The parent passes the options it built from its client options so subclient operations use the same proxies. + if (ModelReaderWriterOptionsField != null) + { + subClientParameters.Add(ModelReaderWriterOptionsField.AsParameter); + } + // Auth credentials are NOT included here — the parent passes its authenticated // pipeline, so the sub-client doesn't need separate credential parameters. subClientParameters.Add(_subClientEndpointParameter); @@ -624,6 +642,12 @@ private IReadOnlyList GetClientParameters() public PropertyProvider PipelineProperty { get; } public FieldProvider EndpointField { get; } + /// + /// Gets the field holding the the client uses to read and write models, or + /// null when the client pipeline options don't carry model proxies. + /// + public FieldProvider? ModelReaderWriterOptionsField { get; } + public IReadOnlyList SubClients => _subClients.Value; protected override string BuildRelativeFilePath() => Path.Combine("src", "Generated", $"{Name}.cs"); @@ -750,6 +774,11 @@ protected override FieldProvider[] BuildFields() { List fields = [EndpointField]; + if (ModelReaderWriterOptionsField != null) + { + fields.Add(ModelReaderWriterOptionsField); + } + if (_apiKeyAuthFields != null) { // No longer add AuthField (_keyCredential) — auth is handled via AuthenticationPolicy parameter in the internal constructor @@ -1361,6 +1390,13 @@ private MethodBodyStatement[] BuildPrimaryConstructorBody(IReadOnlyList().Create(clientOptionsParameter, perRetryPolicies)).Terminate()); } + // Creating the pipeline freezes the client options, so the options built here can't change afterwards. + if (ModelReaderWriterOptionsField != null) + { + body.Add(ModelReaderWriterOptionsField.Assign( + This.ToApi().GetModelReaderWriterOptions(clientOptionsParameter)).Terminate()); + } + foreach (var f in Fields) { var fieldInfo = _apiVersionFields?.FirstOrDefault(fieldInfo => fieldInfo.Field == f); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/CollectionResultDefinition.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/CollectionResultDefinition.cs index 5b636e56dc5..cb3e17d6a45 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/CollectionResultDefinition.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/CollectionResultDefinition.cs @@ -29,6 +29,12 @@ public class CollectionResultDefinition : TypeProvider protected ClientProvider Client { get; } protected FieldProvider ClientField { get; } + /// + /// Gets the field holding the client's , or null when the client + /// doesn't carry model proxies. + /// + protected FieldProvider? ModelReaderWriterOptionsField { get; } + protected InputOperation Operation { get; } protected InputPagingServiceMetadata Paging { get; } @@ -76,6 +82,13 @@ public CollectionResultDefinition(ClientProvider client, InputPagingServiceMetho Client.Type, "_client", this); + ModelReaderWriterOptionsField = Client.ModelReaderWriterOptionsField != null + ? new FieldProvider( + FieldModifiers.Private | FieldModifiers.ReadOnly, + typeof(ModelReaderWriterOptions), + "_modelReaderWriterOptions", + this) + : null; Operation = serviceMethod.Operation; Paging = serviceMethod.PagingMetadata; IsAsync = isAsync; @@ -237,7 +250,10 @@ protected override IReadOnlyList BuildBodyDependencyTypes() return dependencies; } - protected override FieldProvider[] BuildFields() => [ClientField, .. RequestFields]; + protected override FieldProvider[] BuildFields() + => ModelReaderWriterOptionsField != null + ? [ClientField, ModelReaderWriterOptionsField, .. RequestFields] + : [ClientField, .. RequestFields]; protected override CSharpType[] BuildImplements() => (_modelType: ItemModelType, IsAsync) switch @@ -254,6 +270,12 @@ protected override ConstructorProvider[] BuildConstructors() "client", $"The {Client.Type.Name} client used to send requests.", Client.Type); + var modelReaderWriterOptionsParameter = ModelReaderWriterOptionsField != null + ? new ParameterProvider( + "modelReaderWriterOptions", + $"The options used to read the pages, including the model proxies configured on the client options.", + typeof(ModelReaderWriterOptions)) + : null; return [ new ConstructorProvider( @@ -261,30 +283,39 @@ protected override ConstructorProvider[] BuildConstructors() Type, $"Initializes a new instance of {Name}, which is used to iterate over the pages of a collection.", MethodSignatureModifiers.Public, - [ - clientParameter, - .. CreateRequestParameters - ]), - BuildConstructorBody(clientParameter), + modelReaderWriterOptionsParameter != null + ? [clientParameter, modelReaderWriterOptionsParameter, .. CreateRequestParameters] + : [clientParameter, .. CreateRequestParameters]), + BuildConstructorBody(clientParameter, modelReaderWriterOptionsParameter), this) ]; } private ValueExpression GetPropertyExpression(IReadOnlyList segments, ValueExpression response) { - return BuildGetPropertyExpression(segments, response.CastTo(ResponseModelType)); + return BuildGetPropertyExpression(segments, ToResponseModel(response)); } + // The cast operator can't take the client's options, so it would skip the configured model proxies. + private ValueExpression ToResponseModel(ValueExpression response) + => ModelReaderWriterOptionsField != null && MrwSerializationTypeDefinition.HasResponseConversion(ResponseModelType) + ? Static(ResponseModelType).Invoke(MrwSerializationTypeDefinition.FromResponseMethodName, [response, ModelReaderWriterOptionsField]) + : response.CastTo(ResponseModelType); + protected ValueExpression BuildGetPropertyExpression(IReadOnlyList segments, ValueExpression responseModel) { return ResponseModel.GetPropertyExpression(responseModel, segments); } - private MethodBodyStatement[] BuildConstructorBody(ParameterProvider clientParameter) + private MethodBodyStatement[] BuildConstructorBody(ParameterProvider clientParameter, ParameterProvider? modelReaderWriterOptionsParameter) { - var statements = new List(CreateRequestParameters.Count + 1); + var statements = new List(CreateRequestParameters.Count + 2); statements.Add(ClientField.Assign(clientParameter).Terminate()); + if (ModelReaderWriterOptionsField != null && modelReaderWriterOptionsParameter != null) + { + statements.Add(ModelReaderWriterOptionsField.Assign(modelReaderWriterOptionsParameter).Terminate()); + } for (int parameterNumber = 0; parameterNumber < CreateRequestParameters.Count; parameterNumber++) { @@ -502,7 +533,7 @@ private MethodBodyStatement[] BuildGetRawPagesForNextLink() MethodBodyStatement.EmptyLine, // Assign nextLinkUri from the result and check if it is null - AssignAndCheckNextPageVariable(result, result.CastTo(ResponseModelType), nextPageVariable), + AssignAndCheckNextPageVariable(result, ToResponseModel(result), nextPageVariable), // Update message for next iteration message.Assign(InvokeCreateRequestForNextLink(nextPageVariable)).Terminate() @@ -537,7 +568,7 @@ private MethodBodyStatement[] BuildGetRawPagesForContinuationToken() MethodBodyStatement.EmptyLine, // Assign nextLinkUri from the result and check if it is null - AssignAndCheckNextPageVariable(result, result.CastTo(ResponseModelType), nextTokenVariable), + AssignAndCheckNextPageVariable(result, ToResponseModel(result), nextTokenVariable), // Update message for next iteration message.Assign(InvokeCreateRequestForContinuationToken(nextTokenVariable)).Terminate() diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/DiscriminatedUnionSerialization.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/DiscriminatedUnionSerialization.cs index f03b2d24cce..59a54d3fae6 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/DiscriminatedUnionSerialization.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/DiscriminatedUnionSerialization.cs @@ -67,9 +67,9 @@ internal static MethodProvider[] BuildMethods(InputUnionType union, TypeProvider .Or(payload.ValueKind().NotEqual(FrameworkEnumValue(JsonValueKind.Object))); var cases = subtypes.Select(entry => new SwitchCaseStatement( Literal(entry.Key), - Return(MrwSerializationTypeDefinition.GetDeserializationMethodInvocationForType( + Return(MrwSerializationTypeDefinition.GetProxyAwareDeserializationMethodInvocation( GetModelType(entry.Value), - payload, payload.GetUtf8Bytes(), options)))).ToList(); + payload, payload.GetUtf8Bytes(), options.As())))).ToList(); cases.Add(SwitchCaseStatement.Default(Throw(New.Instance( Literal($"Unknown discriminator value for union '{union.Name}'."))))); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelSerializationExtensionsDefinition.ModelProxies.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelSerializationExtensionsDefinition.ModelProxies.cs new file mode 100644 index 00000000000..e2fa78b6b58 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelSerializationExtensionsDefinition.ModelProxies.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.ClientModel.Primitives; +using System.Collections.Generic; +using Microsoft.TypeSpec.Generator.ClientModel.Snippets; +using Microsoft.TypeSpec.Generator.Expressions; +using Microsoft.TypeSpec.Generator.Primitives; +using Microsoft.TypeSpec.Generator.Providers; +using Microsoft.TypeSpec.Generator.Snippets; +using Microsoft.TypeSpec.Generator.Statements; +using static Microsoft.TypeSpec.Generator.Snippets.Snippet; + +namespace Microsoft.TypeSpec.Generator.ClientModel.Providers +{ + public sealed partial class ModelSerializationExtensionsDefinition + { + private const string IsBuildableMethodName = "IsBuildable"; + internal const string ToWireOptionsMethodName = "ToWireOptions"; + + private ProxyReadEligibilityDefinition? _proxyReadEligibility; + private ProxyReadEligibilityDefinition ProxyReadEligibility => _proxyReadEligibility ??= new(this, _t); + + protected override TypeProvider[] BuildNestedTypes() => [ProxyReadEligibility]; + + private MethodProvider[] BuildModelProxyMethods() + { + MethodProvider shouldReadThroughProxy = BuildShouldReadThroughProxyMethodProvider(); + return ScmCodeModelGenerator.Instance.TypeFactory.ClientPipelineApi.ToExpression().SupportsModelProxies + ? [shouldReadThroughProxy, BuildToWireOptionsMethodProvider()] + : [shouldReadThroughProxy]; + } + + // Clients keep the shared wire options when no proxies are configured so model reads and writes keep their fast paths. + private MethodProvider BuildToWireOptionsMethodProvider() + { + var modelProxiesParameter = new ParameterProvider("modelProxies", FormattableStringHelpers.Empty, typeof(IList)); + var signature = new MethodSignature( + Name: ToWireOptionsMethodName, + Modifiers: _methodModifiers, + Parameters: [modelProxiesParameter], + ReturnType: typeof(ModelReaderWriterOptions), + Description: null, + ReturnDescription: null); + + var body = new MethodBodyStatement[] + { + new IfStatement(modelProxiesParameter.Property(nameof(ICollection.Count)).Equal(Int(0))) + { + Return(WireOptionsField) + }, + Declare("options", typeof(ModelReaderWriterOptions), New.Instance(typeof(ModelReaderWriterOptions), ModelReaderWriterOptionsSnippets.WireFormat), out var options), + new ForEachStatement(typeof(ModelProxy), "proxy", modelProxiesParameter, false, out var proxy) + { + options.Property(nameof(ModelReaderWriterOptions.Proxies)).Invoke(nameof(IList.Add), proxy).Terminate() + }, + Return(options) + }; + + return new MethodProvider(signature, body, this, XmlDocProvider.Empty); + } + + // ShouldReadThroughProxy(this ModelReaderWriterOptions options, ModelReaderWriterContext context) + // => options.Proxies.Count > 0 && ProxyReadEligibility.IsBuildable(context); + private MethodProvider BuildShouldReadThroughProxyMethodProvider() + { + var optionsParameter = new ParameterProvider("options", FormattableStringHelpers.Empty, typeof(ModelReaderWriterOptions)); + var contextParameter = new ParameterProvider("context", FormattableStringHelpers.Empty, typeof(ModelReaderWriterContext)); + var signature = new MethodSignature( + Name: ModelSerializationExtensionsSnippets.ShouldReadThroughProxyMethodName, + Modifiers: _methodModifiers, + Parameters: [optionsParameter, contextParameter], + ReturnType: typeof(bool), + Description: null, + ReturnDescription: null, + GenericArguments: [_t]); + + var isBuildable = Static(ProxyReadEligibility.Type).Invoke(IsBuildableMethodName, [contextParameter]); + var body = Return(optionsParameter.As().ProxiesCount().GreaterThan(Int(0)).And(isBuildable)); + + return new MethodProvider(signature, body, this, XmlDocProvider.Empty); + } + + /// + /// Caches, per model type, whether the generated can build the type so + /// nested reads don't repeat the context lookup. Generated code only passes the library's own context, so the + /// result for a type never changes. + /// + private sealed class ProxyReadEligibilityDefinition : TypeProvider + { + private readonly ModelSerializationExtensionsDefinition _declaringType; + private readonly CSharpType _t; + private readonly FieldProvider _stateField; + + public ProxyReadEligibilityDefinition(ModelSerializationExtensionsDefinition declaringType, CSharpType t) + { + _declaringType = declaringType; + _t = t; + // 0 = unknown, 1 = buildable, 2 = not buildable. An int keeps the cached value tear-free. + _stateField = new FieldProvider(FieldModifiers.Private | FieldModifiers.Static, typeof(int), "s_state", this); + } + + protected override TypeProvider? BuildDeclaringTypeProvider() => _declaringType; + + protected override string BuildRelativeFilePath() => _declaringType.RelativeFilePath; + + protected override string BuildName() => "ProxyReadEligibility"; + + protected override TypeSignatureModifiers BuildDeclarationModifiers() + => TypeSignatureModifiers.Private | TypeSignatureModifiers.Static | TypeSignatureModifiers.Class; + + protected override CSharpType[] GetTypeArguments() => [_t]; + + protected override FieldProvider[] BuildFields() => [_stateField]; + + protected override MethodProvider[] BuildMethods() + { + var contextParameter = new ParameterProvider("context", FormattableStringHelpers.Empty, typeof(ModelReaderWriterContext)); + var signature = new MethodSignature( + Name: IsBuildableMethodName, + Modifiers: MethodSignatureModifiers.Public | MethodSignatureModifiers.Static, + Parameters: [contextParameter], + ReturnType: typeof(bool), + Description: null, + ReturnDescription: null); + + var tryGetTypeBuilder = contextParameter.Invoke( + nameof(ModelReaderWriterContext.TryGetTypeBuilder), + [TypeOf(_t), Identifier("_").AsArgument(isOut: true)]); + var body = new MethodBodyStatement[] + { + Declare("state", typeof(int), _stateField, out var state), + new IfStatement(state.Equal(Int(0))) + { + state.Assign(new TernaryConditionalExpression(tryGetTypeBuilder, Int(1), Int(2))).Terminate(), + _stateField.Assign(state).Terminate() + }, + Return(state.Equal(Int(1))) + }; + + return [new MethodProvider(signature, body, this, XmlDocProvider.Empty)]; + } + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelSerializationExtensionsDefinition.Xml.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelSerializationExtensionsDefinition.Xml.cs index d18f64512ad..e97bcd31e65 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelSerializationExtensionsDefinition.Xml.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelSerializationExtensionsDefinition.Xml.cs @@ -55,6 +55,8 @@ private MethodProvider[] BuildXmlExtensionMethods() BuildXmlGetDateTimeOffsetMethodProvider(), BuildXmlGetTimeSpanMethodProvider(), BuildXmlGetBytesFromBase64MethodProvider(), + BuildXmlGetUtf8BytesMethodProvider(), + BuildToXmlOptionsMethodProvider(), BuildXmlWriteStringValueDateTimeOffsetMethodProvider(), BuildXmlWriteStringValueTimeSpanMethodProvider(), BuildXmlWriteBase64StringValueMethodProvider(), @@ -62,6 +64,55 @@ private MethodProvider[] BuildXmlExtensionMethods() ]; } + // Re-serializes a nested element, including inherited namespace declarations, so it can be read through ModelReaderWriter. + private MethodProvider BuildXmlGetUtf8BytesMethodProvider() + { + var signature = new MethodSignature( + Name: ModelSerializationExtensionsSnippets.GetUtf8BytesMethodName, + Modifiers: _methodModifiers, + Parameters: [_xElementParameter], + ReturnType: typeof(BinaryData), + Description: null, + ReturnDescription: null); + + var element = _xElementParameter.As(); + var body = BinaryDataSnippets.FromString( + element.Invoke(nameof(XElement.ToString), FrameworkEnumValue(SaveOptions.DisableFormatting))); + + return new MethodProvider(signature, body, this, XmlDocProvider.Empty); + } + + // A model that also supports JSON reports "J" for the wire format. When an XML-only parent reads it with "W", + // its proxy-aware read must request XML explicitly while keeping the registered proxies. + private MethodProvider BuildToXmlOptionsMethodProvider() + { + var optionsParameter = new ParameterProvider("options", FormattableStringHelpers.Empty, typeof(ModelReaderWriterOptions)); + var signature = new MethodSignature( + Name: ModelSerializationExtensionsSnippets.ToXmlOptionsMethodName, + Modifiers: _methodModifiers, + Parameters: [optionsParameter], + ReturnType: typeof(ModelReaderWriterOptions), + Description: null, + ReturnDescription: null); + + var options = optionsParameter.As(); + var body = new MethodBodyStatement[] + { + new IfStatement(options.Format().Equal(ModelReaderWriterOptionsSnippets.XmlFormat)) + { + Return(options) + }, + Declare("xmlOptions", typeof(ModelReaderWriterOptions), New.Instance(typeof(ModelReaderWriterOptions), ModelReaderWriterOptionsSnippets.XmlFormat), out var xmlOptions), + new ForEachStatement(typeof(ModelProxy), "proxy", options.Property(nameof(ModelReaderWriterOptions.Proxies)), false, out var proxy) + { + xmlOptions.Property(nameof(ModelReaderWriterOptions.Proxies)).Invoke(nameof(IList.Add), proxy).Terminate() + }, + Return(xmlOptions) + }; + + return new MethodProvider(signature, body, this, XmlDocProvider.Empty); + } + private MethodProvider BuildXmlGetDateTimeOffsetMethodProvider() { var signature = new MethodSignature( diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelSerializationExtensionsDefinition.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelSerializationExtensionsDefinition.cs index f21d993f23c..fb1c921634b 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelSerializationExtensionsDefinition.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelSerializationExtensionsDefinition.cs @@ -191,6 +191,7 @@ protected override MethodProvider[] BuildMethods() BuildWriteObjectValueMethodGeneric(), BuildWriteObjectValueMethodProvider(), BuildGetUtf8BytesMethodProvider(), + .. BuildModelProxyMethods(), .. BuildDynamicModelHelpers(), .. BuildXmlExtensionMethods(), ]; @@ -673,11 +674,19 @@ private MethodProvider BuildWriteObjectValueMethodGeneric() }; cases.Add( BuildWriteObjectValueSwitchCase(new CSharpType(typeof(IJsonModel<>), _t), "jsonModel", - jsonModel => new MethodBodyStatement[] + jsonModel => { - jsonModel.Invoke(nameof(IJsonModel.Write), writer, - options.NullCoalesce(ModelSerializationExtensionsSnippets.Wire)).Terminate(), - Break + var mrwOptions = options.As(); + return new MethodBodyStatement[] + { + options.Assign(ModelSerializationExtensionsSnippets.Wire, nullCoalesce: true).Terminate(), + new IfStatement(mrwOptions.ProxiesCount().GreaterThan(Int(0))) + { + jsonModel.Assign(mrwOptions.ResolveProxy(jsonModel)).Terminate() + }, + jsonModel.Invoke(nameof(IJsonModel.Write), writer, options).Terminate(), + Break + }; })); cases.AddRange(new[] { diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.ModelProxies.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.ModelProxies.cs new file mode 100644 index 00000000000..dfcc61876d6 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.ModelProxies.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.Json; +using Microsoft.TypeSpec.Generator.ClientModel.Primitives; +using Microsoft.TypeSpec.Generator.ClientModel.Snippets; +using Microsoft.TypeSpec.Generator.Expressions; +using Microsoft.TypeSpec.Generator.Primitives; +using Microsoft.TypeSpec.Generator.Providers; +using Microsoft.TypeSpec.Generator.Snippets; +using Microsoft.TypeSpec.Generator.Statements; +using static Microsoft.TypeSpec.Generator.Snippets.Snippet; + +namespace Microsoft.TypeSpec.Generator.ClientModel.Providers +{ + /// + /// Conversions that generated clients use instead of the cast operators so that the model proxies configured on the + /// client options apply to request bodies and responses. The cast operators can't take the client's options. + /// + public partial class MrwSerializationTypeDefinition + { + internal static string ToRequestContentMethodName + => $"To{ScmCodeModelGenerator.Instance.TypeFactory.RequestContentApi.RequestContentType.Name}"; + + internal static string FromResponseMethodName + => $"From{ScmCodeModelGenerator.Instance.TypeFactory.ClientResponseApi.ClientResponseType.Name}"; + + internal static bool HasRequestContentConversion(CSharpType type) + => GetModelSerialization(type)?.GeneratesRequestContentConversion == true; + + internal static bool HasResponseConversion(CSharpType type) + => GetModelSerialization(type)?.GeneratesResponseConversion == true; + + private static MrwSerializationTypeDefinition? GetModelSerialization(CSharpType type) + { + if (!ScmCodeModelGenerator.Instance.TypeFactory.ClientPipelineApi.ToExpression().SupportsModelProxies + || !ScmCodeModelGenerator.Instance.TypeFactory.CSharpTypeMap.TryGetValue(type, out var provider) + || provider is not ModelProvider || provider is SystemObjectModelProvider) + { + return null; + } + + return provider.SerializationProviders.OfType().FirstOrDefault(); + } + + private bool GeneratesRequestContentConversion + => !_inputModel.IsUnknownDiscriminatorModel && ScmCodeModelGenerator.Instance.TypeFactory.RootInputModels.Contains(_inputModel); + + private bool GeneratesResponseConversion + => !_inputModel.IsUnknownDiscriminatorModel && ScmCodeModelGenerator.Instance.TypeFactory.RootOutputModels.Contains(_inputModel); + + // internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) => BinaryContent.Create(this, options); + private MethodProvider BuildToRequestContentWithOptionsMethod() + { + var requestContentType = ScmCodeModelGenerator.Instance.TypeFactory.RequestContentApi.RequestContentType; + var optionsParameter = new ParameterProvider( + "options", + $"The options used to write the model, including the registered model proxies.", + typeof(ModelReaderWriterOptions)); + var modifiers = MethodSignatureModifiers.Internal; + if (AnyBaseModelSerialization(serialization => serialization.GeneratesRequestContentConversion)) + { + modifiers |= MethodSignatureModifiers.New; + } + + return new MethodProvider( + new MethodSignature( + ToRequestContentMethodName, + FormattableStringHelpers.FromString($"Converts the model to {requestContentType.Name} using the specified options."), + modifiers, + requestContentType, + null, + [optionsParameter]), + Return(RequestContentApiSnippets.Create(This, optionsParameter.As())), + this); + } + + // internal static T FromClientResult(ClientResult result, ModelReaderWriterOptions options) + // Reads through ModelReaderWriter when proxies apply; otherwise it matches the explicit cast operator, but passes + // the options to the deserializer so nested models still honor the proxies. + private MethodProvider GetFromClientResultWithOptionsMethod(bool supportsJson, bool supportsXml) + { + var clientResponseApi = ScmCodeModelGenerator.Instance.TypeFactory.ClientResponseApi; + var result = new ParameterProvider( + clientResponseApi.ResponseParameterName, + $"The {clientResponseApi.ClientResponseType:C} to deserialize the {Type:C} from.", + clientResponseApi.ClientResponseType); + var optionsParameter = new ParameterProvider( + "options", + $"The options used to read the model, including the registered model proxies.", + typeof(ModelReaderWriterOptions)); + var options = optionsParameter.As(); + + var modifiers = MethodSignatureModifiers.Internal | MethodSignatureModifiers.Static; + if (AnyBaseModelSerialization(serialization => serialization.GeneratesResponseConversion)) + { + modifiers |= MethodSignatureModifiers.New; + } + + // PipelineResponse response = result.GetRawResponse(); + var response = result.ToApi(); + var httpResponse = result.ToApi(); + MethodBodyStatement responseDeclaration = MethodBodyStatement.Empty; + if (response.Original != response.GetRawResponse().Original) + { + responseDeclaration = Declare("response", ScmCodeModelGenerator.Instance.TypeFactory.HttpResponseApi.HttpResponseType, response.GetRawResponse(), out var responseVar); + response = responseVar.ToApi(); + httpResponse = responseVar.ToApi(); + } + var content = response.Property(nameof(HttpResponseApi.Content)).As(); + + MethodBodyStatement[] body; + if (supportsJson && supportsXml) + { + var isJson = httpResponse.TryGetHeader(ContentTypeHeader, out var contentType) + .And(contentType!.StartsWith(Literal("application/json"), StringComparison.OrdinalIgnoreCase)); + body = + [ + responseDeclaration, + MethodBodyStatement.EmptyLine, + new IfStatement(isJson) { BuildJsonFromClientResultBody(content, options) }, + MethodBodyStatement.EmptyLine, + .. BuildXmlFromClientResultBody(response, content, options, options.ToXmlOptions()) + ]; + } + else if (supportsXml) + { + body = [responseDeclaration, .. BuildXmlFromClientResultBody(response, content, options, options)]; + } + else + { + body = [responseDeclaration, .. BuildJsonFromClientResultBody(content, options)]; + } + + return new MethodProvider( + new MethodSignature(FromResponseMethodName, null, modifiers, Type, null, [result, optionsParameter]), + body, + this); + } + + private MethodBodyStatement[] BuildJsonFromClientResultBody(ScopedApi content, ScopedApi options) + { + if (_model is ScmModelProvider { IsDynamicModel: true }) + { + return + [ + ReadThroughProxy(content, options, options), + Declare("data", typeof(BinaryData), content, out var data), + UsingDeclare("document", typeof(JsonDocument), data.As().Parse(ModelSerializationExtensionsSnippets.JsonDocumentOptions), out var dynamicDocument), + Return(GetDeserializationMethodInvocationForType(_model, dynamicDocument.As().RootElement(), data, options)) + ]; + } + + return + [ + ReadThroughProxy(content, options, options), + UsingDeclare("document", typeof(JsonDocument), content.Parse(ModelSerializationExtensionsSnippets.JsonDocumentOptions), out var document), + Return(GetDeserializationMethodInvocationForType(_model, document.As().RootElement(), null, options)) + ]; + } + + private MethodBodyStatement[] BuildXmlFromClientResultBody( + ClientResponseApi response, + ScopedApi content, + ScopedApi options, + ScopedApi readOptions) + => + [ + ReadThroughProxy(content, options, readOptions), + UsingDeclare("stream", typeof(Stream), response.Property(nameof(HttpResponseApi.ContentStream)), out var stream), + new IfStatement(stream.Equal(Null)) { Return(Default) }, + MethodBodyStatement.EmptyLine, + Return(GetDeserializationMethodInvocationForType(_model, XElementSnippets.Load(stream.As(), XmlLinqSnippets.PreserveWhitespace), null, options)) + ]; + + // if (options.ShouldReadThroughProxy(Context.Default)) { return ModelReaderWriter.Read(content, readOptions, Context.Default); } + private MethodBodyStatement ReadThroughProxy( + ScopedApi content, + ScopedApi options, + ScopedApi readOptions) + => new IfStatement(options.ShouldReadThroughProxy(Type)) + { + Return(ModelReaderWriterSnippets.Read(Type, content, readOptions)) + }; + + // A derived model's conversion has the same parameters as its base model's, so it must hide it explicitly. + private bool AnyBaseModelSerialization(Func predicate) + { + var visited = new HashSet(); + for (var baseModel = _model.BaseModelProvider; baseModel != null && visited.Add(baseModel); baseModel = baseModel.BaseModelProvider) + { + if (baseModel.SerializationProviders.OfType().Any(predicate)) + { + return true; + } + } + + return false; + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Xml.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Xml.cs index 928c0a7f1b5..1615fcf1e02 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Xml.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Xml.cs @@ -1111,12 +1111,37 @@ internal static ValueExpression DeserializeXmlValueCore( if (!underlyingType.IsFrameworkType) { - return GetDeserializationMethodInvocationForType(underlyingType, element, null, mrwOptions); + return GetProxyAwareXmlDeserializationMethodInvocation(underlyingType, element, mrwOptions); } return CreateXmlDeserializePrimitiveExpression(element, valueType, format); } + /// + /// XML counterpart of . A model that also supports JSON + /// reports "J" as its wire format, so its proxy-aware read requests XML explicitly; otherwise an XML-only parent + /// read with "W" would parse the child's XML payload as JSON. + /// + internal static ValueExpression GetProxyAwareXmlDeserializationMethodInvocation( + CSharpType valueType, + ScopedApi element, + ScopedApi options) + { + var deserialize = GetDeserializationMethodInvocationForType(valueType, element, null, options); + if (!TryGetProxyableModelSerialization(valueType, out var serialization)) + { + return deserialize; + } + + var modelType = valueType.WithNullable(false); + var readOptions = serialization.SupportsJson ? options.ToXmlOptions() : options; + + return new TernaryConditionalExpression( + options.ShouldReadThroughProxy(modelType), + ModelReaderWriterSnippets.Read(modelType, element.GetUtf8Bytes(), readOptions), + deserialize); + } + internal static MethodBodyStatement SerializeXmlValueCore( CSharpType valueType, ValueExpression value, diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.cs index c212c3ded6f..58ffeb2c657 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.cs @@ -6,6 +6,7 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Net; @@ -77,6 +78,9 @@ public partial class MrwSerializationTypeDefinition : TypeProvider private readonly bool _isStruct; private readonly bool _supportsJson; private readonly bool _supportsXml; + + // Models that support JSON report "J" as their wire format; XML-only models report "X". + internal bool SupportsJson => _supportsJson; private ConstructorProvider? _serializationConstructor; // Flag to determine if the model should override the serialization methods private bool? _shouldOverrideMethods; @@ -452,12 +456,19 @@ protected override MethodProvider[] BuildMethods() if (!_inputModel.IsUnknownDiscriminatorModel) { + bool supportsModelProxies = ScmCodeModelGenerator.Instance.TypeFactory.ClientPipelineApi.ToExpression().SupportsModelProxies; + // cast operators if (ScmCodeModelGenerator.Instance.TypeFactory.RootInputModels.Contains(_inputModel)) { methods.Add(BuildImplicitToBinaryContent()); + if (supportsModelProxies) + { + // Clients pass the options built from their configured model proxies. + methods.Add(BuildToRequestContentWithOptionsMethod()); + } // Add internal ToBinaryContent helper for format-specific serialization - if (_supportsJson && _supportsXml) + else if (_supportsJson && _supportsXml) { methods.Add(BuildToBinaryContentMethod()); } @@ -466,6 +477,10 @@ protected override MethodProvider[] BuildMethods() if (ScmCodeModelGenerator.Instance.TypeFactory.RootOutputModels.Contains(_inputModel)) { methods.Add(GetExplicitFromClientResultMethod(_supportsJson, _supportsXml)); + if (supportsModelProxies) + { + methods.Add(GetFromClientResultWithOptionsMethod(_supportsJson, _supportsXml)); + } } } @@ -1997,8 +2012,7 @@ private ValueExpression CreateDeserializeValueExpression( valueType.ToEnum(ScmCodeModelGenerator.Instance.TypeFactory.DeserializeJsonValue( valueType.UnderlyingEnumType!, jsonElement, data, _mrwOptionsParameterSnippet, serializationFormat)), - _ => GetDeserializationMethodInvocationForType(valueType, jsonElement, data, - _mrwOptionsParameterSnippet) + _ => GetProxyAwareDeserializationMethodInvocation(valueType, jsonElement, data, _mrwOptionsParameterSnippet) }; if (valueType.IsFrameworkType && valueType.FrameworkType == typeof(Uri)) @@ -2012,6 +2026,43 @@ private ValueExpression CreateDeserializeValueExpression( return result; } + /// + /// Nested models keep calling their static deserializer when no proxies are registered. Otherwise they are + /// read through so that a proxy registered for the nested type is honored. + /// The generated helper also checks that the library's can build the + /// type, because accessibility, and therefore context membership, is only final when files are written. + /// + internal static ValueExpression GetProxyAwareDeserializationMethodInvocation( + CSharpType valueType, + ScopedApi jsonElement, + ScopedApi data, + ScopedApi options) + { + var deserialize = GetDeserializationMethodInvocationForType(valueType, jsonElement, data, options); + if (!TryGetProxyableModelSerialization(valueType, out _)) + { + return deserialize; + } + + var modelType = valueType.WithNullable(false); + return new TernaryConditionalExpression( + options.ShouldReadThroughProxy(modelType), + ModelReaderWriterSnippets.Read(modelType, data, options), + deserialize); + } + + /// + /// Nested reads are only routed through for generated models with MRW serialization. + /// + private static bool TryGetProxyableModelSerialization(CSharpType valueType, [NotNullWhen(true)] out MrwSerializationTypeDefinition? serialization) + { + serialization = ScmCodeModelGenerator.Instance.TypeFactory.CSharpTypeMap.TryGetValue(valueType, out var provider) + && provider is ModelProvider and not SystemObjectModelProvider + ? provider.SerializationProviders.OfType().FirstOrDefault() + : null; + return serialization is not null; + } + private MethodBodyStatement CreateDeserializeDictionaryValueStatement( CSharpType dictionaryItemType, DictionaryExpression dictionary, diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MultipartFormDataSerializationDefinition.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MultipartFormDataSerializationDefinition.cs index 5eca868eeb1..dbe1cb6761e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MultipartFormDataSerializationDefinition.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MultipartFormDataSerializationDefinition.cs @@ -78,13 +78,18 @@ protected override ConstructorProvider[] BuildConstructors() protected override MethodProvider[] BuildMethods() { + // Clients whose options carry model proxies pass their options so the proxies apply to the model parts. + var optionsParameter = ScmCodeModelGenerator.Instance.TypeFactory.ClientPipelineApi.ToExpression().SupportsModelProxies + ? new ParameterProvider("options", $"The options used to write the model parts, including the registered model proxies.", typeof(ModelReaderWriterOptions)) + : null; + var options = optionsParameter?.As() ?? ModelSerializationExtensionsSnippets.Wire; var signature = new MethodSignature( ToMultipartFormContentMethodName, FormattableStringHelpers.Empty, MethodSignatureModifiers.Internal, MultiPartFormContentSnippets.Type, null, - []); + optionsParameter is null ? [] : [optionsParameter]); var statements = new List { @@ -108,7 +113,7 @@ protected override MethodProvider[] BuildMethods() continue; } - statements.Add(ExperimentalApiHelpers.Suppress(BuildAddPartStatement(contentVar, prop), + statements.Add(ExperimentalApiHelpers.Suppress(BuildAddPartStatement(contentVar, prop, options), ExperimentalApiHelpers.GetMemberSuppressions(prop))); } @@ -119,7 +124,7 @@ protected override MethodProvider[] BuildMethods() return [new MethodProvider(signature, statements, this)]; } - private static MethodBodyStatement BuildAddPartStatement(ScopedApi contentVar, PropertyProvider prop) + private static MethodBodyStatement BuildAddPartStatement(ScopedApi contentVar, PropertyProvider prop, ScopedApi options) { var wireInfo = prop.WireInfo!; var multipart = (wireInfo.SerializationOptions as ScmSerializationOptions)?.Multipart; @@ -138,12 +143,12 @@ private static MethodBodyStatement BuildAddPartStatement(ScopedApi BuildMultiPartForEach(contentVar, prop, wireInfo.SerializedName, contentType, isFilePart), + => BuildMultiPartForEach(contentVar, prop, wireInfo.SerializedName, contentType, isFilePart, options), // Non-multi lists/arrays, and dictionaries (which have no RFC-defined multipart form), // are emitted as a single part. (true, _) or (false, true) - => BuildSinglePartCollection(contentVar, prop, wireInfo.SerializedName, explicitContentType ?? defaultContentType), - _ => BuildScalarAdd(contentVar, wireInfo.SerializedName, prop, prop.Type, contentType, isFilePart), + => BuildSinglePartCollection(contentVar, prop, wireInfo.SerializedName, explicitContentType ?? defaultContentType, options), + _ => BuildScalarAdd(contentVar, wireInfo.SerializedName, prop, prop.Type, contentType, isFilePart, options), }; if (wireInfo.IsRequired && !wireInfo.IsNullable) @@ -158,16 +163,16 @@ private static MethodBodyStatement BuildAddPartStatement(ScopedApi contentVar, PropertyProvider prop, string serializedName, string? contentType, bool isFilePart) + private static ForEachStatement BuildMultiPartForEach(ScopedApi contentVar, PropertyProvider prop, string serializedName, string? contentType, bool isFilePart, ScopedApi options) { var elementType = prop.Type.ElementType; return new ForEachStatement(elementType, "item", prop, false, out var item) { - BuildScalarAdd(contentVar, serializedName, item, elementType, contentType, isFilePart) + BuildScalarAdd(contentVar, serializedName, item, elementType, contentType, isFilePart, options) }; } - private static MethodBodyStatement BuildScalarAdd(ScopedApi contentVar, string serializedName, ValueExpression value, CSharpType type, string? contentType, bool isFilePart) + private static MethodBodyStatement BuildScalarAdd(ScopedApi contentVar, string serializedName, ValueExpression value, CSharpType type, string? contentType, bool isFilePart, ScopedApi options) { value = value.NullableStructValue(type); @@ -177,7 +182,7 @@ private static MethodBodyStatement BuildScalarAdd(ScopedApi contentVar, PropertyProvider prop, string serializedName, string? contentType) + private static MethodBodyStatement BuildSinglePartCollection(ScopedApi contentVar, PropertyProvider prop, string serializedName, string? contentType, ScopedApi options) { var elementType = prop.Type.ElementType; var dataVarName = $"{serializedName.ToVariableName()}Data".ToVariableName(); @@ -231,7 +236,7 @@ private static MethodBodyStatement BuildSinglePartCollection(ScopedApi() .WithMediaType(Literal(contentType ?? "application/json")); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ScmMethodProviderCollection.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ScmMethodProviderCollection.cs index b0b3a170d82..e8bdaedf35f 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ScmMethodProviderCollection.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ScmMethodProviderCollection.cs @@ -44,6 +44,23 @@ public class ScmMethodProviderCollection : IReadOnlyList private ScmMethodProvider? _legacyAsyncProtocol; private ClientProvider Client { get; } + + // The client's options carry the model proxies configured on its client options. Clients whose pipeline options + // don't carry model proxies keep using the shared wire options. + private bool SupportsModelProxies => Client.ModelReaderWriterOptionsField != null; + private ScopedApi ClientModelReaderWriterOptions => + Client.ModelReaderWriterOptionsField?.As() ?? ModelSerializationExtensionsSnippets.Wire; + + // Paging collections read their pages with the client's options, which follow the client argument. + private ValueExpression[] PagingCollectionOptionsArguments => + Client.ModelReaderWriterOptionsField is { } optionsField ? [optionsField] : []; + + // The BinaryContentHelper overloads that write models take the client's options when it carries model proxies. + // BinaryData items are written by their own overloads, which don't take options. + private ValueExpression? BinaryContentHelperOptions(CSharpType? elementType) + => SupportsModelProxies && elementType?.Equals(typeof(BinaryData)) != true + ? ClientModelReaderWriterOptions + : null; protected InputServiceMethod ServiceMethod { get; } protected TypeProvider EnclosingType { get; } public IReadOnlyList MethodProviders => _methods ??= BuildMethods(); @@ -551,7 +568,7 @@ [.. GetMethodArguments(protocolMethod.Signature, paramDeclarations, convenienceB UsingDeclare("document", data.Parse(), out var document), DiscriminatedUnionSerialization.DeserializeValue( ServiceMethod.Response.Type!, responseBodyType.OutputType, document.RootElement(), - ModelSerializationExtensionsSnippets.Wire, out var value), + ClientModelReaderWriterOptions, out var value), Return(result.FromValue(value, result.GetRawResponse())) ]; } @@ -576,7 +593,7 @@ .. GetStackVariablesForReturnValueConversion(result, responseBodyType, isAsync, responseBodyType, jsonElement, data, - ScmCodeModelGenerator.Instance.ModelSerializationExtensionsDefinition.WireOptionsField.As(), + ClientModelReaderWriterOptions, SerializationFormat.Default), result.GetRawResponse())) }, @@ -634,7 +651,7 @@ private IEnumerable GetStackVariablesForProtocolParamConver // Serializes the body via Utf8JsonWriter to stay AOT/trim safe (avoids BinaryData.FromObjectAsJson, which trips IL2026/IL3050). void AddUtf8JsonContent(CSharpType serializationType, ValueExpression value, InputType? inputType = null) { - var options = ModelSerializationExtensionsSnippets.Wire; + var options = ClientModelReaderWriterOptions; var optionalBody = inputType != null && ServiceMethod.Operation.Parameters.OfType().FirstOrDefault() is { IsRequired: false }; ValueExpression initialization = optionalBody @@ -690,25 +707,25 @@ void AddUtf8JsonContent(CSharpType serializationType, ValueExpression value, Inp } else if (parameter.Type.IsReadOnlyMemory) { - statements.Add(UsingDeclare("content", requestContentType, BinaryContentHelperSnippets.FromEnumerable(parameter.Property("Span")), out var content)); + statements.Add(UsingDeclare("content", requestContentType, BinaryContentHelperSnippets.FromEnumerable(parameter.Property("Span"), BinaryContentHelperOptions(null)), out var content)); declarations["content"] = content; } else if (parameter.Type.IsList) { if (TryGetXmlCollectionNames(parameter, out var rootName, out var childName)) { - statements.Add(UsingDeclare("content", requestContentType, BinaryContentHelperSnippets.FromEnumerable(parameter, Literal(rootName), Literal(childName)), out var content)); + statements.Add(UsingDeclare("content", requestContentType, BinaryContentHelperSnippets.FromEnumerable(parameter, Literal(rootName), Literal(childName), BinaryContentHelperOptions(null)), out var content)); declarations["content"] = content; } else { - statements.Add(UsingDeclare("content", requestContentType, BinaryContentHelperSnippets.FromEnumerable(parameter), out var content)); + statements.Add(UsingDeclare("content", requestContentType, BinaryContentHelperSnippets.FromEnumerable(parameter, BinaryContentHelperOptions(parameter.Type.ElementType)), out var content)); declarations["content"] = content; } } else if (parameter.Type.IsDictionary) { - statements.Add(UsingDeclare("content", requestContentType, BinaryContentHelperSnippets.FromDictionary(parameter), out var content)); + statements.Add(UsingDeclare("content", requestContentType, BinaryContentHelperSnippets.FromDictionary(parameter, BinaryContentHelperOptions(parameter.Type.ElementType)), out var content)); declarations["content"] = content; } else if (parameter.Type.Equals(typeof(string))) @@ -752,11 +769,16 @@ void AddUtf8JsonContent(CSharpType serializationType, ValueExpression value, Inp } } - if (TryGetFormatArgumentForDualFormatModel(bodyModel, bodyInputModel, out var format)) + if (TryGetFormatArgumentForDualFormatModel(bodyModel, bodyInputModel, out var format, out var isXml)) { // Create using declaration for BinaryContent var methodName = $"To{requestContentType.Name}"; - statements.Add(UsingDeclare("content", requestContentType, parameter.Invoke(methodName, format), out var content)); + // A dual-format model reports "J" for the wire format, so XML bodies request XML explicitly + // while keeping the proxies configured on the client options. + ValueExpression formatArgument = SupportsModelProxies + ? (isXml ? ClientModelReaderWriterOptions.ToXmlOptions() : ClientModelReaderWriterOptions) + : format; + statements.Add(UsingDeclare("content", requestContentType, parameter.Invoke(methodName, formatArgument), out var content)); declarations["content"] = content; } else if (bodyInputModel?.Usage.HasFlag(InputModelTypeUsage.MultipartFormData) == true) @@ -764,7 +786,7 @@ void AddUtf8JsonContent(CSharpType serializationType, ValueExpression value, Inp var bodyExpression = inputParam is { IsRequired: false } ? parameter.NullConditional() : parameter; - statements.Add(UsingDeclare("content", MultiPartFormContentSnippets.Type, MultiPartFormContentSnippets.ToMultipartFormContent(bodyExpression), out var content)); + statements.Add(UsingDeclare("content", MultiPartFormContentSnippets.Type, MultiPartFormContentSnippets.ToMultipartFormContent(bodyExpression, SupportsModelProxies ? ClientModelReaderWriterOptions : null), out var content)); declarations["content"] = content; } // else rely on implicit operator to convert to BinaryContent @@ -1011,11 +1033,13 @@ private List BuildXmlCollectionConversionForResult( rootElementVar.Elements(Literal(childName)), out ScopedApi item) .Add(arrayVar.As(listType).Add( - MrwSerializationTypeDefinition.GetDeserializationMethodInvocationForType( - elementType, - item, - null, - ModelSerializationExtensionsSnippets.Wire))), + SupportsModelProxies + ? MrwSerializationTypeDefinition.GetProxyAwareXmlDeserializationMethodInvocation(elementType, item, ClientModelReaderWriterOptions) + : MrwSerializationTypeDefinition.GetDeserializationMethodInvocationForType( + elementType, + item, + null, + ModelSerializationExtensionsSnippets.Wire))), defaultValue.Assign(arrayVar).Terminate() } }); @@ -1077,7 +1101,9 @@ private MethodBodyStatement GetElementConversion(CSharpType elementType, ScopedA { return AddElement( dictKey, - MrwSerializationTypeDefinition.GetDeserializationMethodInvocationForType(elementType, item, data, ModelSerializationExtensionsSnippets.Wire), + SupportsModelProxies + ? MrwSerializationTypeDefinition.GetProxyAwareDeserializationMethodInvocation(elementType, item, data, ClientModelReaderWriterOptions) + : MrwSerializationTypeDefinition.GetDeserializationMethodInvocationForType(elementType, item, data, ModelSerializationExtensionsSnippets.Wire), value); } } @@ -1211,6 +1237,13 @@ private ValueExpression GetResultConversion(ClientResponseApi result, HttpRespon { return response.Content().InvokeToString(); } + if (SupportsModelProxies && MrwSerializationTypeDefinition.HasResponseConversion(responseBodyType)) + { + // The cast operator can't take the client's options, so it would skip the configured model proxies. + return Static(responseBodyType.WithNullable(false)).Invoke( + MrwSerializationTypeDefinition.FromResponseMethodName, + [result, ClientModelReaderWriterOptions]); + } return result.CastTo(responseBodyType); } @@ -1622,7 +1655,7 @@ private IReadOnlyList GetMethodArguments( { if (!addedSpreadSource && declarations.TryGetValue("spread", out ValueExpression? spread)) { - AddArgument(protocolParam, spread); + AddArgument(protocolParam, ToRequestContent(spread, convenienceParam.SpreadSource.Type, isOptional: false)); addedSpreadSource = true; } } @@ -1653,8 +1686,8 @@ private IReadOnlyList GetMethodArguments( } else { - // Use implicit operator as fallback - AddArgument(protocolParam, convenienceParam); + // Use implicit operator as fallback, unless the client's options carry model proxies. + AddArgument(protocolParam, ToRequestContent(convenienceParam, convenienceParam.Type, isOptional: convenienceParam.DefaultValue != null)); } } } @@ -2104,6 +2137,7 @@ private IEnumerable GetPagingMethodBody( collection.Type, [ This, + .. PagingCollectionOptionsArguments, .. constructorArguments ])) ]; @@ -2113,6 +2147,7 @@ .. constructorArguments collection.Type, [ This, + .. PagingCollectionOptionsArguments, .. BuildCreateRequestArguments(createRequestSignature, parameters) ])); } @@ -2257,7 +2292,7 @@ private static CSharpType GetConvenienceStreamingItemType(InputStreamingType str : null; } - private static ValueExpression CreateStreamingResultExpression( + private ValueExpression CreateStreamingResultExpression( InputStreamingType streamingType, ValueExpression response, ValueExpression? cancellationToken, @@ -2275,7 +2310,7 @@ private static ValueExpression CreateStreamingResultExpression( payloadType, streamingType, "Unable to resolve SSE stream item type."); - var parser = CreateSseParser(payloadCSharpType, streamingType); + var parser = CreateSseParser(payloadCSharpType, streamingType, ClientModelReaderWriterOptions); var arguments = cancellationToken != null ? new ValueExpression[] { response, parser, terminalPredicate, cancellationToken } : [response, parser, terminalPredicate]; @@ -2312,7 +2347,7 @@ private static ValueExpression CreateStreamingResultExpression( ModelReaderWriterSnippets.Read( itemType, data, - ModelSerializationExtensionsSnippets.Wire)); + ClientModelReaderWriterOptions)); var jsonLinesArguments = cancellationToken != null ? new ValueExpression[] { @@ -2371,7 +2406,8 @@ private static ValueExpression CreateSseTerminalPredicate(InputStreamingType str private static ValueExpression CreateSseParser( CSharpType payloadCSharpType, - InputStreamingType streamingType) + InputStreamingType streamingType, + ScopedApi options) { var eventSubtypes = GetSseEventSubtypes(streamingType); var eventType = new VariableExpression(typeof(string), eventSubtypes is null ? "_" : "eventType"); @@ -2382,7 +2418,7 @@ private static ValueExpression CreateSseParser( ValueExpression Read(CSharpType type) => ModelReaderWriterSnippets.Read( type, binaryData, - ModelSerializationExtensionsSnippets.Wire); + options); ValueExpression body = Read(payloadCSharpType); if (eventSubtypes is not null) @@ -2534,12 +2570,26 @@ private static bool ShouldUseJsonDocForDeserializingType(CSharpType type) return type.Equals(typeof(TimeSpan)) || type.Equals(typeof(BinaryData)); } + // The implicit operator can't take the client's options, so it would skip the configured model proxies. + private ValueExpression ToRequestContent(ValueExpression model, CSharpType modelType, bool isOptional) + { + if (!SupportsModelProxies || !MrwSerializationTypeDefinition.HasRequestContentConversion(modelType)) + { + return model; + } + + return (isOptional ? model.NullConditional() : model) + .Invoke(MrwSerializationTypeDefinition.ToRequestContentMethodName, ClientModelReaderWriterOptions); + } + private bool TryGetFormatArgumentForDualFormatModel( ModelProvider? bodyModel, InputModelType? bodyInputModel, - [NotNullWhen(true)] out ScopedApi? format) + [NotNullWhen(true)] out ScopedApi? format, + out bool isXml) { format = null; + isXml = false; // Find the first JSON or XML media type string? matchedMediaType = null; @@ -2564,7 +2614,8 @@ private bool TryGetFormatArgumentForDualFormatModel( bodyInputModel.Usage.HasFlag(InputModelTypeUsage.Xml)) { // Determine the format: XML or JSON - format = matchedMediaType.Contains(XmlMediaType, StringComparison.OrdinalIgnoreCase) + isXml = matchedMediaType.Contains(XmlMediaType, StringComparison.OrdinalIgnoreCase); + format = isXml ? ModelReaderWriterOptionsSnippets.XmlFormat : ModelReaderWriterOptionsSnippets.JsonFormat; return true; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/BinaryContentHelperSnippets.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/BinaryContentHelperSnippets.cs index 6722c9f4857..98c35ab8242 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/BinaryContentHelperSnippets.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/BinaryContentHelperSnippets.cs @@ -9,14 +9,14 @@ namespace Microsoft.TypeSpec.Generator.ClientModel.Snippets { internal static class BinaryContentHelperSnippets { - public static ValueExpression FromEnumerable(ValueExpression body) - => Static().Invoke("FromEnumerable", body); + public static ValueExpression FromEnumerable(ValueExpression body, ValueExpression? options = null) + => Static().Invoke("FromEnumerable", options is null ? [body] : [body, options]); - public static ValueExpression FromEnumerable(ValueExpression body, ValueExpression rootNameHint, ValueExpression childNameHint) - => Static().Invoke("FromEnumerable", [body, rootNameHint, childNameHint]); + public static ValueExpression FromEnumerable(ValueExpression body, ValueExpression rootNameHint, ValueExpression childNameHint, ValueExpression? options = null) + => Static().Invoke("FromEnumerable", options is null ? [body, rootNameHint, childNameHint] : [body, rootNameHint, childNameHint, options]); - public static ValueExpression FromDictionary(ValueExpression body) - => Static().Invoke("FromDictionary", body); + public static ValueExpression FromDictionary(ValueExpression body, ValueExpression? options = null) + => Static().Invoke("FromDictionary", options is null ? [body] : [body, options]); public static ValueExpression FromObject(ValueExpression body) => Static().Invoke("FromObject", body); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelReaderWriterOptionsSnippets.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelReaderWriterOptionsSnippets.cs index 4e085563ee2..b0406bbd4ce 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelReaderWriterOptionsSnippets.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelReaderWriterOptionsSnippets.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System.ClientModel.Primitives; +using System.Collections.Generic; using Microsoft.TypeSpec.Generator.Expressions; using Microsoft.TypeSpec.Generator.Snippets; using static Microsoft.TypeSpec.Generator.ClientModel.Snippets.ModelSerializationExtensionsSnippets; @@ -12,6 +13,10 @@ namespace Microsoft.TypeSpec.Generator.ClientModel.Snippets internal static class ModelReaderWriterOptionsSnippets { public static ValueExpression Format(this ScopedApi mrwOptions) => mrwOptions.Property(nameof(ModelReaderWriterOptions.Format)); + public static ValueExpression ProxiesCount(this ScopedApi mrwOptions) + => mrwOptions.Property(nameof(ModelReaderWriterOptions.Proxies)).Property(nameof(ICollection.Count)); + public static ValueExpression ResolveProxy(this ScopedApi mrwOptions, ValueExpression model) + => mrwOptions.Invoke(nameof(ModelReaderWriterOptions.ResolveProxy), model); internal static ScopedApi WireFormat => Literal("W"); internal static ScopedApi JsonFormat => Literal("J"); internal static ScopedApi XmlFormat => Literal("X"); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelSerializationExtensionsSnippets.Xml.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelSerializationExtensionsSnippets.Xml.cs index a4d364eeecb..20c668ee824 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelSerializationExtensionsSnippets.Xml.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelSerializationExtensionsSnippets.Xml.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.ClientModel.Primitives; using System.Collections.Generic; using System.Xml; using System.Xml.Linq; @@ -45,5 +46,11 @@ public static InvokeMethodExpression GetTimeSpan(ScopedApi element, st public static InvokeMethodExpression GetBytesFromBase64(ScopedApi element, string? format) => element.Invoke(GetBytesFromBase64MethodName, Literal(format)); + + public static InvokeMethodExpression GetUtf8Bytes(ScopedApi element) + => element.Invoke(GetUtf8BytesMethodName); + + public static ScopedApi ToXmlOptions(this ScopedApi options) + => options.Invoke(ToXmlOptionsMethodName).As(); } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelSerializationExtensionsSnippets.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelSerializationExtensionsSnippets.cs index c210deae089..0e63ff075b4 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelSerializationExtensionsSnippets.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelSerializationExtensionsSnippets.cs @@ -5,6 +5,7 @@ using System.Text.Json; using Microsoft.TypeSpec.Generator.ClientModel.Providers; using Microsoft.TypeSpec.Generator.Expressions; +using Microsoft.TypeSpec.Generator.Primitives; using Microsoft.TypeSpec.Generator.Snippets; using Microsoft.TypeSpec.Generator.Statements; using static Microsoft.TypeSpec.Generator.Snippets.Snippet; @@ -18,6 +19,9 @@ internal static partial class ModelSerializationExtensionsSnippets private const string WriteBase64UrlStringValueMethodName = "WriteBase64UrlStringValue"; private const string WriteNumberValueMethodName = "WriteNumberValue"; private const string WriteObjectValueMethodName = "WriteObjectValue"; + internal const string ShouldReadThroughProxyMethodName = "ShouldReadThroughProxy"; + internal const string GetUtf8BytesMethodName = "GetUtf8Bytes"; + internal const string ToXmlOptionsMethodName = "ToXmlOptions"; private const string GetCharMethodName = "GetChar"; private const string GetObjectMethodName = "GetObject"; private const string GetBytesFromBase64MethodName = "GetBytesFromBase64"; @@ -65,5 +69,11 @@ public static ValueExpression GetTimeSpan(this ScopedApi provider, ScopedApi element) => provider.Invoke(GetCharMethodName, [element]); + + public static ScopedApi ShouldReadThroughProxy(this ScopedApi options, CSharpType modelType) + => options.Invoke(ShouldReadThroughProxyMethodName, [ModelReaderWriterContextSnippets.Default], [modelType], false).As(); + + public static ScopedApi ToWireOptions(ValueExpression modelProxies) + => modelProxies.Invoke(ModelSerializationExtensionsDefinition.ToWireOptionsMethodName).As(); } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/MultiPartFormContentSnippets.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/MultiPartFormContentSnippets.cs index 5464604d521..7be300ca896 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/MultiPartFormContentSnippets.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/MultiPartFormContentSnippets.cs @@ -42,8 +42,8 @@ public static MethodBodyStatement Add(this ScopedApi conte public static MethodBodyStatement AddWithMediaType(this ScopedApi content, string name, ValueExpression value, string mediaType) => content.Invoke(AddMethodName, [Literal(name), value.Invoke(WithMediaTypeMethodName, [Literal(mediaType)])]).Terminate(); - public static ValueExpression ToMultipartFormContent(ValueExpression model) - => model.Invoke(ToMultipartFormContentMethodName); + public static ValueExpression ToMultipartFormContent(ValueExpression model, ValueExpression? options = null) + => options is null ? model.Invoke(ToMultipartFormContentMethodName) : model.Invoke(ToMultipartFormContentMethodName, options); } } #pragma warning restore SCME0004 diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/XElementSnippets.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/XElementSnippets.cs index 137a2d82401..84954ccd934 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/XElementSnippets.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/XElementSnippets.cs @@ -53,6 +53,9 @@ public static ScopedApi GetTimeSpan(this ScopedApi element, public static ScopedApi GetBytesFromBase64(this ScopedApi element, string? format) => ModelSerializationExtensionsSnippets.GetBytesFromBase64(element, format).As(); + public static ScopedApi GetUtf8Bytes(this ScopedApi element) + => ModelSerializationExtensionsSnippets.GetUtf8Bytes(element).As(); + public static ScopedApi Namespace(this ScopedApi name) => name.Property(nameof(XName.Namespace)).As(); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/ModelReaderWriterValidation/TestProjects/Sample_TypeSpec/TreeXmlTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/ModelReaderWriterValidation/TestProjects/Sample_TypeSpec/TreeXmlTests.cs index 8228c4d8044..cac155b462e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/ModelReaderWriterValidation/TestProjects/Sample_TypeSpec/TreeXmlTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/ModelReaderWriterValidation/TestProjects/Sample_TypeSpec/TreeXmlTests.cs @@ -222,7 +222,7 @@ public void ToBinaryContent_WithJsonFormat_ProducesJsonPayload() System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public); Assert.IsNotNull(method, "ToBinaryContent method should exist on Tree"); - var binaryContent = (BinaryContent)method!.Invoke(tree, new object[] { "J" })!; + var binaryContent = (BinaryContent)method!.Invoke(tree, new object[] { ModelReaderWriterOptions.Json })!; // Verify the MediaType is set correctly for JSON Assert.That(binaryContent.MediaType, @@ -240,7 +240,7 @@ public void ToBinaryContent_WithXmlFormat_ProducesXmlPayload() System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public); Assert.IsNotNull(method, "ToBinaryContent method should exist on Tree"); - var binaryContent = (BinaryContent)method!.Invoke(tree, new object[] { "X" })!; + var binaryContent = (BinaryContent)method!.Invoke(tree, new object[] { ModelReaderWriterOptions.Xml })!; // Verify the MediaType is null or empty for XML format Assert.That(string.IsNullOrEmpty(binaryContent.MediaType), Is.True, diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Abstractions/ClientPipelineApiTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Abstractions/ClientPipelineApiTests.cs index 72244724626..d88e69da407 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Abstractions/ClientPipelineApiTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Abstractions/ClientPipelineApiTests.cs @@ -56,7 +56,30 @@ public void ProcessMessageIsOverridden() Assert.IsTrue(method.BodyStatements!.ToDisplayString().Contains("GetFakeProcessMessageAsync")); } - private static ClientProvider CreateTestClient() + // Pipelines opt out of model proxies by default, so their clients keep the shared wire options. + [Test] + public void ModelProxiesAreNotSupportedByDefault() + { + var clientProvider = CreateTestClient(); + + Assert.IsNull(clientProvider.ModelReaderWriterOptionsField); + } + + // A pipeline whose client options carry model proxies decides how the client builds its options from them. + [Test] + public void ModelReaderWriterOptionsComeFromPipelineApi() + { + var clientProvider = CreateTestClient(TestClientPipelineApiWithModelProxies.Instance); + + Assert.IsNotNull(clientProvider.ModelReaderWriterOptionsField); + var primaryConstructor = clientProvider.Constructors.Single( + c => c.Signature.Initializer == null && c.Signature.Modifiers == MethodSignatureModifiers.Internal); + StringAssert.Contains( + "_modelReaderWriterOptions = options.GetFakeModelReaderWriterOptions();", + primaryConstructor.BodyStatements!.ToDisplayString()); + } + + private static ClientProvider CreateTestClient(ClientPipelineApi? clientPipelineApi = null) { var inputServiceMethod = InputFactory.BasicServiceMethod( "test", @@ -68,12 +91,30 @@ private static ClientProvider CreateTestClient() InputFactory.QueryParameter("foo-query", InputPrimitiveType.String) ])); var client = InputFactory.Client("TestClient", methods: [inputServiceMethod]); - MockHelpers.LoadMockGenerator(clientPipelineApi: TestClientPipelineApi.Instance); + MockHelpers.LoadMockGenerator(clientPipelineApi: clientPipelineApi ?? TestClientPipelineApi.Instance); var clientProvider = ScmCodeModelGenerator.Instance.TypeFactory.CreateClient(client); Assert.IsNotNull(clientProvider); return clientProvider!; } + private record TestClientPipelineApiWithModelProxies : TestClientPipelineApi + { + private static ClientPipelineApi? _instance; + internal static new ClientPipelineApi Instance => _instance ??= new TestClientPipelineApiWithModelProxies(Empty); + + public TestClientPipelineApiWithModelProxies(ValueExpression original) : base(original) + { + } + + public override bool SupportsModelProxies => true; + + public override ValueExpression GetModelReaderWriterOptions(ValueExpression clientOptions) + => clientOptions.Invoke("GetFakeModelReaderWriterOptions"); + + public override ClientPipelineApi FromExpression(ValueExpression expression) + => new TestClientPipelineApiWithModelProxies(expression); + } + private record TestClientPipelineApi : ClientPipelineApi { private static ClientPipelineApi? _instance; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderCustomizationTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderCustomizationTests.cs index bdf17516e28..87c2b71b425 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderCustomizationTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderCustomizationTests.cs @@ -494,8 +494,7 @@ public async Task CanRemoveCachingField() // the sub-client caching field should not be present var fields = parentClientProvider!.Fields; - Assert.AreEqual(1, fields.Count); - Assert.AreEqual("_endpoint", fields[0].Name); + CollectionAssert.AreEqual(new[] { "_endpoint", "_modelReaderWriterOptions" }, fields.Select(f => f.Name)); var cachingField = fields.SingleOrDefault(f => f.Name == "_cachedDog"); Assert.IsNull(cachingField); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs index 1b9818460df..b3695a50d94 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs @@ -1082,9 +1082,10 @@ public void TestBuildConstructors_ForSubClient_NoAuth() var internalConstructor = constructors.FirstOrDefault( c => c.Signature?.Modifiers == MethodSignatureModifiers.Internal); Assert.IsNotNull(internalConstructor); - // in the no auth case, the ctor no longer has the credentail parameter therefore here we expect 2 parameters. + // in the no auth case, the ctor no longer has the credentail parameter therefore here we expect the pipeline, model reader writer options, and endpoint parameters. var ctorParams = internalConstructor?.Signature?.Parameters; - Assert.AreEqual(2, ctorParams?.Count); + Assert.AreEqual(3, ctorParams?.Count); + Assert.AreEqual("modelReaderWriterOptions", ctorParams?[1].Name); var mockingConstructor = constructors.FirstOrDefault( c => c.Signature?.Modifiers == MethodSignatureModifiers.Protected); @@ -1105,9 +1106,10 @@ public void TestBuildConstructors_ForSubClient_KeyAuthOrOAuth2Auth() var internalConstructor = constructors.FirstOrDefault( c => c.Signature?.Modifiers == MethodSignatureModifiers.Internal); Assert.IsNotNull(internalConstructor); - // when there is only one approach of auth, we still have 2 parameters in the ctor because we should not have auth parameter in sub-client + // when there is only one approach of auth, we still have 3 parameters in the ctor because we should not have auth parameter in sub-client var ctorParams = internalConstructor?.Signature?.Parameters; - Assert.AreEqual(2, ctorParams?.Count); + Assert.AreEqual(3, ctorParams?.Count); + Assert.AreEqual("modelReaderWriterOptions", ctorParams?[1].Name); var mockingConstructor = constructors.FirstOrDefault( c => c.Signature?.Modifiers == MethodSignatureModifiers.Protected); @@ -1127,15 +1129,60 @@ public void TestBuildConstructors_ForSubClient_BothAuth() var internalConstructor = constructors.FirstOrDefault( c => c.Signature?.Modifiers == MethodSignatureModifiers.Internal); Assert.IsNotNull(internalConstructor); - // when we have both auths, we still have 2 parameters in the ctor, because we should not have auth parameters in sub-client + // when we have both auths, we still have 3 parameters in the ctor, because we should not have auth parameters in sub-client var ctorParams = internalConstructor?.Signature?.Parameters; - Assert.AreEqual(2, ctorParams?.Count); + Assert.AreEqual(3, ctorParams?.Count); + Assert.AreEqual("modelReaderWriterOptions", ctorParams?[1].Name); var mockingConstructor = constructors.FirstOrDefault( c => c.Signature?.Modifiers == MethodSignatureModifiers.Protected); Assert.IsNotNull(mockingConstructor); } + // Pipelines whose client options don't carry model proxies, such as Azure.Core's, keep the cast operators and the + // shared wire options. + [Test] + public void ClientWithoutModelProxiesKeepsCastConversions() + { + var item = InputFactory.Model("Item"); + var page = InputFactory.Model("Page", properties: [InputFactory.Property("items", InputFactory.Array(item))]); + var listMethod = InputFactory.PagingServiceMethod( + "List", + InputFactory.Operation("List", responses: [InputFactory.OperationResponse([200], page)]), + pagingMetadata: InputFactory.PagingMetadata(["items"], null, null)); + var updateMethod = InputFactory.BasicServiceMethod( + "Update", + InputFactory.Operation( + "Update", + parameters: [InputFactory.BodyParameter("body", item, isRequired: true)], + responses: [InputFactory.OperationResponse([200], item)]), + parameters: [InputFactory.MethodParameter("body", item, isRequired: true, location: InputRequestLocation.Body)], + response: InputFactory.ServiceMethodResponse(item, null)); + var parent = InputFactory.Client("ParentClient", methods: [listMethod, updateMethod]); + var child = InputFactory.Client("ChildClient", parent: parent, initializedBy: InputClientInitializedBy.Parent); + MockHelpers.LoadMockGenerator( + inputModels: () => [item, page], + clients: () => [parent, child], + clientPipelineApi: ClientPipelineWithoutModelProxies.Instance); + + var typeProviders = ScmCodeModelGenerator.Instance.OutputLibrary.TypeProviders; + var parentClient = typeProviders.OfType().Single(c => c.Name == "ParentClient"); + Assert.IsNull(parentClient.ModelReaderWriterOptionsField); + var collectionResults = typeProviders.OfType().ToArray(); + Assert.AreEqual(4, collectionResults.Length); + + var parentCode = new TypeProviderWriter(parentClient).Write().Content; + StringAssert.Contains("this.Update(body, cancellationToken.ToRequestOptions())", parentCode); + StringAssert.Contains("(global::Sample.Models.Item)result", parentCode); + StringAssert.Contains("new global::Sample.ChildClient(Pipeline, _endpoint)", parentCode); + foreach (var code in collectionResults.Select(c => new TypeProviderWriter(c).Write().Content).Append(parentCode)) + { + StringAssert.DoesNotContain("_modelReaderWriterOptions", code); + StringAssert.DoesNotContain("FromClientResult", code); + StringAssert.DoesNotContain("ToWireOptions", code); + } + } + /// /// Tests that when a client has a default endpoint and auth, we generate a simplified constructor /// that accepts auth + options (using the default endpoint). diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NewOptionalNonBodyParameterAddedWithModelBody.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NewOptionalNonBodyParameterAddedWithModelBody.cs index 9e9679f33bf..6e88d1da721 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NewOptionalNonBodyParameterAddedWithModelBody.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NewOptionalNonBodyParameterAddedWithModelBody.cs @@ -34,7 +34,7 @@ public partial class TestClient { global::Sample.Argument.AssertNotNull(body, nameof(body)); - global::System.ClientModel.ClientResult result = this.GetData(param1, body, param3, cancellationToken.ToRequestOptions()); + global::System.ClientModel.ClientResult result = this.GetData(param1, body.ToBinaryContent(_modelReaderWriterOptions), param3, cancellationToken.ToRequestOptions()); using global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(result.GetRawResponse().Content); string value = document.RootElement.GetString(); return global::System.ClientModel.ClientResult.FromValue(value, result.GetRawResponse()); @@ -44,7 +44,7 @@ public partial class TestClient { global::Sample.Argument.AssertNotNull(body, nameof(body)); - global::System.ClientModel.ClientResult result = await this.GetDataAsync(param1, body, param3, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + global::System.ClientModel.ClientResult result = await this.GetDataAsync(param1, body.ToBinaryContent(_modelReaderWriterOptions), param3, cancellationToken.ToRequestOptions()).ConfigureAwait(false); using global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(result.GetRawResponse().Content); string value = document.RootElement.GetString(); return global::System.ClientModel.ClientResult.FromValue(value, result.GetRawResponse()); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(False,False).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(False,False).cs index ae1a9f09775..897f4fd1b5c 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(False,False).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(False,False).cs @@ -13,22 +13,22 @@ public partial class TestClient { public virtual global::System.ClientModel.Primitives.CollectionResult GetItems(int? maxPageSize, string token, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsCollectionResult(this, maxPageSize, token, options); + return new global::Sample.TestClientGetItemsCollectionResult(this, _modelReaderWriterOptions, maxPageSize, token, options); } public virtual global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(int? maxPageSize, string token, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, maxPageSize, token, options); + return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, _modelReaderWriterOptions, maxPageSize, token, options); } public virtual global::System.ClientModel.CollectionResult GetItems(int? maxPageSize = default, string token = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, maxPageSize, token, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT(this, _modelReaderWriterOptions, maxPageSize, token, cancellationToken.ToRequestOptions()); } public virtual global::System.ClientModel.AsyncCollectionResult GetItemsAsync(int? maxPageSize = default, string token = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, maxPageSize, token, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, _modelReaderWriterOptions, maxPageSize, token, cancellationToken.ToRequestOptions()); } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(False,True).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(False,True).cs index 6e3f4c5554c..beab5706967 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(False,True).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(False,True).cs @@ -14,22 +14,46 @@ public partial class TestClient { public virtual global::System.ClientModel.Primitives.CollectionResult GetItems(int? maxPageSize, string token, bool? filter, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsCollectionResult(this, maxPageSize, token, filter, options); + return new global::Sample.TestClientGetItemsCollectionResult( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + options); } public virtual global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(int? maxPageSize, string token, bool? filter, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, maxPageSize, token, filter, options); + return new global::Sample.TestClientGetItemsAsyncCollectionResult( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + options); } public virtual global::System.ClientModel.CollectionResult GetItems(int? maxPageSize = default, string token = default, bool? filter = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, maxPageSize, token, filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + cancellationToken.ToRequestOptions()); } public virtual global::System.ClientModel.AsyncCollectionResult GetItemsAsync(int? maxPageSize = default, string token = default, bool? filter = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, maxPageSize, token, filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + cancellationToken.ToRequestOptions()); } #pragma warning disable AZC0002 // Back-compat overload preserves the previous method signature where CancellationToken was the trailing parameter. Making it optional would introduce an ambiguous call with the new method. diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(StringFilter).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(StringFilter).cs index fdaeabe90aa..529bb27dfc4 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(StringFilter).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(StringFilter).cs @@ -14,22 +14,46 @@ public partial class TestClient { public virtual global::System.ClientModel.Primitives.CollectionResult GetItems(int? maxPageSize, string token, string filter, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsCollectionResult(this, maxPageSize, token, filter, options); + return new global::Sample.TestClientGetItemsCollectionResult( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + options); } public virtual global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(int? maxPageSize, string token, string filter, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, maxPageSize, token, filter, options); + return new global::Sample.TestClientGetItemsAsyncCollectionResult( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + options); } public virtual global::System.ClientModel.CollectionResult GetItems(int? maxPageSize = default, string token = default, string filter = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, maxPageSize, token, filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + cancellationToken.ToRequestOptions()); } public virtual global::System.ClientModel.AsyncCollectionResult GetItemsAsync(int? maxPageSize = default, string token = default, string filter = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, maxPageSize, token, filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + cancellationToken.ToRequestOptions()); } [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(StringFilter,ProtocolOnly).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(StringFilter,ProtocolOnly).cs index ac88463442b..2ba5b6376ac 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(StringFilter,ProtocolOnly).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(StringFilter,ProtocolOnly).cs @@ -11,12 +11,24 @@ public partial class TestClient { public virtual global::System.ClientModel.Primitives.CollectionResult GetItems(int? maxPageSize = default, string token = default, string filter = default, global::System.ClientModel.Primitives.RequestOptions options = null) { - return new global::Sample.TestClientGetItemsCollectionResult(this, maxPageSize, token, filter, options); + return new global::Sample.TestClientGetItemsCollectionResult( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + options); } public virtual global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(int? maxPageSize = default, string token = default, string filter = default, global::System.ClientModel.Primitives.RequestOptions options = null) { - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, maxPageSize, token, filter, options); + return new global::Sample.TestClientGetItemsAsyncCollectionResult( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + options); } [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(True,False).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(True,False).cs index ae1a9f09775..897f4fd1b5c 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(True,False).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(True,False).cs @@ -13,22 +13,22 @@ public partial class TestClient { public virtual global::System.ClientModel.Primitives.CollectionResult GetItems(int? maxPageSize, string token, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsCollectionResult(this, maxPageSize, token, options); + return new global::Sample.TestClientGetItemsCollectionResult(this, _modelReaderWriterOptions, maxPageSize, token, options); } public virtual global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(int? maxPageSize, string token, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, maxPageSize, token, options); + return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, _modelReaderWriterOptions, maxPageSize, token, options); } public virtual global::System.ClientModel.CollectionResult GetItems(int? maxPageSize = default, string token = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, maxPageSize, token, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT(this, _modelReaderWriterOptions, maxPageSize, token, cancellationToken.ToRequestOptions()); } public virtual global::System.ClientModel.AsyncCollectionResult GetItemsAsync(int? maxPageSize = default, string token = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, maxPageSize, token, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, _modelReaderWriterOptions, maxPageSize, token, cancellationToken.ToRequestOptions()); } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(True,False,CustomProtocol).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(True,False,CustomProtocol).cs index 555087dd466..040b65527eb 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(True,False,CustomProtocol).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(True,False,CustomProtocol).cs @@ -13,22 +13,22 @@ public partial class TestClient { public partial global::System.ClientModel.Primitives.CollectionResult GetItems(int? maxPageSize, string resumeToken, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsCollectionResult(this, maxPageSize, resumeToken, options); + return new global::Sample.TestClientGetItemsCollectionResult(this, _modelReaderWriterOptions, maxPageSize, resumeToken, options); } public partial global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(int? maxPageSize, string resumeToken, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, maxPageSize, resumeToken, options); + return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, _modelReaderWriterOptions, maxPageSize, resumeToken, options); } public global::System.ClientModel.CollectionResult GetItems(int? maxPageSize = default, string token = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, maxPageSize, token, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT(this, _modelReaderWriterOptions, maxPageSize, token, cancellationToken.ToRequestOptions()); } public global::System.ClientModel.AsyncCollectionResult GetItemsAsync(int? maxPageSize = default, string token = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, maxPageSize, token, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, _modelReaderWriterOptions, maxPageSize, token, cancellationToken.ToRequestOptions()); } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(True,False,NoDefaults).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(True,False,NoDefaults).cs index b3a4029e96a..275c48d66bf 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(True,False,NoDefaults).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(True,False,NoDefaults).cs @@ -15,20 +15,20 @@ public partial class TestClient [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] public virtual global::System.ClientModel.Primitives.CollectionResult GetItems(int? maxPageSize, string token, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsCollectionResult(this, maxPageSize, token, options); + return new global::Sample.TestClientGetItemsCollectionResult(this, _modelReaderWriterOptions, maxPageSize, token, options); } [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] public virtual global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(int? maxPageSize, string token, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, maxPageSize, token, options); + return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, _modelReaderWriterOptions, maxPageSize, token, options); } #pragma warning disable AZC0002 // Back-compat overload preserves the previous method signature where CancellationToken was the trailing parameter. Making it optional would introduce an ambiguous call with the new method. [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] public virtual global::System.ClientModel.CollectionResult GetItems(int? maxPageSize, string token, global::System.Threading.CancellationToken cancellationToken) { - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, maxPageSize, token, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT(this, _modelReaderWriterOptions, maxPageSize, token, cancellationToken.ToRequestOptions()); } #pragma warning restore AZC0002 // Back-compat overload preserves the previous method signature where CancellationToken was the trailing parameter. Making it optional would introduce an ambiguous call with the new method. @@ -36,28 +36,28 @@ public partial class TestClient [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] public virtual global::System.ClientModel.AsyncCollectionResult GetItemsAsync(int? maxPageSize, string token, global::System.Threading.CancellationToken cancellationToken) { - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, maxPageSize, token, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, _modelReaderWriterOptions, maxPageSize, token, cancellationToken.ToRequestOptions()); } #pragma warning restore AZC0002 // Back-compat overload preserves the previous method signature where CancellationToken was the trailing parameter. Making it optional would introduce an ambiguous call with the new method. public virtual global::System.ClientModel.Primitives.CollectionResult GetItems(int? maxPageSize, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsCollectionResult(this, maxPageSize, default, options); + return new global::Sample.TestClientGetItemsCollectionResult(this, _modelReaderWriterOptions, maxPageSize, default, options); } public virtual global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(int? maxPageSize, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, maxPageSize, default, options); + return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, _modelReaderWriterOptions, maxPageSize, default, options); } public virtual global::System.ClientModel.CollectionResult GetItems(int? maxPageSize = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, maxPageSize, default, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT(this, _modelReaderWriterOptions, maxPageSize, default, cancellationToken.ToRequestOptions()); } public virtual global::System.ClientModel.AsyncCollectionResult GetItemsAsync(int? maxPageSize = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, maxPageSize, default, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, _modelReaderWriterOptions, maxPageSize, default, cancellationToken.ToRequestOptions()); } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(True,True).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(True,True).cs index 3fb3a199c67..320e2eaf609 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(True,True).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(True,True).cs @@ -14,22 +14,46 @@ public partial class TestClient { public virtual global::System.ClientModel.Primitives.CollectionResult GetItems(int? maxPageSize, string token, bool? filter, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsCollectionResult(this, maxPageSize, token, filter, options); + return new global::Sample.TestClientGetItemsCollectionResult( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + options); } public virtual global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(int? maxPageSize, string token, bool? filter, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, maxPageSize, token, filter, options); + return new global::Sample.TestClientGetItemsAsyncCollectionResult( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + options); } public virtual global::System.ClientModel.CollectionResult GetItems(int? maxPageSize = default, string token = default, bool? filter = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, maxPageSize, token, filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + cancellationToken.ToRequestOptions()); } public virtual global::System.ClientModel.AsyncCollectionResult GetItemsAsync(int? maxPageSize = default, string token = default, bool? filter = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, maxPageSize, token, filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + cancellationToken.ToRequestOptions()); } [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(True,True,NoDefaults).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(True,True,NoDefaults).cs index 3fb3a199c67..320e2eaf609 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(True,True,NoDefaults).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/BackCompatibility_NextLinkContinuationToken(True,True,NoDefaults).cs @@ -14,22 +14,46 @@ public partial class TestClient { public virtual global::System.ClientModel.Primitives.CollectionResult GetItems(int? maxPageSize, string token, bool? filter, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsCollectionResult(this, maxPageSize, token, filter, options); + return new global::Sample.TestClientGetItemsCollectionResult( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + options); } public virtual global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(int? maxPageSize, string token, bool? filter, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, maxPageSize, token, filter, options); + return new global::Sample.TestClientGetItemsAsyncCollectionResult( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + options); } public virtual global::System.ClientModel.CollectionResult GetItems(int? maxPageSize = default, string token = default, bool? filter = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, maxPageSize, token, filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + cancellationToken.ToRequestOptions()); } public virtual global::System.ClientModel.AsyncCollectionResult GetItemsAsync(int? maxPageSize = default, string token = default, bool? filter = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, maxPageSize, token, filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + cancellationToken.ToRequestOptions()); } [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/ExperimentalPolyfilledCustomDeclarationsCompile(ParentClient).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/ExperimentalPolyfilledCustomDeclarationsCompile(ParentClient).cs index d952d70a908..2c47b0dc630 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/ExperimentalPolyfilledCustomDeclarationsCompile(ParentClient).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/ExperimentalPolyfilledCustomDeclarationsCompile(ParentClient).cs @@ -11,6 +11,7 @@ namespace Sample public partial class ParentClient { private readonly global::System.Uri _endpoint; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions = global::Sample.ModelSerializationExtensions.WireOptions; #pragma warning disable CUSTOM_CLIENT // This generated code depends on experimental functionality. private global::Sample.ChildClient _cachedChildClient; #pragma warning restore CUSTOM_CLIENT // This generated code depends on experimental functionality. @@ -38,6 +39,7 @@ internal ParentClient(global::System.ClientModel.Primitives.AuthenticationPolicy { Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.ParentClient).Assembly) }, Array.Empty()); } + _modelReaderWriterOptions = options.ModelProxies.ToWireOptions(); } public ParentClient(global::System.Uri endpoint, global::Sample.SampleClientOptions options) : this(null, endpoint, options) @@ -49,7 +51,7 @@ public ParentClient(global::System.Uri endpoint, global::Sample.SampleClientOpti #pragma warning disable CUSTOM_CLIENT // This generated code depends on experimental functionality. public virtual global::Sample.ChildClient GetChildClient() { - return (global::System.Threading.Volatile.Read(ref _cachedChildClient) ?? (global::System.Threading.Interlocked.CompareExchange(ref _cachedChildClient, new global::Sample.ChildClient(Pipeline, _endpoint), null) ?? _cachedChildClient)); + return (global::System.Threading.Volatile.Read(ref _cachedChildClient) ?? (global::System.Threading.Interlocked.CompareExchange(ref _cachedChildClient, new global::Sample.ChildClient(Pipeline, _modelReaderWriterOptions, _endpoint), null) ?? _cachedChildClient)); } #pragma warning restore CUSTOM_CLIENT // This generated code depends on experimental functionality. } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_GeneratesExpectedClient.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_GeneratesExpectedClient.cs index 7aa404c1406..8497a2df049 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_GeneratesExpectedClient.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_GeneratesExpectedClient.cs @@ -13,6 +13,7 @@ namespace Sample public partial class TestClient { private readonly global::System.Uri _endpoint; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions = global::Sample.ModelSerializationExtensions.WireOptions; private readonly string _subscriptionId; private readonly string _serviceAApiVersion; private readonly string _serviceBApiVersion; @@ -44,6 +45,7 @@ internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy a { Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly) }, Array.Empty()); } + _modelReaderWriterOptions = options.ModelProxies.ToWireOptions(); _serviceAApiVersion = options.ServiceAApiVersion; _serviceBApiVersion = options.ServiceBApiVersion; } @@ -56,12 +58,12 @@ public TestClient(global::System.Uri endpoint, string subscriptionId, global::Sa public virtual global::Sample.ServiceA.ServiceA GetServiceAClient() { - return (global::System.Threading.Volatile.Read(ref _cachedServiceA) ?? (global::System.Threading.Interlocked.CompareExchange(ref _cachedServiceA, new global::Sample.ServiceA.ServiceA(Pipeline, _endpoint, _serviceAApiVersion, _subscriptionId), null) ?? _cachedServiceA)); + return (global::System.Threading.Volatile.Read(ref _cachedServiceA) ?? (global::System.Threading.Interlocked.CompareExchange(ref _cachedServiceA, new global::Sample.ServiceA.ServiceA(Pipeline, _modelReaderWriterOptions, _endpoint, _serviceAApiVersion, _subscriptionId), null) ?? _cachedServiceA)); } public virtual global::Sample.ServiceB.ServiceB GetServiceBClient() { - return (global::System.Threading.Volatile.Read(ref _cachedServiceB) ?? (global::System.Threading.Interlocked.CompareExchange(ref _cachedServiceB, new global::Sample.ServiceB.ServiceB(Pipeline, _endpoint, _serviceBApiVersion, _subscriptionId), null) ?? _cachedServiceB)); + return (global::System.Threading.Volatile.Read(ref _cachedServiceB) ?? (global::System.Threading.Interlocked.CompareExchange(ref _cachedServiceB, new global::Sample.ServiceB.ServiceB(Pipeline, _modelReaderWriterOptions, _endpoint, _serviceBApiVersion, _subscriptionId), null) ?? _cachedServiceB)); } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClient.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClient.cs index f0dc227b3eb..3a7677f34ef 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClient.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClient.cs @@ -14,6 +14,7 @@ namespace Sample public partial class TestClient { private readonly global::System.Uri _endpoint; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions = global::Sample.ModelSerializationExtensions.WireOptions; private readonly string _subscriptionId; private readonly string _computeApiVersion; private readonly string _keyVaultApiVersion; @@ -47,6 +48,7 @@ internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy a { Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly) }, Array.Empty()); } + _modelReaderWriterOptions = options.ModelProxies.ToWireOptions(); _computeApiVersion = options.ComputeApiVersion; _keyVaultApiVersion = options.KeyVaultApiVersion; _storageApiVersion = options.StorageApiVersion; @@ -60,17 +62,17 @@ public TestClient(global::System.Uri endpoint, string subscriptionId, global::Sa public virtual global::Sample.KeyVault.KeyVault GetKeyVaultClient() { - return (global::System.Threading.Volatile.Read(ref _cachedKeyVault) ?? (global::System.Threading.Interlocked.CompareExchange(ref _cachedKeyVault, new global::Sample.KeyVault.KeyVault(Pipeline, _endpoint, _keyVaultApiVersion, _subscriptionId), null) ?? _cachedKeyVault)); + return (global::System.Threading.Volatile.Read(ref _cachedKeyVault) ?? (global::System.Threading.Interlocked.CompareExchange(ref _cachedKeyVault, new global::Sample.KeyVault.KeyVault(Pipeline, _modelReaderWriterOptions, _endpoint, _keyVaultApiVersion, _subscriptionId), null) ?? _cachedKeyVault)); } public virtual global::Sample.Storage.Storage GetStorageClient() { - return (global::System.Threading.Volatile.Read(ref _cachedStorage) ?? (global::System.Threading.Interlocked.CompareExchange(ref _cachedStorage, new global::Sample.Storage.Storage(Pipeline, _endpoint, _storageApiVersion, _subscriptionId), null) ?? _cachedStorage)); + return (global::System.Threading.Volatile.Read(ref _cachedStorage) ?? (global::System.Threading.Interlocked.CompareExchange(ref _cachedStorage, new global::Sample.Storage.Storage(Pipeline, _modelReaderWriterOptions, _endpoint, _storageApiVersion, _subscriptionId), null) ?? _cachedStorage)); } public virtual global::Sample.Compute.Compute GetComputeClient() { - return (global::System.Threading.Volatile.Read(ref _cachedCompute) ?? (global::System.Threading.Interlocked.CompareExchange(ref _cachedCompute, new global::Sample.Compute.Compute(Pipeline, _endpoint, _computeApiVersion, _subscriptionId), null) ?? _cachedCompute)); + return (global::System.Threading.Volatile.Read(ref _cachedCompute) ?? (global::System.Threading.Interlocked.CompareExchange(ref _cachedCompute, new global::Sample.Compute.Compute(Pipeline, _modelReaderWriterOptions, _endpoint, _computeApiVersion, _subscriptionId), null) ?? _cachedCompute)); } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_GeneratesExpectedClient.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_GeneratesExpectedClient.cs index 56c1c6cf460..bd72bf5682c 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_GeneratesExpectedClient.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_GeneratesExpectedClient.cs @@ -13,6 +13,7 @@ namespace Sample public partial class TestClient { private readonly global::System.Uri _endpoint; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions = global::Sample.ModelSerializationExtensions.WireOptions; private readonly string _serviceAApiVersion; private readonly string _serviceBApiVersion; @@ -39,6 +40,7 @@ internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy a { Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly) }, Array.Empty()); } + _modelReaderWriterOptions = options.ModelProxies.ToWireOptions(); _serviceAApiVersion = options.ServiceAApiVersion; _serviceBApiVersion = options.ServiceBApiVersion; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClient.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClient.cs index 7a3f23c4d82..09a4b52be6c 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClient.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClient.cs @@ -13,6 +13,7 @@ namespace Sample public partial class TestClient { private readonly global::System.Uri _endpoint; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions = global::Sample.ModelSerializationExtensions.WireOptions; private readonly string _computeApiVersion; private readonly string _keyVaultApiVersion; private readonly string _storageApiVersion; @@ -40,6 +41,7 @@ internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy a { Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly) }, Array.Empty()); } + _modelReaderWriterOptions = options.ModelProxies.ToWireOptions(); _computeApiVersion = options.ComputeApiVersion; _keyVaultApiVersion = options.KeyVaultApiVersion; _storageApiVersion = options.StorageApiVersion; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingAccountsForCustomMethods(False).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingAccountsForCustomMethods(False).cs index 709385dd863..0d4209016da 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingAccountsForCustomMethods(False).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingAccountsForCustomMethods(False).cs @@ -15,25 +15,25 @@ public partial class TestClient [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] public virtual global::System.ClientModel.Primitives.CollectionResult GetItems(int? maxPageSize, string token, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsCollectionResult(this, maxPageSize, token, options); + return new global::Sample.TestClientGetItemsCollectionResult(this, _modelReaderWriterOptions, maxPageSize, token, options); } [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] public virtual global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(int? maxPageSize, string token, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, maxPageSize, token, options); + return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, _modelReaderWriterOptions, maxPageSize, token, options); } [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] public virtual global::System.ClientModel.CollectionResult GetItems(int? maxPageSize, string token, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, maxPageSize, token, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT(this, _modelReaderWriterOptions, maxPageSize, token, cancellationToken.ToRequestOptions()); } [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] public virtual global::System.ClientModel.AsyncCollectionResult GetItemsAsync(int? maxPageSize, string token, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, maxPageSize, token, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, _modelReaderWriterOptions, maxPageSize, token, cancellationToken.ToRequestOptions()); } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingImplementsRenamedPartials(False).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingImplementsRenamedPartials(False).cs index 50e5e5adbab..694031a05a1 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingImplementsRenamedPartials(False).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingImplementsRenamedPartials(False).cs @@ -13,32 +13,32 @@ public partial class TestClient { public virtual global::System.ClientModel.Primitives.CollectionResult GetItems(int? maxPageSize, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsCollectionResult(this, maxPageSize, default, options); + return new global::Sample.TestClientGetItemsCollectionResult(this, _modelReaderWriterOptions, maxPageSize, default, options); } public virtual global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(int? maxPageSize, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, maxPageSize, default, options); + return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, _modelReaderWriterOptions, maxPageSize, default, options); } public virtual global::System.ClientModel.CollectionResult GetItems(int? maxPageSize = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, maxPageSize, default, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT(this, _modelReaderWriterOptions, maxPageSize, default, cancellationToken.ToRequestOptions()); } public virtual global::System.ClientModel.AsyncCollectionResult GetItemsAsync(int? maxPageSize = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, maxPageSize, default, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, _modelReaderWriterOptions, maxPageSize, default, cancellationToken.ToRequestOptions()); } public partial global::System.ClientModel.Primitives.CollectionResult GetItems(int? maxPageSize, string resumeToken, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsCollectionResult(this, maxPageSize, resumeToken, options); + return new global::Sample.TestClientGetItemsCollectionResult(this, _modelReaderWriterOptions, maxPageSize, resumeToken, options); } public partial global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(int? maxPageSize, string resumeToken, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, maxPageSize, resumeToken, options); + return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, _modelReaderWriterOptions, maxPageSize, resumeToken, options); } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingPreservesTokenlessPartial.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingPreservesTokenlessPartial.cs index 5b7ff52d201..f266093e3e9 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingPreservesTokenlessPartial.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingPreservesTokenlessPartial.cs @@ -13,22 +13,22 @@ public partial class TestClient { public virtual global::System.ClientModel.Primitives.CollectionResult GetItems(int? maxPageSize, string token, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsCollectionResult(this, maxPageSize, token, options); + return new global::Sample.TestClientGetItemsCollectionResult(this, _modelReaderWriterOptions, maxPageSize, token, options); } public virtual global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(int? maxPageSize, string token, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, maxPageSize, token, options); + return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, _modelReaderWriterOptions, maxPageSize, token, options); } public partial global::System.ClientModel.CollectionResult GetItems(int? maxPageSize, global::System.Threading.CancellationToken cancellationToken) { - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, maxPageSize, default, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT(this, _modelReaderWriterOptions, maxPageSize, default, cancellationToken.ToRequestOptions()); } public partial global::System.ClientModel.AsyncCollectionResult GetItemsAsync(int? maxPageSize, global::System.Threading.CancellationToken cancellationToken) { - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, maxPageSize, default, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, _modelReaderWriterOptions, maxPageSize, default, cancellationToken.ToRequestOptions()); } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingRetainsTokenForLongerArgumentCollision.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingRetainsTokenForLongerArgumentCollision.cs index 4b8127255a5..42aeb59672c 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingRetainsTokenForLongerArgumentCollision.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingRetainsTokenForLongerArgumentCollision.cs @@ -13,22 +13,46 @@ public partial class TestClient { public virtual global::System.ClientModel.Primitives.CollectionResult GetItems(int? maxPageSize, string token, object filter, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsCollectionResult(this, maxPageSize, token, filter, options); + return new global::Sample.TestClientGetItemsCollectionResult( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + options); } public virtual global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(int? maxPageSize, string token, object filter, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, maxPageSize, token, filter, options); + return new global::Sample.TestClientGetItemsAsyncCollectionResult( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + options); } public virtual global::System.ClientModel.CollectionResult GetItems(int? maxPageSize = default, string token = default, object filter = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, maxPageSize, token, filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + cancellationToken.ToRequestOptions()); } public virtual global::System.ClientModel.AsyncCollectionResult GetItemsAsync(int? maxPageSize = default, string token = default, object filter = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, maxPageSize, token, filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + cancellationToken.ToRequestOptions()); } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingRetainsTokenForOptionalArgumentCollision.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingRetainsTokenForOptionalArgumentCollision.cs index a56aa14b538..00b9fb32c19 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingRetainsTokenForOptionalArgumentCollision.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingRetainsTokenForOptionalArgumentCollision.cs @@ -13,22 +13,46 @@ public partial class TestClient { public virtual global::System.ClientModel.Primitives.CollectionResult GetItems(int? maxPageSize, string token, string filter, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsCollectionResult(this, maxPageSize, token, filter, options); + return new global::Sample.TestClientGetItemsCollectionResult( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + options); } public virtual global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(int? maxPageSize, string token, string filter, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, maxPageSize, token, filter, options); + return new global::Sample.TestClientGetItemsAsyncCollectionResult( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + options); } public virtual global::System.ClientModel.CollectionResult GetItems(int? maxPageSize = default, string token = default, string filter = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, maxPageSize, token, filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + cancellationToken.ToRequestOptions()); } public virtual global::System.ClientModel.AsyncCollectionResult GetItemsAsync(int? maxPageSize = default, string token = default, string filter = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, maxPageSize, token, filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + cancellationToken.ToRequestOptions()); } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingUsesBetterLiteralConversion.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingUsesBetterLiteralConversion.cs index d35b0f69db9..8867ba8a53f 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingUsesBetterLiteralConversion.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/NextLinkPagingUsesBetterLiteralConversion.cs @@ -15,20 +15,38 @@ public partial class TestClient [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] public virtual global::System.ClientModel.Primitives.CollectionResult GetItems(int? maxPageSize, string token, object filter, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsCollectionResult(this, maxPageSize, token, filter, options); + return new global::Sample.TestClientGetItemsCollectionResult( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + options); } [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] public virtual global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(int? maxPageSize, string token, object filter, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, maxPageSize, token, filter, options); + return new global::Sample.TestClientGetItemsAsyncCollectionResult( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + options); } #pragma warning disable AZC0002 // Back-compat overload preserves the previous method signature where CancellationToken was the trailing parameter. Making it optional would introduce an ambiguous call with the new method. [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] public virtual global::System.ClientModel.CollectionResult GetItems(int? maxPageSize, string token, object filter, global::System.Threading.CancellationToken cancellationToken) { - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, maxPageSize, token, filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + cancellationToken.ToRequestOptions()); } #pragma warning restore AZC0002 // Back-compat overload preserves the previous method signature where CancellationToken was the trailing parameter. Making it optional would introduce an ambiguous call with the new method. @@ -36,7 +54,13 @@ public partial class TestClient [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] public virtual global::System.ClientModel.AsyncCollectionResult GetItemsAsync(int? maxPageSize, string token, object filter, global::System.Threading.CancellationToken cancellationToken) { - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, maxPageSize, token, filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT( + this, + _modelReaderWriterOptions, + maxPageSize, + token, + filter, + cancellationToken.ToRequestOptions()); } #pragma warning restore AZC0002 // Back-compat overload preserves the previous method signature where CancellationToken was the trailing parameter. Making it optional would introduce an ambiguous call with the new method. @@ -70,22 +94,46 @@ public partial class TestClient public virtual global::System.ClientModel.Primitives.CollectionResult GetItems(int? maxPageSize, object filter, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsCollectionResult(this, maxPageSize, default, filter, options); + return new global::Sample.TestClientGetItemsCollectionResult( + this, + _modelReaderWriterOptions, + maxPageSize, + default, + filter, + options); } public virtual global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(int? maxPageSize, object filter, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, maxPageSize, default, filter, options); + return new global::Sample.TestClientGetItemsAsyncCollectionResult( + this, + _modelReaderWriterOptions, + maxPageSize, + default, + filter, + options); } public virtual global::System.ClientModel.CollectionResult GetItems(int? maxPageSize = default, object filter = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, maxPageSize, default, filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT( + this, + _modelReaderWriterOptions, + maxPageSize, + default, + filter, + cancellationToken.ToRequestOptions()); } public virtual global::System.ClientModel.AsyncCollectionResult GetItemsAsync(int? maxPageSize = default, object filter = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, maxPageSize, default, filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT( + this, + _modelReaderWriterOptions, + maxPageSize, + default, + filter, + cancellationToken.ToRequestOptions()); } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,False,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,False,0).cs index 395de44a9d8..a2c2eef505e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,False,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,False,0).cs @@ -11,3 +11,4 @@ { Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly) }, Array.Empty()); } +_modelReaderWriterOptions = options.ModelProxies.ToWireOptions(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,True,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,True,0).cs index 395de44a9d8..a2c2eef505e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,True,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,True,0).cs @@ -11,3 +11,4 @@ { Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly) }, Array.Empty()); } +_modelReaderWriterOptions = options.ModelProxies.ToWireOptions(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,False,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,False,0).cs index 395de44a9d8..a2c2eef505e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,False,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,False,0).cs @@ -11,3 +11,4 @@ { Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly) }, Array.Empty()); } +_modelReaderWriterOptions = options.ModelProxies.ToWireOptions(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,True,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,True,0).cs index 395de44a9d8..a2c2eef505e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,True,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,True,0).cs @@ -11,3 +11,4 @@ { Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly) }, Array.Empty()); } +_modelReaderWriterOptions = options.ModelProxies.ToWireOptions(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,False,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,False,0).cs index 395de44a9d8..a2c2eef505e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,False,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,False,0).cs @@ -11,3 +11,4 @@ { Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly) }, Array.Empty()); } +_modelReaderWriterOptions = options.ModelProxies.ToWireOptions(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,True,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,True,0).cs index 395de44a9d8..a2c2eef505e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,True,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,True,0).cs @@ -11,3 +11,4 @@ { Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly) }, Array.Empty()); } +_modelReaderWriterOptions = options.ModelProxies.ToWireOptions(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,False,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,False,0).cs index 395de44a9d8..a2c2eef505e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,False,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,False,0).cs @@ -11,3 +11,4 @@ { Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly) }, Array.Empty()); } +_modelReaderWriterOptions = options.ModelProxies.ToWireOptions(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,True,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,True,0).cs index 395de44a9d8..a2c2eef505e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,True,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,True,0).cs @@ -11,3 +11,4 @@ { Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly) }, Array.Empty()); } +_modelReaderWriterOptions = options.ModelProxies.ToWireOptions(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestMultipartClient_UploadMethods_MultiFileOnlyBody.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestMultipartClient_UploadMethods_MultiFileOnlyBody.cs index af991d4332a..ee8b9bbe0c3 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestMultipartClient_UploadMethods_MultiFileOnlyBody.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestMultipartClient_UploadMethods_MultiFileOnlyBody.cs @@ -36,7 +36,7 @@ public partial class MultipartClient { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.MultiPartFormContent content = body.ToMultipartFormContent(); + using global::System.ClientModel.MultiPartFormContent content = body.ToMultipartFormContent(_modelReaderWriterOptions); return this.Upload(content, content.MediaType, cancellationToken.ToRequestOptions()); } @@ -45,7 +45,7 @@ public partial class MultipartClient { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.MultiPartFormContent content = body.ToMultipartFormContent(); + using global::System.ClientModel.MultiPartFormContent content = body.ToMultipartFormContent(_modelReaderWriterOptions); return await this.UploadAsync(content, content.MediaType, cancellationToken.ToRequestOptions()).ConfigureAwait(false); } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestMultipartClient_UploadMethods_OptionalBody.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestMultipartClient_UploadMethods_OptionalBody.cs index dd0dd5580b0..811b4e5b4f9 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestMultipartClient_UploadMethods_OptionalBody.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestMultipartClient_UploadMethods_OptionalBody.cs @@ -28,14 +28,14 @@ public partial class MultipartClient [global::System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0004")] public virtual global::System.ClientModel.ClientResult Upload(global::Sample.Models.MultiPartContent body = default, global::System.Threading.CancellationToken cancellationToken = default) { - using global::System.ClientModel.MultiPartFormContent content = body?.ToMultipartFormContent(); + using global::System.ClientModel.MultiPartFormContent content = body?.ToMultipartFormContent(_modelReaderWriterOptions); return this.Upload(content, content?.MediaType, cancellationToken.ToRequestOptions()); } [global::System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0004")] public virtual async global::System.Threading.Tasks.Task UploadAsync(global::Sample.Models.MultiPartContent body = default, global::System.Threading.CancellationToken cancellationToken = default) { - using global::System.ClientModel.MultiPartFormContent content = body?.ToMultipartFormContent(); + using global::System.ClientModel.MultiPartFormContent content = body?.ToMultipartFormContent(_modelReaderWriterOptions); return await this.UploadAsync(content?.MediaType, content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestMultipartClient_UploadMethods_OptionalFileBody.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestMultipartClient_UploadMethods_OptionalFileBody.cs index 325f0fc7497..0b996f4acc8 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestMultipartClient_UploadMethods_OptionalFileBody.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestMultipartClient_UploadMethods_OptionalFileBody.cs @@ -36,7 +36,7 @@ public partial class MultipartClient { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.MultiPartFormContent content = body.ToMultipartFormContent(); + using global::System.ClientModel.MultiPartFormContent content = body.ToMultipartFormContent(_modelReaderWriterOptions); return this.Upload(content, content.MediaType, cancellationToken.ToRequestOptions()); } @@ -45,7 +45,7 @@ public partial class MultipartClient { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.MultiPartFormContent content = body.ToMultipartFormContent(); + using global::System.ClientModel.MultiPartFormContent content = body.ToMultipartFormContent(_modelReaderWriterOptions); return await this.UploadAsync(content, content.MediaType, cancellationToken.ToRequestOptions()).ConfigureAwait(false); } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestMultipartClient_UploadMethods_RequiredFileBody.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestMultipartClient_UploadMethods_RequiredFileBody.cs index f2900d92326..f940efbd6b8 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestMultipartClient_UploadMethods_RequiredFileBody.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestMultipartClient_UploadMethods_RequiredFileBody.cs @@ -36,7 +36,7 @@ public partial class MultipartClient { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.MultiPartFormContent content = body.ToMultipartFormContent(); + using global::System.ClientModel.MultiPartFormContent content = body.ToMultipartFormContent(_modelReaderWriterOptions); return this.Upload(content, content.MediaType, cancellationToken.ToRequestOptions()); } @@ -45,7 +45,7 @@ public partial class MultipartClient { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.MultiPartFormContent content = body.ToMultipartFormContent(); + using global::System.ClientModel.MultiPartFormContent content = body.ToMultipartFormContent(_modelReaderWriterOptions); return await this.UploadAsync(content, content.MediaType, cancellationToken.ToRequestOptions()).ConfigureAwait(false); } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/ValidateConstructorsWhenUnsupportedAuth.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/ValidateConstructorsWhenUnsupportedAuth.cs index 89829df5a76..56c1158f003 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/ValidateConstructorsWhenUnsupportedAuth.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/ValidateConstructorsWhenUnsupportedAuth.cs @@ -28,6 +28,7 @@ internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy a { Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly) }, Array.Empty()); } + _modelReaderWriterOptions = options.ModelProxies.ToWireOptions(); } internal TestClient(global::System.Uri endpoint, global::Sample.TestClientOptions options) : this(null, endpoint, options) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/XmlDocsAreWritten.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/XmlDocsAreWritten.cs index 7166e071f8c..ba454f3291d 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/XmlDocsAreWritten.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/XmlDocsAreWritten.cs @@ -14,6 +14,7 @@ namespace Sample public partial class TestClient { private readonly global::System.Uri _endpoint; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions = global::Sample.ModelSerializationExtensions.WireOptions; private readonly string _queryParam; /// Initializes a new instance of TestClient for mocking. @@ -52,6 +53,7 @@ internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy a { Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly) }, Array.Empty()); } + _modelReaderWriterOptions = options.ModelProxies.ToWireOptions(); } /// Initializes a new instance of TestClient. diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/CollectionResultDefinitionTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/CollectionResultDefinitionTests.cs index 140debd49f1..9b452da8876 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/CollectionResultDefinitionTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/CollectionResultDefinitionTests.cs @@ -80,8 +80,8 @@ public void TestCanMutateDefinition() var ctor = constructors[0]; var ctorParameters = ctor.Signature.Parameters; - // should now only have the client name parameter - Assert.AreEqual(1, ctorParameters.Count); + // should now only have the client and the client's model reader writer options parameters + CollectionAssert.AreEqual(new[] { "client", "modelReaderWriterOptions" }, ctorParameters.Select(p => p.Name)); } [Test] diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInBody.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInBody.cs index 4233475bb27..51074e72ea4 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInBody.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInBody.cs @@ -13,12 +13,14 @@ namespace Sample internal partial class CatClientGetCatsCollectionResult : global::System.ClientModel.Primitives.CollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _myToken; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsCollectionResult(global::Sample.CatClient client, string myToken, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, string myToken, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _myToken = myToken; _options = options; } @@ -32,7 +34,7 @@ public CatClientGetCatsCollectionResult(global::Sample.CatClient client, string global::System.ClientModel.ClientResult result = this.GetNextResponse(message); yield return result; - nextToken = ((global::Sample.Models.Page)result).NextPage; + nextToken = global::Sample.Models.Page.FromClientResult(result, _modelReaderWriterOptions).NextPage; if (string.IsNullOrEmpty(nextToken)) { yield break; @@ -43,7 +45,7 @@ public CatClientGetCatsCollectionResult(global::Sample.CatClient client, string public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) { - string nextPage = ((global::Sample.Models.Page)page).NextPage; + string nextPage = global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NextPage; if (!string.IsNullOrEmpty(nextPage)) { return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage)); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInBodyAsync.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInBodyAsync.cs index 5f5cff04a6f..3f879ce89bd 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInBodyAsync.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInBodyAsync.cs @@ -14,12 +14,14 @@ namespace Sample internal partial class CatClientGetCatsAsyncCollectionResult : global::System.ClientModel.Primitives.AsyncCollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _myToken; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, string myToken, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, string myToken, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _myToken = myToken; _options = options; } @@ -33,7 +35,7 @@ public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, st global::System.ClientModel.ClientResult result = await this.GetNextResponseAsync(message).ConfigureAwait(false); yield return result; - nextToken = ((global::Sample.Models.Page)result).NextPage; + nextToken = global::Sample.Models.Page.FromClientResult(result, _modelReaderWriterOptions).NextPage; if (string.IsNullOrEmpty(nextToken)) { yield break; @@ -44,7 +46,7 @@ public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, st public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) { - string nextPage = ((global::Sample.Models.Page)page).NextPage; + string nextPage = global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NextPage; if (!string.IsNullOrEmpty(nextPage)) { return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage)); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInBodyOfT.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInBodyOfT.cs index 4f36757aac3..7776e52967d 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInBodyOfT.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInBodyOfT.cs @@ -13,12 +13,14 @@ namespace Sample internal partial class CatClientGetCatsCollectionResultOfT : global::System.ClientModel.CollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _myToken; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, string myToken, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, string myToken, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _myToken = myToken; _options = options; } @@ -32,7 +34,7 @@ public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, stri global::System.ClientModel.ClientResult result = this.GetNextResponse(message); yield return result; - nextToken = ((global::Sample.Models.Page)result).NextPage; + nextToken = global::Sample.Models.Page.FromClientResult(result, _modelReaderWriterOptions).NextPage; if (string.IsNullOrEmpty(nextToken)) { yield break; @@ -43,7 +45,7 @@ public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, stri public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) { - string nextPage = ((global::Sample.Models.Page)page).NextPage; + string nextPage = global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NextPage; if (!string.IsNullOrEmpty(nextPage)) { return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage)); @@ -56,7 +58,7 @@ public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, stri protected override global::System.Collections.Generic.IEnumerable GetValuesFromPage(global::System.ClientModel.ClientResult page) { - return ((global::Sample.Models.Page)page).Cats; + return global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).Cats; } private global::System.ClientModel.ClientResult GetNextResponse(global::System.ClientModel.Primitives.PipelineMessage message) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInBodyOfTAsync.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInBodyOfTAsync.cs index 9b5efe704c7..54a3cb6a1d0 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInBodyOfTAsync.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInBodyOfTAsync.cs @@ -14,12 +14,14 @@ namespace Sample internal partial class CatClientGetCatsAsyncCollectionResultOfT : global::System.ClientModel.AsyncCollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _myToken; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, string myToken, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, string myToken, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _myToken = myToken; _options = options; } @@ -33,7 +35,7 @@ public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.ClientResult result = await this.GetNextResponseAsync(message).ConfigureAwait(false); yield return result; - nextToken = ((global::Sample.Models.Page)result).NextPage; + nextToken = global::Sample.Models.Page.FromClientResult(result, _modelReaderWriterOptions).NextPage; if (string.IsNullOrEmpty(nextToken)) { yield break; @@ -44,7 +46,7 @@ public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) { - string nextPage = ((global::Sample.Models.Page)page).NextPage; + string nextPage = global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NextPage; if (!string.IsNullOrEmpty(nextPage)) { return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage)); @@ -57,7 +59,7 @@ public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, protected override async global::System.Collections.Generic.IAsyncEnumerable GetValuesFromPageAsync(global::System.ClientModel.ClientResult page) { - foreach (global::Sample.Models.Cat item in ((global::Sample.Models.Page)page).Cats) + foreach (global::Sample.Models.Cat item in global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).Cats) { yield return item; await global::System.Threading.Tasks.Task.Yield(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInHeader.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInHeader.cs index e9a9ca657c9..080ff3a27d2 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInHeader.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInHeader.cs @@ -12,12 +12,14 @@ namespace Sample internal partial class CatClientGetCatsCollectionResult : global::System.ClientModel.Primitives.CollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _myToken; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsCollectionResult(global::Sample.CatClient client, string myToken, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, string myToken, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _myToken = myToken; _options = options; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInHeaderAsync.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInHeaderAsync.cs index 1eb510af463..f919a54e97a 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInHeaderAsync.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInHeaderAsync.cs @@ -13,12 +13,14 @@ namespace Sample internal partial class CatClientGetCatsAsyncCollectionResult : global::System.ClientModel.Primitives.AsyncCollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _myToken; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, string myToken, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, string myToken, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _myToken = myToken; _options = options; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInHeaderOfT.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInHeaderOfT.cs index 37b39ba49df..26709189485 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInHeaderOfT.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInHeaderOfT.cs @@ -13,12 +13,14 @@ namespace Sample internal partial class CatClientGetCatsCollectionResultOfT : global::System.ClientModel.CollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _myToken; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, string myToken, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, string myToken, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _myToken = myToken; _options = options; } @@ -58,7 +60,7 @@ public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, stri protected override global::System.Collections.Generic.IEnumerable GetValuesFromPage(global::System.ClientModel.ClientResult page) { - return ((global::Sample.Models.Page)page).Cats; + return global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).Cats; } private global::System.ClientModel.ClientResult GetNextResponse(global::System.ClientModel.Primitives.PipelineMessage message) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInHeaderOfTAsync.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInHeaderOfTAsync.cs index 100adfd6448..0c615b2123d 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInHeaderOfTAsync.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/ContinuationTokenInHeaderOfTAsync.cs @@ -14,12 +14,14 @@ namespace Sample internal partial class CatClientGetCatsAsyncCollectionResultOfT : global::System.ClientModel.AsyncCollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _myToken; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, string myToken, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, string myToken, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _myToken = myToken; _options = options; } @@ -59,7 +61,7 @@ public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, protected override async global::System.Collections.Generic.IAsyncEnumerable GetValuesFromPageAsync(global::System.ClientModel.ClientResult page) { - foreach (global::Sample.Models.Cat item in ((global::Sample.Models.Page)page).Cats) + foreach (global::Sample.Models.Cat item in global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).Cats) { yield return item; await global::System.Threading.Tasks.Task.Yield(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/NestedContinuationTokenInBody.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/NestedContinuationTokenInBody.cs index df0444e754e..31c998e4f45 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/NestedContinuationTokenInBody.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/NestedContinuationTokenInBody.cs @@ -13,12 +13,14 @@ namespace Sample internal partial class CatClientGetCatsCollectionResult : global::System.ClientModel.Primitives.CollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _myToken; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsCollectionResult(global::Sample.CatClient client, string myToken, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, string myToken, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _myToken = myToken; _options = options; } @@ -32,7 +34,7 @@ public CatClientGetCatsCollectionResult(global::Sample.CatClient client, string global::System.ClientModel.ClientResult result = this.GetNextResponse(message); yield return result; - nextToken = ((global::Sample.Models.Page)result).NestedNext?.NextPage; + nextToken = global::Sample.Models.Page.FromClientResult(result, _modelReaderWriterOptions).NestedNext?.NextPage; if (string.IsNullOrEmpty(nextToken)) { yield break; @@ -43,7 +45,7 @@ public CatClientGetCatsCollectionResult(global::Sample.CatClient client, string public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) { - string nextPage = ((global::Sample.Models.Page)page).NestedNext?.NextPage; + string nextPage = global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NestedNext?.NextPage; if (!string.IsNullOrEmpty(nextPage)) { return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage)); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/NestedContinuationTokenInBodyAsync.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/NestedContinuationTokenInBodyAsync.cs index 96c501d3cae..656e66f4c4c 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/NestedContinuationTokenInBodyAsync.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/NestedContinuationTokenInBodyAsync.cs @@ -14,12 +14,14 @@ namespace Sample internal partial class CatClientGetCatsAsyncCollectionResult : global::System.ClientModel.Primitives.AsyncCollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _myToken; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, string myToken, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, string myToken, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _myToken = myToken; _options = options; } @@ -33,7 +35,7 @@ public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, st global::System.ClientModel.ClientResult result = await this.GetNextResponseAsync(message).ConfigureAwait(false); yield return result; - nextToken = ((global::Sample.Models.Page)result).NestedNext?.NextPage; + nextToken = global::Sample.Models.Page.FromClientResult(result, _modelReaderWriterOptions).NestedNext?.NextPage; if (string.IsNullOrEmpty(nextToken)) { yield break; @@ -44,7 +46,7 @@ public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, st public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) { - string nextPage = ((global::Sample.Models.Page)page).NestedNext?.NextPage; + string nextPage = global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NestedNext?.NextPage; if (!string.IsNullOrEmpty(nextPage)) { return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage)); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/NestedContinuationTokenInBodyOfT.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/NestedContinuationTokenInBodyOfT.cs index 0859204216f..0cd136061f3 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/NestedContinuationTokenInBodyOfT.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/NestedContinuationTokenInBodyOfT.cs @@ -13,12 +13,14 @@ namespace Sample internal partial class CatClientGetCatsCollectionResultOfT : global::System.ClientModel.CollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _myToken; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, string myToken, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, string myToken, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _myToken = myToken; _options = options; } @@ -32,7 +34,7 @@ public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, stri global::System.ClientModel.ClientResult result = this.GetNextResponse(message); yield return result; - nextToken = ((global::Sample.Models.Page)result).NestedNext?.NextPage; + nextToken = global::Sample.Models.Page.FromClientResult(result, _modelReaderWriterOptions).NestedNext?.NextPage; if (string.IsNullOrEmpty(nextToken)) { yield break; @@ -43,7 +45,7 @@ public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, stri public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) { - string nextPage = ((global::Sample.Models.Page)page).NestedNext?.NextPage; + string nextPage = global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NestedNext?.NextPage; if (!string.IsNullOrEmpty(nextPage)) { return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage)); @@ -56,7 +58,7 @@ public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, stri protected override global::System.Collections.Generic.IEnumerable GetValuesFromPage(global::System.ClientModel.ClientResult page) { - return ((global::Sample.Models.Page)page).NestedItems?.Cats; + return global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NestedItems?.Cats; } private global::System.ClientModel.ClientResult GetNextResponse(global::System.ClientModel.Primitives.PipelineMessage message) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/NestedContinuationTokenInBodyOfTAsync.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/NestedContinuationTokenInBodyOfTAsync.cs index 8d76e7e615b..63aad8bdc4e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/NestedContinuationTokenInBodyOfTAsync.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ContinuationTokenTests/NestedContinuationTokenInBodyOfTAsync.cs @@ -14,12 +14,14 @@ namespace Sample internal partial class CatClientGetCatsAsyncCollectionResultOfT : global::System.ClientModel.AsyncCollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _myToken; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, string myToken, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, string myToken, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _myToken = myToken; _options = options; } @@ -33,7 +35,7 @@ public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.ClientResult result = await this.GetNextResponseAsync(message).ConfigureAwait(false); yield return result; - nextToken = ((global::Sample.Models.Page)result).NestedNext?.NextPage; + nextToken = global::Sample.Models.Page.FromClientResult(result, _modelReaderWriterOptions).NestedNext?.NextPage; if (string.IsNullOrEmpty(nextToken)) { yield break; @@ -44,7 +46,7 @@ public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) { - string nextPage = ((global::Sample.Models.Page)page).NestedNext?.NextPage; + string nextPage = global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NestedNext?.NextPage; if (!string.IsNullOrEmpty(nextPage)) { return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage)); @@ -57,7 +59,7 @@ public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, protected override async global::System.Collections.Generic.IAsyncEnumerable GetValuesFromPageAsync(global::System.ClientModel.ClientResult page) { - foreach (global::Sample.Models.Cat item in ((global::Sample.Models.Page)page).NestedItems?.Cats) + foreach (global::Sample.Models.Cat item in global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NestedItems?.Cats) { yield return item; await global::System.Threading.Tasks.Task.Yield(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ListPageableTests/NoNextLinkOrContinuationToken.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ListPageableTests/NoNextLinkOrContinuationToken.cs index be79971e212..9ba3d6b071f 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ListPageableTests/NoNextLinkOrContinuationToken.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ListPageableTests/NoNextLinkOrContinuationToken.cs @@ -11,12 +11,14 @@ namespace Sample internal partial class CatClientGetCatsCollectionResult : global::System.ClientModel.Primitives.CollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _animalKind; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsCollectionResult(global::Sample.CatClient client, string animalKind, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, string animalKind, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _animalKind = animalKind; _options = options; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ListPageableTests/NoNextLinkOrContinuationTokenAsync.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ListPageableTests/NoNextLinkOrContinuationTokenAsync.cs index 622d18d500d..a5dd9478cf3 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ListPageableTests/NoNextLinkOrContinuationTokenAsync.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ListPageableTests/NoNextLinkOrContinuationTokenAsync.cs @@ -12,12 +12,14 @@ namespace Sample internal partial class CatClientGetCatsAsyncCollectionResult : global::System.ClientModel.Primitives.AsyncCollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _animalKind; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, string animalKind, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, string animalKind, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _animalKind = animalKind; _options = options; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ListPageableTests/NoNextLinkOrContinuationTokenOfT.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ListPageableTests/NoNextLinkOrContinuationTokenOfT.cs index 2dee0b1ed72..b2073ed3f87 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ListPageableTests/NoNextLinkOrContinuationTokenOfT.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ListPageableTests/NoNextLinkOrContinuationTokenOfT.cs @@ -12,12 +12,14 @@ namespace Sample internal partial class CatClientGetCatsCollectionResultOfT : global::System.ClientModel.CollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _animalKind; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, string animalKind, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, string animalKind, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _animalKind = animalKind; _options = options; } @@ -35,7 +37,7 @@ public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, stri protected override global::System.Collections.Generic.IEnumerable GetValuesFromPage(global::System.ClientModel.ClientResult page) { - return ((global::Sample.Models.Page)page).Cats; + return global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).Cats; } private global::System.ClientModel.ClientResult GetNextResponse(global::System.ClientModel.Primitives.PipelineMessage message) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ListPageableTests/NoNextLinkOrContinuationTokenOfTAsync.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ListPageableTests/NoNextLinkOrContinuationTokenOfTAsync.cs index 6c82884dc73..c4a0108c22f 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ListPageableTests/NoNextLinkOrContinuationTokenOfTAsync.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/ListPageableTests/NoNextLinkOrContinuationTokenOfTAsync.cs @@ -13,12 +13,14 @@ namespace Sample internal partial class CatClientGetCatsAsyncCollectionResultOfT : global::System.ClientModel.AsyncCollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _animalKind; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, string animalKind, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, string animalKind, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _animalKind = animalKind; _options = options; } @@ -36,7 +38,7 @@ public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, protected override async global::System.Collections.Generic.IAsyncEnumerable GetValuesFromPageAsync(global::System.ClientModel.ClientResult page) { - foreach (global::Sample.Models.Cat item in ((global::Sample.Models.Page)page).Cats) + foreach (global::Sample.Models.Cat item in global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).Cats) { yield return item; await global::System.Threading.Tasks.Task.Yield(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/InheritedNextLinkInBody.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/InheritedNextLinkInBody.cs index 6c2fbb79051..ef0384b8aba 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/InheritedNextLinkInBody.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/InheritedNextLinkInBody.cs @@ -13,11 +13,13 @@ namespace Sample internal partial class CatClientGetCatsCollectionResult : global::System.ClientModel.Primitives.CollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -30,7 +32,7 @@ public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global: global::System.ClientModel.ClientResult result = this.GetNextResponse(message); yield return result; - nextPageUri = ((global::Sample.Models.Page)result).NextCat; + nextPageUri = global::Sample.Models.Page.FromClientResult(result, _modelReaderWriterOptions).NextCat; if ((nextPageUri == null)) { yield break; @@ -41,7 +43,7 @@ public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global: public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) { - global::System.Uri nextPage = ((global::Sample.Models.Page)page).NextCat; + global::System.Uri nextPage = global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NextCat; if ((nextPage != null)) { return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage.IsAbsoluteUri ? nextPage.AbsoluteUri : nextPage.OriginalString)); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/InheritedNextLinkInBodyAsync.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/InheritedNextLinkInBodyAsync.cs index 86d2adfba2f..2e9105837db 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/InheritedNextLinkInBodyAsync.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/InheritedNextLinkInBodyAsync.cs @@ -14,11 +14,13 @@ namespace Sample internal partial class CatClientGetCatsAsyncCollectionResult : global::System.ClientModel.Primitives.AsyncCollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -31,7 +33,7 @@ public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, gl global::System.ClientModel.ClientResult result = await this.GetNextResponseAsync(message).ConfigureAwait(false); yield return result; - nextPageUri = ((global::Sample.Models.Page)result).NextCat; + nextPageUri = global::Sample.Models.Page.FromClientResult(result, _modelReaderWriterOptions).NextCat; if ((nextPageUri == null)) { yield break; @@ -42,7 +44,7 @@ public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, gl public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) { - global::System.Uri nextPage = ((global::Sample.Models.Page)page).NextCat; + global::System.Uri nextPage = global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NextCat; if ((nextPage != null)) { return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage.IsAbsoluteUri ? nextPage.AbsoluteUri : nextPage.OriginalString)); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/InheritedNextLinkInBodyOfT.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/InheritedNextLinkInBodyOfT.cs index ea15f35606f..8d5c1ae1ded 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/InheritedNextLinkInBodyOfT.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/InheritedNextLinkInBodyOfT.cs @@ -13,11 +13,13 @@ namespace Sample internal partial class CatClientGetCatsCollectionResultOfT : global::System.ClientModel.CollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -30,7 +32,7 @@ public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, glob global::System.ClientModel.ClientResult result = this.GetNextResponse(message); yield return result; - nextPageUri = ((global::Sample.Models.Page)result).NextCat; + nextPageUri = global::Sample.Models.Page.FromClientResult(result, _modelReaderWriterOptions).NextCat; if ((nextPageUri == null)) { yield break; @@ -41,7 +43,7 @@ public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, glob public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) { - global::System.Uri nextPage = ((global::Sample.Models.Page)page).NextCat; + global::System.Uri nextPage = global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NextCat; if ((nextPage != null)) { return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage.IsAbsoluteUri ? nextPage.AbsoluteUri : nextPage.OriginalString)); @@ -54,7 +56,7 @@ public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, glob protected override global::System.Collections.Generic.IEnumerable GetValuesFromPage(global::System.ClientModel.ClientResult page) { - return ((global::Sample.Models.Page)page).Cats; + return global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).Cats; } private global::System.ClientModel.ClientResult GetNextResponse(global::System.ClientModel.Primitives.PipelineMessage message) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/InheritedNextLinkInBodyOfTAsync.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/InheritedNextLinkInBodyOfTAsync.cs index 6e4695ff104..661f6cc8fcf 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/InheritedNextLinkInBodyOfTAsync.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/InheritedNextLinkInBodyOfTAsync.cs @@ -14,11 +14,13 @@ namespace Sample internal partial class CatClientGetCatsAsyncCollectionResultOfT : global::System.ClientModel.AsyncCollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -31,7 +33,7 @@ public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.ClientResult result = await this.GetNextResponseAsync(message).ConfigureAwait(false); yield return result; - nextPageUri = ((global::Sample.Models.Page)result).NextCat; + nextPageUri = global::Sample.Models.Page.FromClientResult(result, _modelReaderWriterOptions).NextCat; if ((nextPageUri == null)) { yield break; @@ -42,7 +44,7 @@ public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) { - global::System.Uri nextPage = ((global::Sample.Models.Page)page).NextCat; + global::System.Uri nextPage = global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NextCat; if ((nextPage != null)) { return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage.IsAbsoluteUri ? nextPage.AbsoluteUri : nextPage.OriginalString)); @@ -55,7 +57,7 @@ public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, protected override async global::System.Collections.Generic.IAsyncEnumerable GetValuesFromPageAsync(global::System.ClientModel.ClientResult page) { - foreach (global::Sample.Models.Cat item in ((global::Sample.Models.Page)page).Cats) + foreach (global::Sample.Models.Cat item in global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).Cats) { yield return item; await global::System.Threading.Tasks.Task.Yield(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NestedNextLinkInBody.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NestedNextLinkInBody.cs index 72bdccbd446..36da54c549c 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NestedNextLinkInBody.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NestedNextLinkInBody.cs @@ -13,11 +13,13 @@ namespace Sample internal partial class CatClientGetCatsCollectionResult : global::System.ClientModel.Primitives.CollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -30,7 +32,7 @@ public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global: global::System.ClientModel.ClientResult result = this.GetNextResponse(message); yield return result; - nextPageUri = ((global::Sample.Models.Page)result).NestedNext?.NextCat; + nextPageUri = global::Sample.Models.Page.FromClientResult(result, _modelReaderWriterOptions).NestedNext?.NextCat; if ((nextPageUri == null)) { yield break; @@ -41,7 +43,7 @@ public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global: public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) { - global::System.Uri nextPage = ((global::Sample.Models.Page)page).NestedNext?.NextCat; + global::System.Uri nextPage = global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NestedNext?.NextCat; if ((nextPage != null)) { return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage.IsAbsoluteUri ? nextPage.AbsoluteUri : nextPage.OriginalString)); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NestedNextLinkInBodyAsync.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NestedNextLinkInBodyAsync.cs index cbcf2b4ee78..3a6e9a751fe 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NestedNextLinkInBodyAsync.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NestedNextLinkInBodyAsync.cs @@ -14,11 +14,13 @@ namespace Sample internal partial class CatClientGetCatsAsyncCollectionResult : global::System.ClientModel.Primitives.AsyncCollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -31,7 +33,7 @@ public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, gl global::System.ClientModel.ClientResult result = await this.GetNextResponseAsync(message).ConfigureAwait(false); yield return result; - nextPageUri = ((global::Sample.Models.Page)result).NestedNext?.NextCat; + nextPageUri = global::Sample.Models.Page.FromClientResult(result, _modelReaderWriterOptions).NestedNext?.NextCat; if ((nextPageUri == null)) { yield break; @@ -42,7 +44,7 @@ public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, gl public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) { - global::System.Uri nextPage = ((global::Sample.Models.Page)page).NestedNext?.NextCat; + global::System.Uri nextPage = global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NestedNext?.NextCat; if ((nextPage != null)) { return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage.IsAbsoluteUri ? nextPage.AbsoluteUri : nextPage.OriginalString)); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NestedNextLinkInBodyOfT.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NestedNextLinkInBodyOfT.cs index d5b0b644c1d..6b60b50a4e6 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NestedNextLinkInBodyOfT.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NestedNextLinkInBodyOfT.cs @@ -13,11 +13,13 @@ namespace Sample internal partial class CatClientGetCatsCollectionResultOfT : global::System.ClientModel.CollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -30,7 +32,7 @@ public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, glob global::System.ClientModel.ClientResult result = this.GetNextResponse(message); yield return result; - nextPageUri = ((global::Sample.Models.Page)result).NestedNext?.NextCat; + nextPageUri = global::Sample.Models.Page.FromClientResult(result, _modelReaderWriterOptions).NestedNext?.NextCat; if ((nextPageUri == null)) { yield break; @@ -41,7 +43,7 @@ public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, glob public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) { - global::System.Uri nextPage = ((global::Sample.Models.Page)page).NestedNext?.NextCat; + global::System.Uri nextPage = global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NestedNext?.NextCat; if ((nextPage != null)) { return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage.IsAbsoluteUri ? nextPage.AbsoluteUri : nextPage.OriginalString)); @@ -54,7 +56,7 @@ public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, glob protected override global::System.Collections.Generic.IEnumerable GetValuesFromPage(global::System.ClientModel.ClientResult page) { - return ((global::Sample.Models.Page)page).NestedItems?.Cats; + return global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NestedItems?.Cats; } private global::System.ClientModel.ClientResult GetNextResponse(global::System.ClientModel.Primitives.PipelineMessage message) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NestedNextLinkInBodyOfTAsync.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NestedNextLinkInBodyOfTAsync.cs index b4fce30004f..5116da15bfd 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NestedNextLinkInBodyOfTAsync.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NestedNextLinkInBodyOfTAsync.cs @@ -14,11 +14,13 @@ namespace Sample internal partial class CatClientGetCatsAsyncCollectionResultOfT : global::System.ClientModel.AsyncCollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -31,7 +33,7 @@ public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.ClientResult result = await this.GetNextResponseAsync(message).ConfigureAwait(false); yield return result; - nextPageUri = ((global::Sample.Models.Page)result).NestedNext?.NextCat; + nextPageUri = global::Sample.Models.Page.FromClientResult(result, _modelReaderWriterOptions).NestedNext?.NextCat; if ((nextPageUri == null)) { yield break; @@ -42,7 +44,7 @@ public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) { - global::System.Uri nextPage = ((global::Sample.Models.Page)page).NestedNext?.NextCat; + global::System.Uri nextPage = global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NestedNext?.NextCat; if ((nextPage != null)) { return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage.IsAbsoluteUri ? nextPage.AbsoluteUri : nextPage.OriginalString)); @@ -55,7 +57,7 @@ public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, protected override async global::System.Collections.Generic.IAsyncEnumerable GetValuesFromPageAsync(global::System.ClientModel.ClientResult page) { - foreach (global::Sample.Models.Cat item in ((global::Sample.Models.Page)page).NestedItems?.Cats) + foreach (global::Sample.Models.Cat item in global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NestedItems?.Cats) { yield return item; await global::System.Threading.Tasks.Task.Yield(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInBody.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInBody.cs index 6c2fbb79051..ef0384b8aba 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInBody.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInBody.cs @@ -13,11 +13,13 @@ namespace Sample internal partial class CatClientGetCatsCollectionResult : global::System.ClientModel.Primitives.CollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -30,7 +32,7 @@ public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global: global::System.ClientModel.ClientResult result = this.GetNextResponse(message); yield return result; - nextPageUri = ((global::Sample.Models.Page)result).NextCat; + nextPageUri = global::Sample.Models.Page.FromClientResult(result, _modelReaderWriterOptions).NextCat; if ((nextPageUri == null)) { yield break; @@ -41,7 +43,7 @@ public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global: public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) { - global::System.Uri nextPage = ((global::Sample.Models.Page)page).NextCat; + global::System.Uri nextPage = global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NextCat; if ((nextPage != null)) { return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage.IsAbsoluteUri ? nextPage.AbsoluteUri : nextPage.OriginalString)); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInBodyAsync.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInBodyAsync.cs index 86d2adfba2f..2e9105837db 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInBodyAsync.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInBodyAsync.cs @@ -14,11 +14,13 @@ namespace Sample internal partial class CatClientGetCatsAsyncCollectionResult : global::System.ClientModel.Primitives.AsyncCollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -31,7 +33,7 @@ public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, gl global::System.ClientModel.ClientResult result = await this.GetNextResponseAsync(message).ConfigureAwait(false); yield return result; - nextPageUri = ((global::Sample.Models.Page)result).NextCat; + nextPageUri = global::Sample.Models.Page.FromClientResult(result, _modelReaderWriterOptions).NextCat; if ((nextPageUri == null)) { yield break; @@ -42,7 +44,7 @@ public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, gl public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) { - global::System.Uri nextPage = ((global::Sample.Models.Page)page).NextCat; + global::System.Uri nextPage = global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NextCat; if ((nextPage != null)) { return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage.IsAbsoluteUri ? nextPage.AbsoluteUri : nextPage.OriginalString)); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInBodyOfT.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInBodyOfT.cs index ea15f35606f..8d5c1ae1ded 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInBodyOfT.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInBodyOfT.cs @@ -13,11 +13,13 @@ namespace Sample internal partial class CatClientGetCatsCollectionResultOfT : global::System.ClientModel.CollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -30,7 +32,7 @@ public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, glob global::System.ClientModel.ClientResult result = this.GetNextResponse(message); yield return result; - nextPageUri = ((global::Sample.Models.Page)result).NextCat; + nextPageUri = global::Sample.Models.Page.FromClientResult(result, _modelReaderWriterOptions).NextCat; if ((nextPageUri == null)) { yield break; @@ -41,7 +43,7 @@ public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, glob public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) { - global::System.Uri nextPage = ((global::Sample.Models.Page)page).NextCat; + global::System.Uri nextPage = global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NextCat; if ((nextPage != null)) { return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage.IsAbsoluteUri ? nextPage.AbsoluteUri : nextPage.OriginalString)); @@ -54,7 +56,7 @@ public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, glob protected override global::System.Collections.Generic.IEnumerable GetValuesFromPage(global::System.ClientModel.ClientResult page) { - return ((global::Sample.Models.Page)page).Cats; + return global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).Cats; } private global::System.ClientModel.ClientResult GetNextResponse(global::System.ClientModel.Primitives.PipelineMessage message) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInBodyOfTAsync.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInBodyOfTAsync.cs index 6e4695ff104..661f6cc8fcf 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInBodyOfTAsync.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInBodyOfTAsync.cs @@ -14,11 +14,13 @@ namespace Sample internal partial class CatClientGetCatsAsyncCollectionResultOfT : global::System.ClientModel.AsyncCollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -31,7 +33,7 @@ public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.ClientResult result = await this.GetNextResponseAsync(message).ConfigureAwait(false); yield return result; - nextPageUri = ((global::Sample.Models.Page)result).NextCat; + nextPageUri = global::Sample.Models.Page.FromClientResult(result, _modelReaderWriterOptions).NextCat; if ((nextPageUri == null)) { yield break; @@ -42,7 +44,7 @@ public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) { - global::System.Uri nextPage = ((global::Sample.Models.Page)page).NextCat; + global::System.Uri nextPage = global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NextCat; if ((nextPage != null)) { return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage.IsAbsoluteUri ? nextPage.AbsoluteUri : nextPage.OriginalString)); @@ -55,7 +57,7 @@ public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, protected override async global::System.Collections.Generic.IAsyncEnumerable GetValuesFromPageAsync(global::System.ClientModel.ClientResult page) { - foreach (global::Sample.Models.Cat item in ((global::Sample.Models.Page)page).Cats) + foreach (global::Sample.Models.Cat item in global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).Cats) { yield return item; await global::System.Threading.Tasks.Task.Yield(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInHeader.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInHeader.cs index 98111f0fd7a..ed5c1a9ec95 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInHeader.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInHeader.cs @@ -12,11 +12,13 @@ namespace Sample internal partial class CatClientGetCatsCollectionResult : global::System.ClientModel.Primitives.CollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInHeaderAsync.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInHeaderAsync.cs index 75cf7c29d55..5bc9f54447e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInHeaderAsync.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInHeaderAsync.cs @@ -13,11 +13,13 @@ namespace Sample internal partial class CatClientGetCatsAsyncCollectionResult : global::System.ClientModel.Primitives.AsyncCollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInHeaderOfT.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInHeaderOfT.cs index 5cd6bbca8d5..d15681fbda5 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInHeaderOfT.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInHeaderOfT.cs @@ -13,11 +13,13 @@ namespace Sample internal partial class CatClientGetCatsCollectionResultOfT : global::System.ClientModel.CollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -56,7 +58,7 @@ public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, glob protected override global::System.Collections.Generic.IEnumerable GetValuesFromPage(global::System.ClientModel.ClientResult page) { - return ((global::Sample.Models.Page)page).Cats; + return global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).Cats; } private global::System.ClientModel.ClientResult GetNextResponse(global::System.ClientModel.Primitives.PipelineMessage message) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInHeaderOfTAsync.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInHeaderOfTAsync.cs index 7f242e4f7a5..1187be9f8ba 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInHeaderOfTAsync.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NextLinkInHeaderOfTAsync.cs @@ -14,11 +14,13 @@ namespace Sample internal partial class CatClientGetCatsAsyncCollectionResultOfT : global::System.ClientModel.AsyncCollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -57,7 +59,7 @@ public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, protected override async global::System.Collections.Generic.IAsyncEnumerable GetValuesFromPageAsync(global::System.ClientModel.ClientResult page) { - foreach (global::Sample.Models.Cat item in ((global::Sample.Models.Page)page).Cats) + foreach (global::Sample.Models.Cat item in global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).Cats) { yield return item; await global::System.Threading.Tasks.Task.Yield(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NormalizedDateTimeReinjectedParameterFiltersNextLinkArguments.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NormalizedDateTimeReinjectedParameterFiltersNextLinkArguments.cs index 980673e8da3..eea2d2be048 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NormalizedDateTimeReinjectedParameterFiltersNextLinkArguments.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/TestData/NextLinkTests/NormalizedDateTimeReinjectedParameterFiltersNextLinkArguments.cs @@ -13,13 +13,15 @@ namespace Sample internal partial class CatClientGetCatsCollectionResult : global::System.ClientModel.Primitives.CollectionResult { private readonly global::Sample.CatClient _client; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions; private readonly global::System.DateTimeOffset _startsOn; private readonly string _startsOn0; private readonly global::System.ClientModel.Primitives.RequestOptions _options; - public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global::System.DateTimeOffset startsOn, string startsOn0, global::System.ClientModel.Primitives.RequestOptions options) + public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.ModelReaderWriterOptions modelReaderWriterOptions, global::System.DateTimeOffset startsOn, string startsOn0, global::System.ClientModel.Primitives.RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _startsOn = startsOn; _startsOn0 = startsOn0; _options = options; @@ -34,7 +36,7 @@ public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global: global::System.ClientModel.ClientResult result = this.GetNextResponse(message); yield return result; - nextPageUri = ((global::Sample.Models.Page)result).NextCat; + nextPageUri = global::Sample.Models.Page.FromClientResult(result, _modelReaderWriterOptions).NextCat; if ((nextPageUri == null)) { yield break; @@ -45,7 +47,7 @@ public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global: public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) { - global::System.Uri nextPage = ((global::Sample.Models.Page)page).NextCat; + global::System.Uri nextPage = global::Sample.Models.Page.FromClientResult(page, _modelReaderWriterOptions).NextCat; if ((nextPage != null)) { return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage.IsAbsoluteUri ? nextPage.AbsoluteUri : nextPage.OriginalString)); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/BinaryContentHelperDefinitionTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/BinaryContentHelperDefinitionTests.cs index 715bdb21e5b..0cf2be40c45 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/BinaryContentHelperDefinitionTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/BinaryContentHelperDefinitionTests.cs @@ -54,7 +54,7 @@ public void FromEnumerableXmlMethodIsCorrectlyDefined() var binaryContentHelper = new BinaryContentHelperDefinition(); Assert.IsNotNull(binaryContentHelper.Methods); var method = binaryContentHelper.Methods.Single(m => m.Signature.Name == "FromEnumerable" - && m.Signature.Parameters.Count == 3 + && m.Signature.Parameters.Count == 4 && m.Signature.Parameters[1].Name == "rootNameHint"); Assert.IsNotNull(method); @@ -63,10 +63,12 @@ public void FromEnumerableXmlMethodIsCorrectlyDefined() Assert.AreEqual("FromEnumerable", signature.Name); Assert.AreEqual(MethodSignatureModifiers.Public | MethodSignatureModifiers.Static, signature.Modifiers); Assert.IsNotNull(signature.ReturnType); - Assert.AreEqual(3, signature.Parameters.Count); + Assert.AreEqual(4, signature.Parameters.Count); Assert.AreEqual("enumerable", signature.Parameters[0].Name); Assert.AreEqual("rootNameHint", signature.Parameters[1].Name); Assert.AreEqual("childNameHint", signature.Parameters[2].Name); + Assert.AreEqual("options", signature.Parameters[3].Name); + Assert.IsNotNull(signature.Parameters[3].DefaultValue); Assert.IsNotNull(signature.GenericArguments); Assert.AreEqual(1, signature.GenericArguments!.Count); Assert.IsNotNull(signature.GenericParameterConstraints); @@ -76,5 +78,30 @@ public void FromEnumerableXmlMethodIsCorrectlyDefined() Assert.IsNotNull(method.BodyStatements); Assert.AreEqual(Helpers.GetExpectedFromFile(), method.BodyStatements!.ToDisplayString()); } + + // Clients whose options carry model proxies pass them to the helpers that write models. The options are optional + // so existing callers keep writing with the wire options, and the BinaryData overloads don't take them. + [Test] + public void ModelWritingMethodsTakeOptionalOptions() + { + MockHelpers.LoadMockGenerator(); + + var binaryContentHelper = new BinaryContentHelperDefinition(); + var file = new TypeProviderWriter(new FilteredMethodsTypeProvider( + binaryContentHelper, + name => name is "FromEnumerable" or "FromDictionary")).Write(); + + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } + + [Test] + public void MethodsDoNotTakeOptionsWithoutModelProxies() + { + MockHelpers.LoadMockGenerator(clientPipelineApi: ClientPipelineWithoutModelProxies.Instance); + + var binaryContentHelper = new BinaryContentHelperDefinition(); + + Assert.IsFalse(binaryContentHelper.Methods.Any(m => m.Signature.Parameters.Any(p => p.Name == "options"))); + } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/ModelSerializationExtensionsDefinitionTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/ModelSerializationExtensionsDefinitionTests.cs index 2fcb6d05302..1a691f8f4d5 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/ModelSerializationExtensionsDefinitionTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/ModelSerializationExtensionsDefinitionTests.cs @@ -591,6 +591,23 @@ public void ValidateXmlWriteObjectValueMethodIsGenerated() Assert.IsTrue(writeStringValueMethods.Count == 1); } + // Snapshot of the GetUtf8Bytes overloads; the XElement overload re-serializes nested XML models so they can be + // read through ModelReaderWriter proxies. + [Test] + public void ValidateGetUtf8BytesMethodsWithXmlModels() + { + var xmlModel = InputFactory.Model( + "TestXmlModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: [InputFactory.Property("Name", InputPrimitiveType.String)]); + MockHelpers.LoadMockGenerator(inputModels: () => [xmlModel]); + + var definition = new ModelSerializationExtensionsDefinition(); + var writer = new TypeProviderWriter(new FilteredMethodsTypeProvider(definition, name => name == "GetUtf8Bytes")); + var file = writer.Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } + [Test] public void ValidateXmlWriteBase64StringVAlueMethodIsGenerated() { @@ -759,6 +776,75 @@ public void ValidateWriteFileBinaryContentMethod() Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); } + // Snapshot of the helper that decides whether nested models are read through ModelReaderWriter: + // only when proxies are registered and the context can build the requested type. The per-type cache + // keeps the context lookup off the hot path after the first read of each nested model type. + [Test] + public void ValidateShouldReadThroughProxyMethod() + { + MockHelpers.LoadMockGenerator(); + + var definition = new ModelSerializationExtensionsDefinition(); + var helper = new TypeProviderWriter(new FilteredMethodsTypeProvider(definition, name => name == "ShouldReadThroughProxy")).Write(); + var cache = new TypeProviderWriter(definition.NestedTypes.Single(t => t.Name == "ProxyReadEligibility")).Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), helper.Content); + Assert.AreEqual(Helpers.GetExpectedFromFile("Cache"), cache.Content); + } + + // Snapshot of the helper that reads dual-format nested models with XML options while keeping registered proxies. + [Test] + public void ValidateToXmlOptionsMethod() + { + var xmlModel = InputFactory.Model( + "TestXmlModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: [InputFactory.Property("Name", InputPrimitiveType.String)]); + MockHelpers.LoadMockGenerator(inputModels: () => [xmlModel]); + + var definition = new ModelSerializationExtensionsDefinition(); + var file = new TypeProviderWriter(new FilteredMethodsTypeProvider(definition, name => name == "ToXmlOptions")).Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } + + // Clients build their options from the configured model proxies once, keeping the shared wire options + // when none are configured. + [Test] + public void ValidateToWireOptionsMethod() + { + MockHelpers.LoadMockGenerator(); + + var definition = new ModelSerializationExtensionsDefinition(); + var file = new TypeProviderWriter(new FilteredMethodsTypeProvider(definition, name => name == "ToWireOptions")).Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } + + [Test] + public void ToWireOptionsMethodIsNotGeneratedWithoutModelProxies() + { + MockHelpers.LoadMockGenerator(clientPipelineApi: ClientPipelineWithoutModelProxies.Instance); + + var definition = new ModelSerializationExtensionsDefinition(); + Assert.IsFalse(definition.Methods.Any(m => m.Signature.Name == "ToWireOptions")); + } + + // Snapshot of the WriteObjectValue switch — verifies nested JSON models resolve registered proxies + // and keep writing the model directly when none are registered. + [Test] + public void ValidateWriteObjectValueResolvesModelProxies() + { + MockHelpers.LoadMockGenerator(); + + var definition = new ModelSerializationExtensionsDefinition(); + var method = definition.Methods + .Where(m => m.Signature.Name == "WriteObjectValue" && m.Signature.GenericArguments?.Count > 0) + .SingleOrDefault(); + Assert.IsNotNull(method); + + var writer = new TypeProviderWriter(new FilteredMethodsTypeProvider(definition, name => name == method!.Signature.Name)); + var file = writer.Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } + // Snapshot of the WriteObjectValue switch — verifies the FileBinaryContent case is emitted. [Test] public void ValidateWriteObjectValueIncludesFileBinaryContentCase() diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/BinaryContentHelperDefinitionTests/FromEnumerableXmlMethodIsCorrectlyDefined.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/BinaryContentHelperDefinitionTests/FromEnumerableXmlMethodIsCorrectlyDefined.cs index 263fdcc3fc9..d535bd3bdda 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/BinaryContentHelperDefinitionTests/FromEnumerableXmlMethodIsCorrectlyDefined.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/BinaryContentHelperDefinitionTests/FromEnumerableXmlMethodIsCorrectlyDefined.cs @@ -1,3 +1,4 @@ +options ??= global::Sample.ModelSerializationExtensions.WireOptions; using (global::System.IO.MemoryStream stream = new global::System.IO.MemoryStream(256)) { using (global::System.Xml.XmlWriter writer = global::System.Xml.XmlWriter.Create(stream, global::Sample.ModelSerializationExtensions.XmlWriterSettings)) @@ -5,7 +6,7 @@ writer.WriteStartElement(rootNameHint); foreach (var item in enumerable) { - writer.WriteObjectValue(item, global::Sample.ModelSerializationExtensions.WireOptions, childNameHint); + writer.WriteObjectValue(item, options, childNameHint); } writer.WriteEndElement(); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/BinaryContentHelperDefinitionTests/ModelWritingMethodsTakeOptionalOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/BinaryContentHelperDefinitionTests/ModelWritingMethodsTakeOptionalOptions.cs new file mode 100644 index 00000000000..230602012cc --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/BinaryContentHelperDefinitionTests/ModelWritingMethodsTakeOptionalOptions.cs @@ -0,0 +1,117 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; + +namespace Sample +{ + public partial class BinaryContentHelper + { + public static global::System.ClientModel.BinaryContent FromEnumerable(global::System.Collections.Generic.IEnumerable enumerable, global::System.ClientModel.Primitives.ModelReaderWriterOptions options = null) + where T : notnull + { + options ??= global::Sample.ModelSerializationExtensions.WireOptions; + global::Sample.Utf8JsonBinaryContent content = new global::Sample.Utf8JsonBinaryContent(); + content.JsonWriter.WriteStartArray(); + foreach (var item in enumerable) + { + content.JsonWriter.WriteObjectValue(item, options); + } + content.JsonWriter.WriteEndArray(); + + return content; + } + + public static global::System.ClientModel.BinaryContent FromEnumerable(global::System.Collections.Generic.IEnumerable enumerable) + { + global::Sample.Utf8JsonBinaryContent content = new global::Sample.Utf8JsonBinaryContent(); + content.JsonWriter.WriteStartArray(); + foreach (var item in enumerable) + { + if ((item == null)) + { + content.JsonWriter.WriteNullValue(); + } + else + { +#if NET6_0_OR_GREATER + content.JsonWriter.WriteRawValue(item); +#else + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(item)) + { + global::System.Text.Json.JsonSerializer.Serialize(content.JsonWriter, document.RootElement); + } +#endif + } + } + content.JsonWriter.WriteEndArray(); + + return content; + } + + public static global::System.ClientModel.BinaryContent FromEnumerable(global::System.ReadOnlySpan span, global::System.ClientModel.Primitives.ModelReaderWriterOptions options = null) + where T : notnull + { + options ??= global::Sample.ModelSerializationExtensions.WireOptions; + global::Sample.Utf8JsonBinaryContent content = new global::Sample.Utf8JsonBinaryContent(); + content.JsonWriter.WriteStartArray(); + int i = 0; + for (; (i < span.Length); i++) + { + content.JsonWriter.WriteObjectValue(span[i], options); + } + content.JsonWriter.WriteEndArray(); + + return content; + } + + public static global::System.ClientModel.BinaryContent FromDictionary(global::System.Collections.Generic.IDictionary dictionary, global::System.ClientModel.Primitives.ModelReaderWriterOptions options = null) + where TValue : notnull + { + options ??= global::Sample.ModelSerializationExtensions.WireOptions; + global::Sample.Utf8JsonBinaryContent content = new global::Sample.Utf8JsonBinaryContent(); + content.JsonWriter.WriteStartObject(); + foreach (var item in dictionary) + { + content.JsonWriter.WritePropertyName(item.Key); + content.JsonWriter.WriteObjectValue(item.Value, options); + } + content.JsonWriter.WriteEndObject(); + + return content; + } + + public static global::System.ClientModel.BinaryContent FromDictionary(global::System.Collections.Generic.IDictionary dictionary) + { + global::Sample.Utf8JsonBinaryContent content = new global::Sample.Utf8JsonBinaryContent(); + content.JsonWriter.WriteStartObject(); + foreach (var item in dictionary) + { + content.JsonWriter.WritePropertyName(item.Key); + if ((item.Value == null)) + { + content.JsonWriter.WriteNullValue(); + } + else + { +#if NET6_0_OR_GREATER + content.JsonWriter.WriteRawValue(item.Value); +#else + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(item.Value)) + { + global::System.Text.Json.JsonSerializer.Serialize(content.JsonWriter, document.RootElement); + } +#endif + } + } + content.JsonWriter.WriteEndObject(); + + return content; + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateGetUtf8BytesMethodsWithXmlModels.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateGetUtf8BytesMethodsWithXmlModels.cs new file mode 100644 index 00000000000..bd57b8f8a96 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateGetUtf8BytesMethodsWithXmlModels.cs @@ -0,0 +1,25 @@ +// + +#nullable disable + +using System; +using System.Runtime.InteropServices; +using System.Text.Json; +using System.Xml.Linq; + +namespace Sample +{ + public partial class ModelSerializationExtensions + { + public static global::System.BinaryData GetUtf8Bytes(this global::System.Text.Json.JsonElement element) + { +#if NET9_0_OR_GREATER + return new global::System.BinaryData(global::System.Runtime.InteropServices.JsonMarshal.GetRawUtf8Value(element).ToArray()); +#else + return global::System.BinaryData.FromString(element.GetRawText()); +#endif + } + + public static global::System.BinaryData GetUtf8Bytes(this global::System.Xml.Linq.XElement element) => global::System.BinaryData.FromString(element.ToString(global::System.Xml.Linq.SaveOptions.DisableFormatting)); + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateShouldReadThroughProxyMethod(Cache).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateShouldReadThroughProxyMethod(Cache).cs new file mode 100644 index 00000000000..66d380b87fb --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateShouldReadThroughProxyMethod(Cache).cs @@ -0,0 +1,24 @@ +// + +#nullable disable + +using System.ClientModel.Primitives; + +namespace Sample +{ + private static class ProxyReadEligibility + { + private static int s_state; + + public static bool IsBuildable(global::System.ClientModel.Primitives.ModelReaderWriterContext context) + { + int state = s_state; + if ((state == 0)) + { + state = context.TryGetTypeBuilder(typeof(T), out _) ? 1 : 2; + s_state = state; + } + return (state == 1); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateShouldReadThroughProxyMethod.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateShouldReadThroughProxyMethod.cs new file mode 100644 index 00000000000..49aa131b96c --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateShouldReadThroughProxyMethod.cs @@ -0,0 +1,16 @@ +// + +#nullable disable + +using System.ClientModel.Primitives; + +namespace Sample +{ + public partial class ModelSerializationExtensions + { + public static bool ShouldReadThroughProxy(this global::System.ClientModel.Primitives.ModelReaderWriterOptions options, global::System.ClientModel.Primitives.ModelReaderWriterContext context) + { + return ((options.Proxies.Count > 0) && global::Sample.ModelSerializationExtensions.ProxyReadEligibility.IsBuildable(context)); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateToWireOptionsMethod.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateToWireOptionsMethod.cs new file mode 100644 index 00000000000..3d0eabe2502 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateToWireOptionsMethod.cs @@ -0,0 +1,26 @@ +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Collections.Generic; + +namespace Sample +{ + public partial class ModelSerializationExtensions + { + public static global::System.ClientModel.Primitives.ModelReaderWriterOptions ToWireOptions(this global::System.Collections.Generic.IList modelProxies) + { + if ((modelProxies.Count == 0)) + { + return WireOptions; + } + global::System.ClientModel.Primitives.ModelReaderWriterOptions options = new global::System.ClientModel.Primitives.ModelReaderWriterOptions("W"); + foreach (global::System.ClientModel.Primitives.ModelProxy proxy in modelProxies) + { + options.Proxies.Add(proxy); + } + return options; + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateToXmlOptionsMethod.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateToXmlOptionsMethod.cs new file mode 100644 index 00000000000..020c1db5bf2 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateToXmlOptionsMethod.cs @@ -0,0 +1,25 @@ +// + +#nullable disable + +using System.ClientModel.Primitives; + +namespace Sample +{ + public partial class ModelSerializationExtensions + { + public static global::System.ClientModel.Primitives.ModelReaderWriterOptions ToXmlOptions(this global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + if ((options.Format == "X")) + { + return options; + } + global::System.ClientModel.Primitives.ModelReaderWriterOptions xmlOptions = new global::System.ClientModel.Primitives.ModelReaderWriterOptions("X"); + foreach (global::System.ClientModel.Primitives.ModelProxy proxy in options.Proxies) + { + xmlOptions.Proxies.Add(proxy); + } + return xmlOptions; + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateWriteObjectValueIncludesFileBinaryContentCase.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateWriteObjectValueIncludesFileBinaryContentCase.cs index ec7a3604dc5..ca83d18b8e3 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateWriteObjectValueIncludesFileBinaryContentCase.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateWriteObjectValueIncludesFileBinaryContentCase.cs @@ -21,7 +21,12 @@ public static void WriteObjectValue(this global::System.Text.Json.Utf8JsonWri writer.WriteNullValue(); break; case global::System.ClientModel.Primitives.IJsonModel jsonModel: - jsonModel.Write(writer, (options ?? global::Sample.ModelSerializationExtensions.WireOptions)); + options ??= global::Sample.ModelSerializationExtensions.WireOptions; + if ((options.Proxies.Count > 0)) + { + jsonModel = options.ResolveProxy(jsonModel); + } + jsonModel.Write(writer, options); break; case byte[] bytes: writer.WriteBase64StringValue(bytes); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateWriteObjectValueResolvesModelProxies.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateWriteObjectValueResolvesModelProxies.cs new file mode 100644 index 00000000000..e268024dce6 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateWriteObjectValueResolvesModelProxies.cs @@ -0,0 +1,118 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections; +using System.Collections.Generic; +using System.Text.Json; + +namespace Sample +{ + public partial class ModelSerializationExtensions + { + public static void WriteObjectValue(this global::System.Text.Json.Utf8JsonWriter writer, T value, global::System.ClientModel.Primitives.ModelReaderWriterOptions options = ((global::System.ClientModel.Primitives.ModelReaderWriterOptions)null)) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case global::System.ClientModel.Primitives.IJsonModel jsonModel: + options ??= global::Sample.ModelSerializationExtensions.WireOptions; + if ((options.Proxies.Count > 0)) + { + jsonModel = options.ResolveProxy(jsonModel); + } + jsonModel.Write(writer, options); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case global::System.BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case global::System.Text.Json.JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case short shortValue: + writer.WriteNumberValue(shortValue); + break; + case ushort ushortValue: + writer.WriteNumberValue(ushortValue); + break; + case uint uintValue: + writer.WriteNumberValue(uintValue); + break; + case ulong ulongValue: + writer.WriteNumberValue(ulongValue); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case global::System.Guid g: + writer.WriteStringValue(g); + break; + case global::System.DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case global::System.DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case global::System.Collections.Generic.IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case global::System.Collections.IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case global::System.TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new global::System.NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this global::System.Text.Json.Utf8JsonWriter writer, object value, global::System.ClientModel.Primitives.ModelReaderWriterOptions options = ((global::System.ClientModel.Primitives.ModelReaderWriterOptions)null)) + { + writer.WriteObjectValue(value, options); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateWriteObjectValueXmlIncludesFileBinaryContentCase.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateWriteObjectValueXmlIncludesFileBinaryContentCase.cs index 73e5c7af57f..74f495f4593 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateWriteObjectValueXmlIncludesFileBinaryContentCase.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateWriteObjectValueXmlIncludesFileBinaryContentCase.cs @@ -23,7 +23,12 @@ public static void WriteObjectValue(this global::System.Text.Json.Utf8JsonWri writer.WriteNullValue(); break; case global::System.ClientModel.Primitives.IJsonModel jsonModel: - jsonModel.Write(writer, (options ?? global::Sample.ModelSerializationExtensions.WireOptions)); + options ??= global::Sample.ModelSerializationExtensions.WireOptions; + if ((options.Proxies.Count > 0)) + { + jsonModel = options.ResolveProxy(jsonModel); + } + jsonModel.Write(writer, options); break; case byte[] bytes: writer.WriteBase64StringValue(bytes); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/DeserializationTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/DeserializationTests.cs index f2cf222b837..65919710619 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/DeserializationTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/DeserializationTests.cs @@ -160,6 +160,52 @@ public void TestDeserializationOfDurationMillisecondsIntegerWireType(string wire Assert.AreEqual(Helpers.GetExpectedFromFile(parameters: wireKindName), file.Content); } + // Validates that nested model properties, list items and dictionary values keep the static + // deserializer when no proxies are registered and otherwise read through ModelReaderWriter. + [Test] + public void NestedModelReadsRouteThroughModelProxies() + { + var nestedModel = InputFactory.Model("NestedModel", properties: [InputFactory.Property("name", InputPrimitiveType.String)]); + var inputModel = InputFactory.Model("TestModel", properties: + [ + InputFactory.Property("nested", nestedModel, isRequired: true), + InputFactory.Property("nestedList", InputFactory.Array(nestedModel)), + InputFactory.Property("nestedDictionary", InputFactory.Dictionary(nestedModel)), + InputFactory.Property("name", InputPrimitiveType.String) + ]); + + var mrwProvider = new ModelProvider(inputModel).SerializationProviders.FirstOrDefault(); + Assert.IsNotNull(mrwProvider); + var writer = new TypeProviderWriter(mrwProvider!); + var file = writer.Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } + + // The discriminator switch selects the concrete deserializer for the model that was already resolved, + // so it must not re-enter proxy resolution. + [Test] + public void DiscriminatorDispatchDoesNotRouteThroughModelProxies() + { + var catModel = InputFactory.Model("cat", discriminatedKind: "cat", properties: + [ + InputFactory.Property("kind", InputPrimitiveType.String, isRequired: true, isDiscriminator: true) + ]); + var petModel = InputFactory.Model( + "pet", + properties: [InputFactory.Property("kind", InputPrimitiveType.String, isRequired: true, isDiscriminator: true)], + discriminatedModels: new Dictionary() { { "cat", catModel } }); + + var serialization = ScmCodeModelGenerator.Instance.TypeFactory.CreateModel(petModel)!.SerializationProviders.FirstOrDefault(); + Assert.IsNotNull(serialization); + var deserializeMethod = serialization!.Methods.FirstOrDefault(m => m.Signature.Name == "DeserializePet"); + Assert.IsNotNull(deserializeMethod); + + var methodBody = deserializeMethod!.BodyStatements!.ToDisplayString(); + Assert.That(methodBody, Does.Contain("global::Sample.Models.Cat.DeserializeCat(element, options)")); + Assert.That(methodBody, Does.Not.Contain("ShouldReadThroughProxy")); + Assert.That(methodBody, Does.Not.Contain("ModelReaderWriter.Read")); + } + // Validates the deserialize body produced for a required FileBinaryContent property. [Test] public void RequiredFileBinaryContentProperty() diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/MrwSerializationTypeDefinitionTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/MrwSerializationTypeDefinitionTests.cs index 800a7b3e4de..ad707aa7cf2 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/MrwSerializationTypeDefinitionTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/MrwSerializationTypeDefinitionTests.cs @@ -22,14 +22,15 @@ namespace Microsoft.TypeSpec.Generator.ClientModel.Tests.Providers.MrwSerializat { internal class MrwSerializationTypeDefinitionTests { - internal static (ModelProvider Model, MrwSerializationTypeDefinition Serialization) CreateModelAndSerialization(InputModelType inputModel, bool isRootInput = true, bool isRootOutput = true) + internal static (ModelProvider Model, MrwSerializationTypeDefinition Serialization) CreateModelAndSerialization(InputModelType inputModel, bool isRootInput = true, bool isRootOutput = true, ClientPipelineApi? clientPipelineApi = null) { MockHelpers.LoadMockGenerator(); var model = ScmCodeModelGenerator.Instance.TypeFactory.CreateModel(inputModel); var generator = MockHelpers.LoadMockGenerator( inputModels: () => [inputModel], createSerializationsCore: (inputType, typeProvider) => - inputType is InputModelType modelType ? [new MrwSerializationTypeDefinition(modelType, (typeProvider as ModelProvider)!)] : []); + inputType is InputModelType modelType ? [new MrwSerializationTypeDefinition(modelType, (typeProvider as ModelProvider)!)] : [], + clientPipelineApi: clientPipelineApi); if (isRootInput) { generator.Object.TypeFactory.RootInputModels.Add(inputModel); @@ -1526,7 +1527,7 @@ public void TestBuildToBinaryContentMethod_DualFormatModel_MethodGenerated() { // Create a model that supports both JSON and XML var inputModel = InputFactory.Model("DualFormatModel", usage: InputModelTypeUsage.Json | InputModelTypeUsage.Xml); - var (model, serialization) = CreateModelAndSerialization(inputModel); + var (model, serialization) = CreateModelAndSerialization(inputModel, clientPipelineApi: ClientPipelineWithoutModelProxies.Instance); // Verify the ToBinaryContent method is generated var toBinaryContentMethod = serialization.Methods.FirstOrDefault(m => @@ -1544,7 +1545,7 @@ public void TestBuildToBinaryContentMethod_JsonOnlyModel_MethodNotGenerated() { // Create a model that supports only JSON var inputModel = InputFactory.Model("JsonOnlyModel", usage: InputModelTypeUsage.Json); - var (model, serialization) = CreateModelAndSerialization(inputModel); + var (model, serialization) = CreateModelAndSerialization(inputModel, clientPipelineApi: ClientPipelineWithoutModelProxies.Instance); // Verify the ToBinaryContent method is NOT generated var toBinaryContentMethod = serialization.Methods.FirstOrDefault(m => @@ -1552,6 +1553,8 @@ public void TestBuildToBinaryContentMethod_JsonOnlyModel_MethodNotGenerated() m.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Internal)); Assert.IsNull(toBinaryContentMethod, "ToBinaryContent method should not be generated for JSON-only models"); + Assert.IsFalse(serialization.Methods.Any(m => m.Signature.Name == "FromClientResult"), + "FromClientResult should not be generated when the client options don't carry model proxies"); } [Test] @@ -1559,7 +1562,7 @@ public void TestBuildToBinaryContentMethod_XmlOnlyModel_MethodNotGenerated() { // Create a model that supports only XML var inputModel = InputFactory.Model("XmlOnlyModel", usage: InputModelTypeUsage.Xml); - var (model, serialization) = CreateModelAndSerialization(inputModel); + var (model, serialization) = CreateModelAndSerialization(inputModel, clientPipelineApi: ClientPipelineWithoutModelProxies.Instance); // Verify the ToBinaryContent method is NOT generated var toBinaryContentMethod = serialization.Methods.FirstOrDefault(m => @@ -1569,6 +1572,51 @@ public void TestBuildToBinaryContentMethod_XmlOnlyModel_MethodNotGenerated() Assert.IsNull(toBinaryContentMethod, "ToBinaryContent method should not be generated for XML-only models"); } + // Clients convert request bodies and responses with the options built from their configured model proxies, + // which the cast operators can't take. + [TestCase(InputModelTypeUsage.Json)] + [TestCase(InputModelTypeUsage.Xml)] + [TestCase(InputModelTypeUsage.Json | InputModelTypeUsage.Xml)] + public void ModelProxyConversionsTakeClientOptions(InputModelTypeUsage usage) + { + var inputModel = InputFactory.Model("TestModel", usage: usage); + var (_, serialization) = CreateModelAndSerialization(inputModel); + + var conversions = serialization.Methods + .Where(m => m.Signature.Name is "ToBinaryContent" or "FromClientResult") + .ToArray(); + Assert.AreEqual(2, conversions.Length); + Assert.IsTrue(conversions.All(m => m.Signature.Parameters[^1].Type.Equals(typeof(ModelReaderWriterOptions)))); + + using var writer = new CodeWriter(); + foreach (var conversion in conversions) + { + writer.WriteMethod(conversion); + } + Assert.AreEqual(Helpers.GetExpectedFromFile(usage.ToString().Replace(", ", ",")), writer.ToString(false)); + } + + [Test] + public void DerivedModelProxyConversionsHideBaseConversions() + { + var baseModel = InputFactory.Model("BaseModel"); + var derivedModel = InputFactory.Model("DerivedModel", baseModel: baseModel); + var generator = MockHelpers.LoadMockGenerator( + inputModels: () => [baseModel, derivedModel], + createSerializationsCore: (inputType, typeProvider) => + inputType is InputModelType modelType ? [new MrwSerializationTypeDefinition(modelType, (typeProvider as ModelProvider)!)] : []); + generator.Object.TypeFactory.RootInputModels.UnionWith([baseModel, derivedModel]); + generator.Object.TypeFactory.RootOutputModels.UnionWith([baseModel, derivedModel]); + + var derived = ScmCodeModelGenerator.Instance.TypeFactory.CreateModel(derivedModel)!; + var conversions = derived.SerializationProviders.OfType().Single().Methods + .Where(m => m.Signature.Name is "ToBinaryContent" or "FromClientResult") + .ToArray(); + + Assert.AreEqual(2, conversions.Length); + Assert.IsTrue(conversions.All(m => m.Signature.Modifiers.HasFlag(MethodSignatureModifiers.New))); + } + [Test] public void TestDeserializationOfByteArrayPropertyUsesGetBytesFromBase64() { diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DeserializationTests/NestedModelReadsRouteThroughModelProxies.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DeserializationTests/NestedModelReadsRouteThroughModelProxies.cs new file mode 100644 index 00000000000..4ae6a5a48ee --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DeserializationTests/NestedModelReadsRouteThroughModelProxies.cs @@ -0,0 +1,74 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Sample; + +namespace Sample.Models +{ + public partial class TestModel : global::System.ClientModel.Primitives.IJsonModel + { + internal static global::Sample.Models.TestModel DeserializeTestModel(global::System.Text.Json.JsonElement element, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + if ((element.ValueKind == global::System.Text.Json.JsonValueKind.Null)) + { + return null; + } + global::Sample.Models.NestedModel nested = default; + global::System.Collections.Generic.IList nestedList = default; + global::System.Collections.Generic.IDictionary nestedDictionary = default; + string name = default; + global::System.Collections.Generic.IDictionary additionalBinaryDataProperties = new global::Sample.ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("nested"u8)) + { + nested = options.ShouldReadThroughProxy(global::Sample.SampleContext.Default) ? global::System.ClientModel.Primitives.ModelReaderWriter.Read(prop.Value.GetUtf8Bytes(), options, global::Sample.SampleContext.Default) : global::Sample.Models.NestedModel.DeserializeNestedModel(prop.Value, options); + continue; + } + if (prop.NameEquals("nestedList"u8)) + { + if ((prop.Value.ValueKind == global::System.Text.Json.JsonValueKind.Null)) + { + continue; + } + global::System.Collections.Generic.List array = new global::System.Collections.Generic.List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(options.ShouldReadThroughProxy(global::Sample.SampleContext.Default) ? global::System.ClientModel.Primitives.ModelReaderWriter.Read(item.GetUtf8Bytes(), options, global::Sample.SampleContext.Default) : global::Sample.Models.NestedModel.DeserializeNestedModel(item, options)); + } + nestedList = array; + continue; + } + if (prop.NameEquals("nestedDictionary"u8)) + { + if ((prop.Value.ValueKind == global::System.Text.Json.JsonValueKind.Null)) + { + continue; + } + global::System.Collections.Generic.Dictionary dictionary = new global::System.Collections.Generic.Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + dictionary.Add(prop0.Name, options.ShouldReadThroughProxy(global::Sample.SampleContext.Default) ? global::System.ClientModel.Primitives.ModelReaderWriter.Read(prop0.Value.GetUtf8Bytes(), options, global::Sample.SampleContext.Default) : global::Sample.Models.NestedModel.DeserializeNestedModel(prop0.Value, options)); + } + nestedDictionary = dictionary; + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if ((options.Format != "W")) + { + additionalBinaryDataProperties.Add(prop.Name, prop.Value.GetUtf8Bytes()); + } + } + return new global::Sample.Models.TestModel(nested, (nestedList ?? new global::Sample.ChangeTrackingList()), (nestedDictionary ?? new global::Sample.ChangeTrackingDictionary()), name, additionalBinaryDataProperties); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DynamicModelSerializationTests/DeserializeArrayProperties.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DynamicModelSerializationTests/DeserializeArrayProperties.cs index c118bb3622d..b3aa16f1ee0 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DynamicModelSerializationTests/DeserializeArrayProperties.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DynamicModelSerializationTests/DeserializeArrayProperties.cs @@ -36,7 +36,7 @@ public partial class DynamicModel global::System.Collections.Generic.List array = new global::System.Collections.Generic.List(); foreach (var item in prop.Value.EnumerateArray()) { - array.Add(global::Sample.Models.Cat.DeserializeCat(item, options)); + array.Add(options.ShouldReadThroughProxy(global::Sample.SampleContext.Default) ? global::System.ClientModel.Primitives.ModelReaderWriter.Read(item.GetUtf8Bytes(), options, global::Sample.SampleContext.Default) : global::Sample.Models.Cat.DeserializeCat(item, options)); } cats = array; continue; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DynamicModelSerializationTests/DeserializeDictionaryProperties.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DynamicModelSerializationTests/DeserializeDictionaryProperties.cs index 470699a3e54..8009ff19b72 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DynamicModelSerializationTests/DeserializeDictionaryProperties.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DynamicModelSerializationTests/DeserializeDictionaryProperties.cs @@ -36,7 +36,7 @@ public partial class DynamicModel global::System.Collections.Generic.Dictionary dictionary = new global::System.Collections.Generic.Dictionary(); foreach (var prop0 in prop.Value.EnumerateObject()) { - dictionary.Add(prop0.Name, global::Sample.Models.Cat.DeserializeCat(prop0.Value, options)); + dictionary.Add(prop0.Name, options.ShouldReadThroughProxy(global::Sample.SampleContext.Default) ? global::System.ClientModel.Primitives.ModelReaderWriter.Read(prop0.Value.GetUtf8Bytes(), options, global::Sample.SampleContext.Default) : global::Sample.Models.Cat.DeserializeCat(prop0.Value, options)); } cats = dictionary; continue; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DynamicModelSerializationTests/DeserializeModelPropertyType.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DynamicModelSerializationTests/DeserializeModelPropertyType.cs index cb16b0ef8f5..a82c4aa434f 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DynamicModelSerializationTests/DeserializeModelPropertyType.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DynamicModelSerializationTests/DeserializeModelPropertyType.cs @@ -31,7 +31,7 @@ public partial class DynamicModel { continue; } - cat = global::Sample.Models.Cat.DeserializeCat(prop.Value, options); + cat = options.ShouldReadThroughProxy(global::Sample.SampleContext.Default) ? global::System.ClientModel.Primitives.ModelReaderWriter.Read(prop.Value.GetUtf8Bytes(), options, global::Sample.SampleContext.Default) : global::Sample.Models.Cat.DeserializeCat(prop.Value, options); continue; } if (prop.NameEquals("anything"u8)) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DynamicModelSerializationTests/DeserializeModelWithAP.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DynamicModelSerializationTests/DeserializeModelWithAP.cs index 000d8c269ba..af5ba38c354 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DynamicModelSerializationTests/DeserializeModelWithAP.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DynamicModelSerializationTests/DeserializeModelWithAP.cs @@ -32,7 +32,7 @@ public partial class DynamicModel { continue; } - cats = global::Sample.Models.Cat.DeserializeCat(prop.Value, options); + cats = options.ShouldReadThroughProxy(global::Sample.SampleContext.Default) ? global::System.ClientModel.Primitives.ModelReaderWriter.Read(prop.Value.GetUtf8Bytes(), options, global::Sample.SampleContext.Default) : global::Sample.Models.Cat.DeserializeCat(prop.Value, options); continue; } switch (prop.Value.ValueKind) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/MrwSerializationTypeDefinitionTests/ModelProxyConversionsTakeClientOptions(Json).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/MrwSerializationTypeDefinitionTests/ModelProxyConversionsTakeClientOptions(Json).cs new file mode 100644 index 00000000000..6fa27714559 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/MrwSerializationTypeDefinitionTests/ModelProxyConversionsTakeClientOptions(Json).cs @@ -0,0 +1,14 @@ +internal global::System.ClientModel.BinaryContent ToBinaryContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) +{ + return global::System.ClientModel.BinaryContent.Create(this, options); +} +internal static global::Sample.Models.TestModel FromClientResult(global::System.ClientModel.ClientResult result, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) +{ + global::System.ClientModel.Primitives.PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(global::Sample.SampleContext.Default)) + { + return global::System.ClientModel.Primitives.ModelReaderWriter.Read(response.Content, options, global::Sample.SampleContext.Default); + } + using global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(response.Content, global::Sample.ModelSerializationExtensions.JsonDocumentOptions); + return global::Sample.Models.TestModel.DeserializeTestModel(document.RootElement, options); +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/MrwSerializationTypeDefinitionTests/ModelProxyConversionsTakeClientOptions(Json,Xml).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/MrwSerializationTypeDefinitionTests/ModelProxyConversionsTakeClientOptions(Json,Xml).cs new file mode 100644 index 00000000000..1036495ee0e --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/MrwSerializationTypeDefinitionTests/ModelProxyConversionsTakeClientOptions(Json,Xml).cs @@ -0,0 +1,30 @@ +internal global::System.ClientModel.BinaryContent ToBinaryContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) +{ + return global::System.ClientModel.BinaryContent.Create(this, options); +} +internal static global::Sample.Models.TestModel FromClientResult(global::System.ClientModel.ClientResult result, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) +{ + global::System.ClientModel.Primitives.PipelineResponse response = result.GetRawResponse(); + + if ((response.Headers.TryGetValue("Content-Type", out string value) && value.StartsWith("application/json", global::System.StringComparison.OrdinalIgnoreCase))) + { + if (options.ShouldReadThroughProxy(global::Sample.SampleContext.Default)) + { + return global::System.ClientModel.Primitives.ModelReaderWriter.Read(response.Content, options, global::Sample.SampleContext.Default); + } + using global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(response.Content, global::Sample.ModelSerializationExtensions.JsonDocumentOptions); + return global::Sample.Models.TestModel.DeserializeTestModel(document.RootElement, options); + } + + if (options.ShouldReadThroughProxy(global::Sample.SampleContext.Default)) + { + return global::System.ClientModel.Primitives.ModelReaderWriter.Read(response.Content, options.ToXmlOptions(), global::Sample.SampleContext.Default); + } + using global::System.IO.Stream stream = response.ContentStream; + if ((stream == null)) + { + return default; + } + + return global::Sample.Models.TestModel.DeserializeTestModel(global::System.Xml.Linq.XElement.Load(stream, global::System.Xml.Linq.LoadOptions.PreserveWhitespace), options); +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/MrwSerializationTypeDefinitionTests/ModelProxyConversionsTakeClientOptions(Xml).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/MrwSerializationTypeDefinitionTests/ModelProxyConversionsTakeClientOptions(Xml).cs new file mode 100644 index 00000000000..d3531f5d42f --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/MrwSerializationTypeDefinitionTests/ModelProxyConversionsTakeClientOptions(Xml).cs @@ -0,0 +1,19 @@ +internal global::System.ClientModel.BinaryContent ToBinaryContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) +{ + return global::System.ClientModel.BinaryContent.Create(this, options); +} +internal static global::Sample.Models.TestModel FromClientResult(global::System.ClientModel.ClientResult result, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) +{ + global::System.ClientModel.Primitives.PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(global::Sample.SampleContext.Default)) + { + return global::System.ClientModel.Primitives.ModelReaderWriter.Read(response.Content, options, global::Sample.SampleContext.Default); + } + using global::System.IO.Stream stream = response.ContentStream; + if ((stream == null)) + { + return default; + } + + return global::Sample.Models.TestModel.DeserializeTestModel(global::System.Xml.Linq.XElement.Load(stream, global::System.Xml.Linq.LoadOptions.PreserveWhitespace), options); +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodHandlesNestedModel.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodHandlesNestedModel.cs index 87fcc6f34f5..b243a6a489a 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodHandlesNestedModel.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodHandlesNestedModel.cs @@ -6,6 +6,7 @@ using System.ClientModel.Primitives; using System.IO; using System.Xml.Linq; +using Sample; namespace Sample.Models { @@ -40,7 +41,7 @@ public partial class OuterModel : global::System.ClientModel.Primitives.IPersist string localName = child.Name.LocalName; if ((localName == "inner")) { - inner = global::Sample.Models.InnerModel.DeserializeInnerModel(child, options); + inner = options.ShouldReadThroughProxy(global::Sample.SampleContext.Default) ? global::System.ClientModel.Primitives.ModelReaderWriter.Read(child.GetUtf8Bytes(), options, global::Sample.SampleContext.Default) : global::Sample.Models.InnerModel.DeserializeInnerModel(child, options); continue; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodReadsDualFormatNestedModelWithXmlOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodReadsDualFormatNestedModelWithXmlOptions.cs new file mode 100644 index 00000000000..f5928d857cf --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodReadsDualFormatNestedModelWithXmlOptions.cs @@ -0,0 +1,51 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.IO; +using System.Xml.Linq; +using Sample; + +namespace Sample.Models +{ + public partial class OuterModel : global::System.ClientModel.Primitives.IPersistableModel + { + protected virtual global::Sample.Models.OuterModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "X": + using (global::System.IO.Stream dataStream = data.ToStream()) + { + return global::Sample.Models.OuterModel.DeserializeOuterModel(global::System.Xml.Linq.XElement.Load(dataStream, global::System.Xml.Linq.LoadOptions.PreserveWhitespace), options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.OuterModel)} does not support reading '{options.Format}' format."); + } + } + + internal static global::Sample.Models.OuterModel DeserializeOuterModel(global::System.Xml.Linq.XElement element, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + if ((element == null)) + { + return null; + } + + global::Sample.Models.InnerModel inner = default; + + foreach (var child in element.Elements()) + { + string localName = child.Name.LocalName; + if ((localName == "inner")) + { + inner = options.ShouldReadThroughProxy(global::Sample.SampleContext.Default) ? global::System.ClientModel.Primitives.ModelReaderWriter.Read(child.GetUtf8Bytes(), options.ToXmlOptions(), global::Sample.SampleContext.Default) : global::Sample.Models.InnerModel.DeserializeInnerModel(child, options); + continue; + } + } + return new global::Sample.Models.OuterModel(inner); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/XmlDeserializationTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/XmlDeserializationTests.cs index c742a43bff8..2bf6cdbbf53 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/XmlDeserializationTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/XmlDeserializationTests.cs @@ -142,6 +142,34 @@ public async Task XmlDeserializationMethodHandlesNestedModel() Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); } + // A nested model that also supports JSON reports "J" for the wire format, so an XML-only parent reads it through + // ModelReaderWriter with XML options that keep the registered proxies, regardless of whether it was read with "W" or "X". + [Test] + public void XmlDeserializationMethodReadsDualFormatNestedModelWithXmlOptions() + { + var innerModel = InputFactory.Model( + "InnerModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml | InputModelTypeUsage.Json, + properties: [InputFactory.Property("value", InputPrimitiveType.String, serializationOptions: InputFactory.Serialization.Options(xml: InputFactory.Serialization.Xml("value")))]); + var outerModel = InputFactory.Model( + "OuterModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: [InputFactory.Property("inner", innerModel, serializationOptions: InputFactory.Serialization.Options(xml: InputFactory.Serialization.Xml("inner")))]); + var mockGenerator = MockHelpers.LoadMockGenerator( + inputModels: () => [innerModel, outerModel], + createSerializationsCore: (inputType, typeProvider) + => inputType is InputModelType modeltype + ? [new MockMrwProvider(modeltype, (typeProvider as ModelProvider)!)] + : []); + + var modelProvider = mockGenerator.Object.OutputLibrary.TypeProviders.Single(t => t is ModelProvider && t.Name == "OuterModel"); + var serializationProvider = modelProvider.SerializationProviders.Single(t => t is MrwSerializationTypeDefinition); + + var writer = new TypeProviderWriter(serializationProvider); + var file = writer.Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } + [Test] public async Task XmlDeserializationMethodHandlesUnwrappedListProperty() { diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/MultipartFormDataSerializationDefinitionTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/MultipartFormDataSerializationDefinitionTests.cs index 07b97c03e2d..8afa7ec5a60 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/MultipartFormDataSerializationDefinitionTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/MultipartFormDataSerializationDefinitionTests.cs @@ -148,6 +148,25 @@ public void TestSerialization_NestedJsonModelPart() Assert.AreEqual(Helpers.GetExpectedFromFile(), actual); } + // Pipelines whose client options don't carry model proxies keep writing model parts with the wire options. + [Test] + public void TestSerialization_WithoutModelProxies_UsesWireOptions() + { + var addressModel = InputFactory.Model("address", properties: [InputFactory.Property("city", InputPrimitiveType.String)]); + var inputModel = MultipartModel( + "JsonPartRequest", + [ + NonFilePartProperty("address", addressModel, defaultContentTypes: ["application/json"]), + NonFilePartProperty("addresses", InputFactory.Array(addressModel), defaultContentTypes: ["application/json"]) + ]); + MockHelpers.LoadMockGenerator(inputModels: () => [inputModel], clientPipelineApi: ClientPipelineWithoutModelProxies.Instance); + var model = (ScmModel)ScmCodeModelGenerator.Instance.TypeFactory.CreateModel(inputModel)!; + + var actual = new TypeProviderWriter(new MultipartFormDataSerializationDefinition(inputModel, model)).Write().Content; + + Assert.AreEqual(Helpers.GetExpectedFromFile(), actual); + } + [Test] public void TestSerialization_AllPrimitiveParts() { diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_AllPrimitiveParts.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_AllPrimitiveParts.cs index 3b7c47a6f02..735848f0caf 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_AllPrimitiveParts.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_AllPrimitiveParts.cs @@ -3,6 +3,7 @@ #nullable disable using System.ClientModel; +using System.ClientModel.Primitives; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. namespace Sample.Models @@ -13,7 +14,7 @@ internal AllPrimitivesContent() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_AllShapesCombined.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_AllShapesCombined.cs index 9d1a1fb4ae9..4c30efc64f5 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_AllShapesCombined.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_AllShapesCombined.cs @@ -3,6 +3,7 @@ #nullable disable using System.ClientModel; +using System.ClientModel.Primitives; using Sample; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. @@ -14,12 +15,12 @@ internal ComplexPartsContent() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); content.Add("id", Id); - content.Add("address", Address, global::Sample.SampleContext.Default, global::Sample.ModelSerializationExtensions.WireOptions, "application/json"); + content.Add("address", Address, global::Sample.SampleContext.Default, options, "application/json"); content.Add("profileImage", ProfileImage); foreach (global::System.ClientModel.FileBinaryContent item in Pictures) { diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_BinaryDataPart(WithDefaultContentType).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_BinaryDataPart(WithDefaultContentType).cs index 347cc0a822f..9f4390f9435 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_BinaryDataPart(WithDefaultContentType).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_BinaryDataPart(WithDefaultContentType).cs @@ -3,6 +3,7 @@ #nullable disable using System.ClientModel; +using System.ClientModel.Primitives; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. namespace Sample.Models @@ -13,7 +14,7 @@ internal BinaryDataContent() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_BinaryDataPart(WithoutDefaultContentType).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_BinaryDataPart(WithoutDefaultContentType).cs index c8235905efd..9454310ae05 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_BinaryDataPart(WithoutDefaultContentType).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_BinaryDataPart(WithoutDefaultContentType).cs @@ -3,6 +3,7 @@ #nullable disable using System.ClientModel; +using System.ClientModel.Primitives; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. namespace Sample.Models @@ -13,7 +14,7 @@ internal BinaryDataContent() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_CustomizedFileToBinaryData_WrapsInFileBinaryContent.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_CustomizedFileToBinaryData_WrapsInFileBinaryContent.cs index 07bf248bd75..a70feda2575 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_CustomizedFileToBinaryData_WrapsInFileBinaryContent.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_CustomizedFileToBinaryData_WrapsInFileBinaryContent.cs @@ -3,6 +3,7 @@ #nullable disable using System.ClientModel; +using System.ClientModel.Primitives; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. namespace Sample.Models @@ -13,7 +14,7 @@ internal CustomizedFileRequest() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_CustomizedFileToStream_WrapsInFileBinaryContent.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_CustomizedFileToStream_WrapsInFileBinaryContent.cs index 07bf248bd75..a70feda2575 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_CustomizedFileToStream_WrapsInFileBinaryContent.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_CustomizedFileToStream_WrapsInFileBinaryContent.cs @@ -3,6 +3,7 @@ #nullable disable using System.ClientModel; +using System.ClientModel.Primitives; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. namespace Sample.Models @@ -13,7 +14,7 @@ internal CustomizedFileRequest() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_CustomizedNonFileToStream_WrapsInBinaryData.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_CustomizedNonFileToStream_WrapsInBinaryData.cs index 5411d9375f7..c2fb578c6ec 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_CustomizedNonFileToStream_WrapsInBinaryData.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_CustomizedNonFileToStream_WrapsInBinaryData.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel; +using System.ClientModel.Primitives; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. namespace Sample.Models @@ -14,7 +15,7 @@ internal CustomizedBytesRequest() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_CustomizedOptionalListUsesNullCheck.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_CustomizedOptionalListUsesNullCheck.cs index f97e74db664..345dac09d89 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_CustomizedOptionalListUsesNullCheck.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_CustomizedOptionalListUsesNullCheck.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel; +using System.ClientModel.Primitives; using Sample; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. @@ -11,7 +12,7 @@ namespace Sample.Models { public partial class ConcreteListRequest { - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_IntExtensibleEnumPart_UsesUnderlyingValue.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_IntExtensibleEnumPart_UsesUnderlyingValue.cs index 9a7e157518e..2d319722dba 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_IntExtensibleEnumPart_UsesUnderlyingValue.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_IntExtensibleEnumPart_UsesUnderlyingValue.cs @@ -3,6 +3,7 @@ #nullable disable using System.ClientModel; +using System.ClientModel.Primitives; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. namespace Sample.Models @@ -13,7 +14,7 @@ internal IntExtensibleEnumContent() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_IntFixedEnumPart_UsesUnderlyingValue.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_IntFixedEnumPart_UsesUnderlyingValue.cs index b56db41f479..034d74a2b0d 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_IntFixedEnumPart_UsesUnderlyingValue.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_IntFixedEnumPart_UsesUnderlyingValue.cs @@ -3,6 +3,7 @@ #nullable disable using System.ClientModel; +using System.ClientModel.Primitives; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. namespace Sample.Models @@ -13,7 +14,7 @@ internal IntFixedEnumContent() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_MixedJsonAndMultipartUsage.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_MixedJsonAndMultipartUsage.cs index 19ce25747f1..0f6f7a6094b 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_MixedJsonAndMultipartUsage.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_MixedJsonAndMultipartUsage.cs @@ -3,13 +3,14 @@ #nullable disable using System.ClientModel; +using System.ClientModel.Primitives; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. namespace Sample.Models { public partial class MixedUsageContent { - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_ModelArrayPart_AsSingleJsonPart.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_ModelArrayPart_AsSingleJsonPart.cs index 325757f20e1..c4a75503393 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_ModelArrayPart_AsSingleJsonPart.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_ModelArrayPart_AsSingleJsonPart.cs @@ -17,11 +17,11 @@ internal ModelArrayContent() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); - global::System.BinaryData addressesData = global::System.ClientModel.Primitives.ModelReaderWriter.Write(((global::System.Collections.Generic.IList)Addresses), global::Sample.ModelSerializationExtensions.WireOptions, global::Sample.SampleContext.Default).WithMediaType("application/json"); + global::System.BinaryData addressesData = global::System.ClientModel.Primitives.ModelReaderWriter.Write(((global::System.Collections.Generic.IList)Addresses), options, global::Sample.SampleContext.Default).WithMediaType("application/json"); content.Add("addresses", addressesData); return content; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_ModelArrayPart_EmitsPartPerElement.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_ModelArrayPart_EmitsPartPerElement.cs index f6cf7b24fda..7e99502562c 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_ModelArrayPart_EmitsPartPerElement.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_ModelArrayPart_EmitsPartPerElement.cs @@ -3,6 +3,7 @@ #nullable disable using System.ClientModel; +using System.ClientModel.Primitives; using Sample; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. @@ -14,13 +15,13 @@ internal ModelArrayMultiContent() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); foreach (global::Sample.Models.Address item in Addresses) { - content.Add("addresses", item, global::Sample.SampleContext.Default, global::Sample.ModelSerializationExtensions.WireOptions, "application/json"); + content.Add("addresses", item, global::Sample.SampleContext.Default, options, "application/json"); } return content; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_ModelDictionaryPart_UsesModelReaderWriter.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_ModelDictionaryPart_UsesModelReaderWriter.cs index 3f264bdae7c..161e22d72f9 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_ModelDictionaryPart_UsesModelReaderWriter.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_ModelDictionaryPart_UsesModelReaderWriter.cs @@ -17,11 +17,11 @@ internal ModelDictionaryContent() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); - global::System.BinaryData addressesByNameData = global::System.ClientModel.Primitives.ModelReaderWriter.Write(((global::System.Collections.Generic.IDictionary)AddressesByName), global::Sample.ModelSerializationExtensions.WireOptions, global::Sample.SampleContext.Default).WithMediaType("application/json"); + global::System.BinaryData addressesByNameData = global::System.ClientModel.Primitives.ModelReaderWriter.Write(((global::System.Collections.Generic.IDictionary)AddressesByName), options, global::Sample.SampleContext.Default).WithMediaType("application/json"); content.Add("addressesByName", addressesByNameData); return content; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_MultiFilePart.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_MultiFilePart.cs index b3f6a63f42a..6bd4375642d 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_MultiFilePart.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_MultiFilePart.cs @@ -3,6 +3,7 @@ #nullable disable using System.ClientModel; +using System.ClientModel.Primitives; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. namespace Sample.Models @@ -13,7 +14,7 @@ internal BinaryArrayPartsContent() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_MultiFilePartWithContentType_OmitsMediaType.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_MultiFilePartWithContentType_OmitsMediaType.cs index 68e2e44bdc5..7bed1e301c1 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_MultiFilePartWithContentType_OmitsMediaType.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_MultiFilePartWithContentType_OmitsMediaType.cs @@ -3,6 +3,7 @@ #nullable disable using System.ClientModel; +using System.ClientModel.Primitives; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. namespace Sample.Models @@ -13,7 +14,7 @@ internal FileArrayWithContentTypeContent() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_NestedJsonModelPart.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_NestedJsonModelPart.cs index 1139d4b16d1..504c1399a8f 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_NestedJsonModelPart.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_NestedJsonModelPart.cs @@ -3,6 +3,7 @@ #nullable disable using System.ClientModel; +using System.ClientModel.Primitives; using Sample; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. @@ -14,11 +15,11 @@ internal JsonPartContent() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); - content.Add("address", Address, global::Sample.SampleContext.Default, global::Sample.ModelSerializationExtensions.WireOptions, "application/json"); + content.Add("address", Address, global::Sample.SampleContext.Default, options, "application/json"); return content; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_NullableValueTypePart_UnwrapsValue.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_NullableValueTypePart_UnwrapsValue.cs index c628ebe4c7f..035b5e41848 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_NullableValueTypePart_UnwrapsValue.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_NullableValueTypePart_UnwrapsValue.cs @@ -3,6 +3,7 @@ #nullable disable using System.ClientModel; +using System.ClientModel.Primitives; using Sample; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. @@ -10,7 +11,7 @@ namespace Sample.Models { public partial class NullableValuePartContent { - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_OptionalFile.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_OptionalFile.cs index 2b301d9938a..d39ebca2d1c 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_OptionalFile.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_OptionalFile.cs @@ -3,6 +3,7 @@ #nullable disable using System.ClientModel; +using System.ClientModel.Primitives; using Sample; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. @@ -14,7 +15,7 @@ internal OptionalFileContent() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_PrimitiveArrayPart_AsSingleJsonPart.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_PrimitiveArrayPart_AsSingleJsonPart.cs index 42f00afd237..8c9186155d2 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_PrimitiveArrayPart_AsSingleJsonPart.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_PrimitiveArrayPart_AsSingleJsonPart.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel; +using System.ClientModel.Primitives; using Sample; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. @@ -15,7 +16,7 @@ internal PrimitiveArrayJsonContent() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_PrimitiveArrayPart_EmitsPartPerElement.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_PrimitiveArrayPart_EmitsPartPerElement.cs index 2b9bffdcb48..e4419c134b1 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_PrimitiveArrayPart_EmitsPartPerElement.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_PrimitiveArrayPart_EmitsPartPerElement.cs @@ -3,6 +3,7 @@ #nullable disable using System.ClientModel; +using System.ClientModel.Primitives; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. namespace Sample.Models @@ -13,7 +14,7 @@ internal PrimitiveArrayContent() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_PrimitiveDictionaryPart_UsesMultipartFormDataHelper.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_PrimitiveDictionaryPart_UsesMultipartFormDataHelper.cs index 4179ef69760..c89d68bdcdf 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_PrimitiveDictionaryPart_UsesMultipartFormDataHelper.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_PrimitiveDictionaryPart_UsesMultipartFormDataHelper.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel; +using System.ClientModel.Primitives; using Sample; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. @@ -15,7 +16,7 @@ internal PrimitiveDictionaryContent() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_PrimitiveWithExplicitContentType_EmitsMediaType.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_PrimitiveWithExplicitContentType_EmitsMediaType.cs index ec7c579e905..c0925047650 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_PrimitiveWithExplicitContentType_EmitsMediaType.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_PrimitiveWithExplicitContentType_EmitsMediaType.cs @@ -3,6 +3,7 @@ #nullable disable using System.ClientModel; +using System.ClientModel.Primitives; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. namespace Sample.Models @@ -13,7 +14,7 @@ internal ExplicitContentTypeContent() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_SingleRequiredFile.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_SingleRequiredFile.cs index cdc1d480821..fa3c22dd879 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_SingleRequiredFile.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_SingleRequiredFile.cs @@ -3,6 +3,7 @@ #nullable disable using System.ClientModel; +using System.ClientModel.Primitives; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. namespace Sample.Models @@ -13,7 +14,7 @@ internal FileContent() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_StringExtensibleEnumPart_UsesUnderlyingValue.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_StringExtensibleEnumPart_UsesUnderlyingValue.cs index d70e688456a..095c0d80f56 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_StringExtensibleEnumPart_UsesUnderlyingValue.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_StringExtensibleEnumPart_UsesUnderlyingValue.cs @@ -3,6 +3,7 @@ #nullable disable using System.ClientModel; +using System.ClientModel.Primitives; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. namespace Sample.Models @@ -13,7 +14,7 @@ internal StringExtensibleEnumContent() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_StringFixedEnumPart_UsesUnderlyingValue.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_StringFixedEnumPart_UsesUnderlyingValue.cs index 0f47ca66539..f9fa44f0904 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_StringFixedEnumPart_UsesUnderlyingValue.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_StringFixedEnumPart_UsesUnderlyingValue.cs @@ -3,6 +3,7 @@ #nullable disable using System.ClientModel; +using System.ClientModel.Primitives; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. namespace Sample.Models @@ -13,7 +14,7 @@ internal StringFixedEnumContent() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_StringWithDefaultContentType.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_StringWithDefaultContentType.cs index e8069884e92..6d4c4d4d4ae 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_StringWithDefaultContentType.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_StringWithDefaultContentType.cs @@ -3,6 +3,7 @@ #nullable disable using System.ClientModel; +using System.ClientModel.Primitives; #pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. namespace Sample.Models @@ -13,7 +14,7 @@ internal TextContent() { } - internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_WithoutModelProxies_UsesWireOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_WithoutModelProxies_UsesWireOptions.cs new file mode 100644 index 00000000000..cd8785d8a28 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MultipartFormDataSerializationDefinitions/TestData/MultipartFormDataSerializationDefinitionTests/TestSerialization_WithoutModelProxies_UsesWireOptions.cs @@ -0,0 +1,32 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using Sample; + +#pragma warning disable SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. +namespace Sample.Models +{ + public partial class JsonPartContent + { + internal JsonPartContent() + { + } + + internal global::System.ClientModel.MultiPartFormContent ToMultipartFormContent() + { + global::System.ClientModel.MultiPartFormContent content = new global::System.ClientModel.MultiPartFormContent(); + + content.Add("address", Address, global::Sample.SampleContext.Default, global::Sample.ModelSerializationExtensions.WireOptions, "application/json"); + global::System.BinaryData addressesData = global::System.ClientModel.Primitives.ModelReaderWriter.Write(((global::System.Collections.Generic.IList)Addresses), global::Sample.ModelSerializationExtensions.WireOptions, global::Sample.SampleContext.Default).WithMediaType("application/json"); + content.Add("addresses", addressesData); + + return content; + } + } +} +#pragma warning restore SCME0004 // Type is for evaluation purposes only and is subject to change or removal in future updates. diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ScmMethodProviderCollectionTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ScmMethodProviderCollectionTests.cs index 8113d863b33..e3364d5dab0 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ScmMethodProviderCollectionTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ScmMethodProviderCollectionTests.cs @@ -1736,10 +1736,16 @@ public void PagingAndStreamingArgumentsFollowCreateRequestSignature( construction.Type.ToString().Contains("CollectionResult", StringComparison.Ordinal)).ArgumentList!.Arguments; CollectionAssert.AreEqual( new[] { omitPathParameter ? "null" : "targetDBName", "sourceIPAddress", "cancellationToken.ToRequestOptions()" }, - arguments.Skip(isStreaming ? 0 : 1).Select(argument => argument.Expression.ToString())); + arguments.Skip(isStreaming ? 0 : 2).Select(argument => argument.Expression.ToString())); CollectionAssert.AreEqual( omitPathParameter ? new[] { "targetDBName", "sourceIPAddress", "options" } : new string?[] { null, null, null }, - arguments.Skip(isStreaming ? 0 : 1).Select(argument => argument.NameColon?.Name.Identifier.ValueText)); + arguments.Skip(isStreaming ? 0 : 2).Select(argument => argument.NameColon?.Name.Identifier.ValueText)); + if (!isStreaming) + { + CollectionAssert.AreEqual( + new[] { "this", "_modelReaderWriterOptions" }, + arguments.Take(2).Select(argument => argument.Expression.ToString())); + } } } @@ -2630,12 +2636,12 @@ public void RequestBodyConstructedUsingBinaryContentHelpers(InputType inputType) if (inputType is InputArrayType) { Assert.IsTrue(convenienceMethod!.BodyStatements!.ToDisplayString() - .Contains("using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(message);")); + .Contains("using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(message, _modelReaderWriterOptions);")); } else if (inputType is InputDictionaryType) { Assert.IsTrue(convenienceMethod!.BodyStatements!.ToDisplayString() - .Contains("using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromDictionary(message);")); + .Contains("using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromDictionary(message, _modelReaderWriterOptions);")); } else { @@ -2672,7 +2678,7 @@ public void RequestBodyConstructedUsingReadOnlyMemoryBinaryContentHelpers() Assert.IsNotNull(convenienceMethod); Assert.IsTrue(convenienceMethod!.BodyStatements!.ToDisplayString() - .Contains("using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(data.Span);")); + .Contains("using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(data.Span, _modelReaderWriterOptions);")); } [Test] @@ -2742,12 +2748,12 @@ public void RequestBodyConstructedRespectingRequestContentApi(InputType inputTyp if (inputType is InputArrayType) { Assert.IsTrue(convenienceMethod!.BodyStatements!.ToDisplayString() - .Contains("using global::Microsoft.TypeSpec.Generator.ClientModel.Tests.TestRequestContent content = global::Sample.BinaryContentHelper.FromEnumerable(message);")); + .Contains("using global::Microsoft.TypeSpec.Generator.ClientModel.Tests.TestRequestContent content = global::Sample.BinaryContentHelper.FromEnumerable(message, _modelReaderWriterOptions);")); } else if (inputType is InputDictionaryType) { Assert.IsTrue(convenienceMethod!.BodyStatements!.ToDisplayString() - .Contains("using global::Microsoft.TypeSpec.Generator.ClientModel.Tests.TestRequestContent content = global::Sample.BinaryContentHelper.FromDictionary(message);")); + .Contains("using global::Microsoft.TypeSpec.Generator.ClientModel.Tests.TestRequestContent content = global::Sample.BinaryContentHelper.FromDictionary(message, _modelReaderWriterOptions);")); } else { @@ -4594,7 +4600,7 @@ public void ConvenienceMethod_DualFormatModel_XmlContentType_CallsToBinaryConten var serviceMethod = InputFactory.BasicServiceMethod("UpdateModel", operation, parameters: [methodBodyParam]); var inputClient = InputFactory.Client("TestClient", methods: [serviceMethod]); - MockHelpers.LoadMockGenerator(clients: () => [inputClient], inputModels: () => [dualFormatModel]); + MockHelpers.LoadMockGenerator(clients: () => [inputClient], inputModels: () => [dualFormatModel], clientPipelineApi: ClientPipelineWithoutModelProxies.Instance); var client = ScmCodeModelGenerator.Instance.TypeFactory.CreateClient(inputClient); var methodCollection = new ScmMethodProviderCollection(serviceMethod, client!); @@ -4627,7 +4633,7 @@ public void ConvenienceMethod_DualFormatModel_JsonContentType_CallsToBinaryConte var serviceMethod = InputFactory.BasicServiceMethod("UpdateModel", operation, parameters: [methodBodyParam]); var inputClient = InputFactory.Client("TestClient", methods: [serviceMethod]); - MockHelpers.LoadMockGenerator(clients: () => [inputClient], inputModels: () => [dualFormatModel]); + MockHelpers.LoadMockGenerator(clients: () => [inputClient], inputModels: () => [dualFormatModel], clientPipelineApi: ClientPipelineWithoutModelProxies.Instance); var client = ScmCodeModelGenerator.Instance.TypeFactory.CreateClient(inputClient); var methodCollection = new ScmMethodProviderCollection(serviceMethod, client!); @@ -4660,7 +4666,7 @@ public void ConvenienceMethod_SingleFormatModel_UsesImplicitOperator() var serviceMethod = InputFactory.BasicServiceMethod("UpdateModel", operation, parameters: [methodBodyParam]); var inputClient = InputFactory.Client("TestClient", methods: [serviceMethod]); - MockHelpers.LoadMockGenerator(clients: () => [inputClient], inputModels: () => [jsonOnlyModel]); + MockHelpers.LoadMockGenerator(clients: () => [inputClient], inputModels: () => [jsonOnlyModel], clientPipelineApi: ClientPipelineWithoutModelProxies.Instance); var client = ScmCodeModelGenerator.Instance.TypeFactory.CreateClient(inputClient); var methodCollection = new ScmMethodProviderCollection(serviceMethod, client!); @@ -4676,6 +4682,79 @@ public void ConvenienceMethod_SingleFormatModel_UsesImplicitOperator() Assert.AreEqual(expectedMethodBody, methodBody); } + // With model proxies on the client options, convenience methods convert request bodies and responses with the + // client's options because the cast operators can't take them. + [TestCase(InputModelTypeUsage.Json, "application/json")] + [TestCase(InputModelTypeUsage.Json | InputModelTypeUsage.Xml, "application/json")] + [TestCase(InputModelTypeUsage.Json | InputModelTypeUsage.Xml, "application/xml")] + [TestCase(InputModelTypeUsage.Xml, "application/xml")] + public void ConvenienceMethod_ModelProxies_ConvertsWithClientOptions(InputModelTypeUsage format, string contentType) + { + var model = InputFactory.Model("TestModel", usage: InputModelTypeUsage.Input | InputModelTypeUsage.Output | format); + var bodyParam = InputFactory.BodyParameter("body", model, isRequired: true); + var methodBodyParam = InputFactory.MethodParameter("body", model, isRequired: true, location: InputRequestLocation.Body); + + var operation = InputFactory.Operation( + "UpdateModel", + parameters: [bodyParam], + requestMediaTypes: [contentType], + responses: [InputFactory.OperationResponse([200], bodytype: model, contentTypes: [contentType])]); + + var serviceMethod = InputFactory.BasicServiceMethod( + "UpdateModel", + operation, + parameters: [methodBodyParam], + response: InputFactory.ServiceMethodResponse(model, null)); + var inputClient = InputFactory.Client("TestClient", methods: [serviceMethod]); + + MockHelpers.LoadMockGenerator(clients: () => [inputClient], inputModels: () => [model]); + + var client = ScmCodeModelGenerator.Instance.TypeFactory.CreateClient(inputClient); + var methodCollection = new ScmMethodProviderCollection(serviceMethod, client!); + + var convenienceMethod = methodCollection.FirstOrDefault(m => + m.Signature.Parameters.All(p => p.Name != "options") && + m.Signature.Name == "UpdateModel"); + + Assert.IsNotNull(convenienceMethod); + var methodBody = convenienceMethod!.BodyStatements!.ToDisplayString(); + var parameters = $"{format.ToString().Replace(", ", ",")},{contentType.Substring("application/".Length)}"; + Assert.AreEqual(Helpers.GetExpectedFromFile(parameters), methodBody); + } + + // Collection bodies written by BinaryContentHelper pass the client's options so its proxies apply to model items. + // BinaryData items are written by their own overloads, which don't take options. + [TestCase("ModelList")] + [TestCase("ModelDictionary")] + [TestCase("BinaryDataList")] + public void ConvenienceMethod_ModelProxies_PassClientOptionsToBinaryContentHelper(string bodyKind) + { + var item = InputFactory.Model("Item", usage: InputModelTypeUsage.Input | InputModelTypeUsage.Json); + InputType bodyType = bodyKind switch + { + "ModelList" => InputFactory.Array(item), + "ModelDictionary" => InputFactory.Dictionary(item), + _ => InputFactory.Array(InputPrimitiveType.Any) + }; + var operation = InputFactory.Operation( + "Upload", + parameters: [InputFactory.BodyParameter("body", bodyType, isRequired: true)], + requestMediaTypes: ["application/json"], + responses: [InputFactory.OperationResponse([204])]); + var serviceMethod = InputFactory.BasicServiceMethod( + "Upload", + operation, + parameters: [InputFactory.MethodParameter("body", bodyType, isRequired: true, location: InputRequestLocation.Body)]); + var inputClient = InputFactory.Client("TestClient", methods: [serviceMethod]); + MockHelpers.LoadMockGenerator(clients: () => [inputClient], inputModels: () => [item]); + + var client = ScmCodeModelGenerator.Instance.TypeFactory.CreateClient(inputClient); + var convenienceMethod = new ScmMethodProviderCollection(serviceMethod, client!).Single(m => + m.Signature.Parameters.All(p => p.Name != "options") && m.Signature.Name == "Upload"); + + Assert.AreEqual(Helpers.GetExpectedFromFile(bodyKind), convenienceMethod.BodyStatements!.ToDisplayString()); + } + [Test] public void ConvenienceMethod_XmlListBody_UsesXmlFromEnumerable() { @@ -4817,7 +4896,7 @@ public void ConvenienceMethod_JsonListBody_DoesNotUseXmlFromEnumerable() var methodBody = convenienceMethod!.BodyStatements!.ToDisplayString(); // Ensure the method body uses the standard JSON FromEnumerable (no rootNameHint/childNameHint) - Assert.IsTrue(methodBody.Contains("BinaryContentHelper.FromEnumerable(body)")); + Assert.IsTrue(methodBody.Contains("BinaryContentHelper.FromEnumerable(body, _modelReaderWriterOptions)")); Assert.IsFalse(methodBody.Contains("rootNameHint")); Assert.IsFalse(methodBody.Contains("childNameHint")); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientSettingsProviderTests/TestSettingsConstructor_WithStringEndpoint.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientSettingsProviderTests/TestSettingsConstructor_WithStringEndpoint.cs index b34c34bc1fa..4ab54d222b4 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientSettingsProviderTests/TestSettingsConstructor_WithStringEndpoint.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientSettingsProviderTests/TestSettingsConstructor_WithStringEndpoint.cs @@ -11,6 +11,7 @@ namespace Sample public partial class TestClient { private readonly global::System.Uri _endpoint; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions = global::Sample.ModelSerializationExtensions.WireOptions; protected TestClient() { @@ -33,6 +34,7 @@ internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy a { Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly) }, Array.Empty()); } + _modelReaderWriterOptions = options.ModelProxies.ToWireOptions(); } public TestClient(string endpoint = default, global::Sample.TestClientOptions options) : this(null, endpoint, options) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientSettingsProviderTests/TestSettingsConstructor_WithUrlEndpoint.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientSettingsProviderTests/TestSettingsConstructor_WithUrlEndpoint.cs index ad76eb92090..acbdcefda30 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientSettingsProviderTests/TestSettingsConstructor_WithUrlEndpoint.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientSettingsProviderTests/TestSettingsConstructor_WithUrlEndpoint.cs @@ -11,6 +11,7 @@ namespace Sample public partial class TestClient { private readonly global::System.Uri _endpoint; + private readonly global::System.ClientModel.Primitives.ModelReaderWriterOptions _modelReaderWriterOptions = global::Sample.ModelSerializationExtensions.WireOptions; protected TestClient() { @@ -35,6 +36,7 @@ internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy a { Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly) }, Array.Empty()); } + _modelReaderWriterOptions = options.ModelProxies.ToWireOptions(); } public TestClient(global::System.Uri endpoint, global::Sample.TestClientOptions options) : this(null, endpoint, options) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/DiscriminatedUnionSerializationTests/WritesContextualEnvelopeSerialization(kind,value).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/DiscriminatedUnionSerializationTests/WritesContextualEnvelopeSerialization(kind,value).cs index d241aff9edb..f860a34ec88 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/DiscriminatedUnionSerializationTests/WritesContextualEnvelopeSerialization(kind,value).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/DiscriminatedUnionSerializationTests/WritesContextualEnvelopeSerialization(kind,value).cs @@ -5,6 +5,7 @@ using System; using System.ClientModel.Primitives; using System.Text.Json; +using Sample; namespace Sample.Models { @@ -53,9 +54,9 @@ internal static void SerializePetsUnion(global::System.Text.Json.Utf8JsonWriter switch (discriminator.GetString()) { case "feline": - return global::Sample.Models.Cat.DeserializeCat(discriminator0, options); + return options.ShouldReadThroughProxy(global::Sample.SampleContext.Default) ? global::System.ClientModel.Primitives.ModelReaderWriter.Read(discriminator0.GetUtf8Bytes(), options, global::Sample.SampleContext.Default) : global::Sample.Models.Cat.DeserializeCat(discriminator0, options); case "canine": - return global::Sample.Models.Dog.DeserializeDog(discriminator0, options); + return options.ShouldReadThroughProxy(global::Sample.SampleContext.Default) ? global::System.ClientModel.Primitives.ModelReaderWriter.Read(discriminator0.GetUtf8Bytes(), options, global::Sample.SampleContext.Default) : global::Sample.Models.Dog.DeserializeDog(discriminator0, options); default: throw new global::System.Text.Json.JsonException("Unknown discriminator value for union 'pets'."); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/DiscriminatedUnionSerializationTests/WritesContextualEnvelopeSerialization(type,data).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/DiscriminatedUnionSerializationTests/WritesContextualEnvelopeSerialization(type,data).cs index 9ed6dc33eb6..46cf97bc6fd 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/DiscriminatedUnionSerializationTests/WritesContextualEnvelopeSerialization(type,data).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/DiscriminatedUnionSerializationTests/WritesContextualEnvelopeSerialization(type,data).cs @@ -5,6 +5,7 @@ using System; using System.ClientModel.Primitives; using System.Text.Json; +using Sample; namespace Sample.Models { @@ -53,9 +54,9 @@ internal static void SerializePetsUnion(global::System.Text.Json.Utf8JsonWriter switch (discriminator.GetString()) { case "feline": - return global::Sample.Models.Cat.DeserializeCat(discriminator0, options); + return options.ShouldReadThroughProxy(global::Sample.SampleContext.Default) ? global::System.ClientModel.Primitives.ModelReaderWriter.Read(discriminator0.GetUtf8Bytes(), options, global::Sample.SampleContext.Default) : global::Sample.Models.Cat.DeserializeCat(discriminator0, options); case "canine": - return global::Sample.Models.Dog.DeserializeDog(discriminator0, options); + return options.ShouldReadThroughProxy(global::Sample.SampleContext.Default) ? global::System.ClientModel.Primitives.ModelReaderWriter.Read(discriminator0.GetUtf8Bytes(), options, global::Sample.SampleContext.Default) : global::Sample.Models.Dog.DeserializeDog(discriminator0, options); default: throw new global::System.Text.Json.JsonException("Unknown discriminator value for union 'pets'."); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/CombinedMissingOperationParamsAndNonBodyModelParams.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/CombinedMissingOperationParamsAndNonBodyModelParams.cs index d8060badd68..848561f6e4a 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/CombinedMissingOperationParamsAndNonBodyModelParams.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/CombinedMissingOperationParamsAndNonBodyModelParams.cs @@ -1,4 +1,4 @@ global::Sample.Argument.AssertNotNullOrEmpty(id, nameof(id)); global::Sample.Argument.AssertNotNull(request, nameof(request)); -return this.TestOp(id, request.XCustomHeader, request, request.QueryParam, options: cancellationToken.ToRequestOptions()); +return this.TestOp(id, request.XCustomHeader, request.ToBinaryContent(_modelReaderWriterOptions), request.QueryParam, options: cancellationToken.ToRequestOptions()); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_ModelProxies_ConvertsWithClientOptions(Json,Xml,json).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_ModelProxies_ConvertsWithClientOptions(Json,Xml,json).cs new file mode 100644 index 00000000000..1687bb6124c --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_ModelProxies_ConvertsWithClientOptions(Json,Xml,json).cs @@ -0,0 +1,5 @@ +global::Sample.Argument.AssertNotNull(body, nameof(body)); + +using global::System.ClientModel.BinaryContent content = body.ToBinaryContent(_modelReaderWriterOptions); +global::System.ClientModel.ClientResult result = this.UpdateModel(content, cancellationToken.ToRequestOptions()); +return global::System.ClientModel.ClientResult.FromValue(global::Sample.Models.TestModel.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_ModelProxies_ConvertsWithClientOptions(Json,Xml,xml).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_ModelProxies_ConvertsWithClientOptions(Json,Xml,xml).cs new file mode 100644 index 00000000000..b49f5985306 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_ModelProxies_ConvertsWithClientOptions(Json,Xml,xml).cs @@ -0,0 +1,5 @@ +global::Sample.Argument.AssertNotNull(body, nameof(body)); + +using global::System.ClientModel.BinaryContent content = body.ToBinaryContent(_modelReaderWriterOptions.ToXmlOptions()); +global::System.ClientModel.ClientResult result = this.UpdateModel(content, cancellationToken.ToRequestOptions()); +return global::System.ClientModel.ClientResult.FromValue(global::Sample.Models.TestModel.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_ModelProxies_ConvertsWithClientOptions(Json,json).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_ModelProxies_ConvertsWithClientOptions(Json,json).cs new file mode 100644 index 00000000000..2ed794103f1 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_ModelProxies_ConvertsWithClientOptions(Json,json).cs @@ -0,0 +1,4 @@ +global::Sample.Argument.AssertNotNull(body, nameof(body)); + +global::System.ClientModel.ClientResult result = this.UpdateModel(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); +return global::System.ClientModel.ClientResult.FromValue(global::Sample.Models.TestModel.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_ModelProxies_ConvertsWithClientOptions(Xml,xml).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_ModelProxies_ConvertsWithClientOptions(Xml,xml).cs new file mode 100644 index 00000000000..2ed794103f1 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_ModelProxies_ConvertsWithClientOptions(Xml,xml).cs @@ -0,0 +1,4 @@ +global::Sample.Argument.AssertNotNull(body, nameof(body)); + +global::System.ClientModel.ClientResult result = this.UpdateModel(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); +return global::System.ClientModel.ClientResult.FromValue(global::Sample.Models.TestModel.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_ModelProxies_PassClientOptionsToBinaryContentHelper(BinaryDataList).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_ModelProxies_PassClientOptionsToBinaryContentHelper(BinaryDataList).cs new file mode 100644 index 00000000000..1d576caf2b2 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_ModelProxies_PassClientOptionsToBinaryContentHelper(BinaryDataList).cs @@ -0,0 +1,4 @@ +global::Sample.Argument.AssertNotNull(body, nameof(body)); + +using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(body); +return this.Upload(content, cancellationToken.ToRequestOptions()); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_ModelProxies_PassClientOptionsToBinaryContentHelper(ModelDictionary).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_ModelProxies_PassClientOptionsToBinaryContentHelper(ModelDictionary).cs new file mode 100644 index 00000000000..222f59600dc --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_ModelProxies_PassClientOptionsToBinaryContentHelper(ModelDictionary).cs @@ -0,0 +1,4 @@ +global::Sample.Argument.AssertNotNull(body, nameof(body)); + +using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromDictionary(body, _modelReaderWriterOptions); +return this.Upload(content, cancellationToken.ToRequestOptions()); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_ModelProxies_PassClientOptionsToBinaryContentHelper(ModelList).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_ModelProxies_PassClientOptionsToBinaryContentHelper(ModelList).cs new file mode 100644 index 00000000000..aa71d230dfb --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_ModelProxies_PassClientOptionsToBinaryContentHelper(ModelList).cs @@ -0,0 +1,4 @@ +global::Sample.Argument.AssertNotNull(body, nameof(body)); + +using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(body, _modelReaderWriterOptions); +return this.Upload(content, cancellationToken.ToRequestOptions()); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_XmlListBody_UsesXmlFromEnumerable.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_XmlListBody_UsesXmlFromEnumerable.cs index 9fedf14efd0..43f313b016f 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_XmlListBody_UsesXmlFromEnumerable.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_XmlListBody_UsesXmlFromEnumerable.cs @@ -1,4 +1,4 @@ global::Sample.Argument.AssertNotNull(body, nameof(body)); -using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(body, "list", "SignedIdentifier"); +using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(body, "list", "SignedIdentifier", _modelReaderWriterOptions); return this.Foo(content, cancellationToken.ToRequestOptions()); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_XmlListResponse_UsesXDocumentDeserialization.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_XmlListResponse_UsesXDocumentDeserialization.cs index 53582ce29b2..bc8e8eb9165 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_XmlListResponse_UsesXDocumentDeserialization.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/ConvenienceMethod_XmlListResponse_UsesXDocumentDeserialization.cs @@ -9,7 +9,7 @@ global::System.Collections.Generic.List array = new global::System.Collections.Generic.List(); foreach (var item in element.Elements("SignedIdentifier")) { - array.Add(global::Sample.Models.SignedIdentifier.DeserializeSignedIdentifier(item, global::Sample.ModelSerializationExtensions.WireOptions)); + array.Add(_modelReaderWriterOptions.ShouldReadThroughProxy(global::Sample.SampleContext.Default) ? global::System.ClientModel.Primitives.ModelReaderWriter.Read(item.GetUtf8Bytes(), _modelReaderWriterOptions, global::Sample.SampleContext.Default) : global::Sample.Models.SignedIdentifier.DeserializeSignedIdentifier(item, _modelReaderWriterOptions)); } value = array; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/JsonLinesResponseGeneratesUnbufferedAsyncStreamingResult.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/JsonLinesResponseGeneratesUnbufferedAsyncStreamingResult.cs index 499ecf8a0f9..ebe5d46dd1c 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/JsonLinesResponseGeneratesUnbufferedAsyncStreamingResult.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/JsonLinesResponseGeneratesUnbufferedAsyncStreamingResult.cs @@ -2,5 +2,5 @@ { using global::System.ClientModel.Primitives.PipelineMessage message = this.CreateReceiveRequest(cancellationToken.ToRequestOptions()); message.BufferResponse = false; - return global::System.ClientModel.AsyncStreamingResult.CreateJsonLines(await Pipeline.ProcessMessageAsync(message, cancellationToken.ToRequestOptions()).ConfigureAwait(false), data => global::System.ClientModel.Primitives.ModelReaderWriter.Read(data, global::Sample.ModelSerializationExtensions.WireOptions, global::Sample.SampleContext.Default), cancellationToken); + return global::System.ClientModel.AsyncStreamingResult.CreateJsonLines(await Pipeline.ProcessMessageAsync(message, cancellationToken.ToRequestOptions()).ConfigureAwait(false), data => global::System.ClientModel.Primitives.ModelReaderWriter.Read(data, _modelReaderWriterOptions, global::Sample.SampleContext.Default), cancellationToken); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NestedIntegerCollectionRequestsUseBinaryContentHelpers(Int16).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NestedIntegerCollectionRequestsUseBinaryContentHelpers(Int16).cs index 62e2ec99a9a..dd41e6ad153 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NestedIntegerCollectionRequestsUseBinaryContentHelpers(Int16).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NestedIntegerCollectionRequestsUseBinaryContentHelpers(Int16).cs @@ -2,27 +2,27 @@ { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(body); + using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(body, _modelReaderWriterOptions); return this.SendNested(content, cancellationToken.ToRequestOptions()); } public virtual async global::System.Threading.Tasks.Task SendNestedAsync(global::System.Collections.Generic.IEnumerable> body, global::System.Threading.CancellationToken cancellationToken = default) { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(body); + using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(body, _modelReaderWriterOptions); return await this.SendNestedAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); } public virtual global::System.ClientModel.ClientResult SendRecord(global::System.Collections.Generic.IDictionary> body, global::System.Threading.CancellationToken cancellationToken = default) { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromDictionary(body); + using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromDictionary(body, _modelReaderWriterOptions); return this.SendRecord(content, cancellationToken.ToRequestOptions()); } public virtual async global::System.Threading.Tasks.Task SendRecordAsync(global::System.Collections.Generic.IDictionary> body, global::System.Threading.CancellationToken cancellationToken = default) { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromDictionary(body); + using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromDictionary(body, _modelReaderWriterOptions); return await this.SendRecordAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NestedIntegerCollectionRequestsUseBinaryContentHelpers(UInt16).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NestedIntegerCollectionRequestsUseBinaryContentHelpers(UInt16).cs index 1f0fe2a3f5b..f34de50a8ee 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NestedIntegerCollectionRequestsUseBinaryContentHelpers(UInt16).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NestedIntegerCollectionRequestsUseBinaryContentHelpers(UInt16).cs @@ -2,27 +2,27 @@ { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(body); + using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(body, _modelReaderWriterOptions); return this.SendNested(content, cancellationToken.ToRequestOptions()); } public virtual async global::System.Threading.Tasks.Task SendNestedAsync(global::System.Collections.Generic.IEnumerable> body, global::System.Threading.CancellationToken cancellationToken = default) { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(body); + using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(body, _modelReaderWriterOptions); return await this.SendNestedAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); } public virtual global::System.ClientModel.ClientResult SendRecord(global::System.Collections.Generic.IDictionary> body, global::System.Threading.CancellationToken cancellationToken = default) { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromDictionary(body); + using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromDictionary(body, _modelReaderWriterOptions); return this.SendRecord(content, cancellationToken.ToRequestOptions()); } public virtual async global::System.Threading.Tasks.Task SendRecordAsync(global::System.Collections.Generic.IDictionary> body, global::System.Threading.CancellationToken cancellationToken = default) { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromDictionary(body); + using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromDictionary(body, _modelReaderWriterOptions); return await this.SendRecordAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NestedIntegerCollectionRequestsUseBinaryContentHelpers(UInt32).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NestedIntegerCollectionRequestsUseBinaryContentHelpers(UInt32).cs index 99ab9612f46..ef711b1c5d7 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NestedIntegerCollectionRequestsUseBinaryContentHelpers(UInt32).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NestedIntegerCollectionRequestsUseBinaryContentHelpers(UInt32).cs @@ -2,27 +2,27 @@ { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(body); + using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(body, _modelReaderWriterOptions); return this.SendNested(content, cancellationToken.ToRequestOptions()); } public virtual async global::System.Threading.Tasks.Task SendNestedAsync(global::System.Collections.Generic.IEnumerable> body, global::System.Threading.CancellationToken cancellationToken = default) { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(body); + using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(body, _modelReaderWriterOptions); return await this.SendNestedAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); } public virtual global::System.ClientModel.ClientResult SendRecord(global::System.Collections.Generic.IDictionary> body, global::System.Threading.CancellationToken cancellationToken = default) { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromDictionary(body); + using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromDictionary(body, _modelReaderWriterOptions); return this.SendRecord(content, cancellationToken.ToRequestOptions()); } public virtual async global::System.Threading.Tasks.Task SendRecordAsync(global::System.Collections.Generic.IDictionary> body, global::System.Threading.CancellationToken cancellationToken = default) { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromDictionary(body); + using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromDictionary(body, _modelReaderWriterOptions); return await this.SendRecordAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NestedIntegerCollectionRequestsUseBinaryContentHelpers(UInt64).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NestedIntegerCollectionRequestsUseBinaryContentHelpers(UInt64).cs index 7038a7059a9..ecde7554bff 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NestedIntegerCollectionRequestsUseBinaryContentHelpers(UInt64).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NestedIntegerCollectionRequestsUseBinaryContentHelpers(UInt64).cs @@ -2,27 +2,27 @@ { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(body); + using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(body, _modelReaderWriterOptions); return this.SendNested(content, cancellationToken.ToRequestOptions()); } public virtual async global::System.Threading.Tasks.Task SendNestedAsync(global::System.Collections.Generic.IEnumerable> body, global::System.Threading.CancellationToken cancellationToken = default) { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(body); + using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromEnumerable(body, _modelReaderWriterOptions); return await this.SendNestedAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); } public virtual global::System.ClientModel.ClientResult SendRecord(global::System.Collections.Generic.IDictionary> body, global::System.Threading.CancellationToken cancellationToken = default) { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromDictionary(body); + using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromDictionary(body, _modelReaderWriterOptions); return this.SendRecord(content, cancellationToken.ToRequestOptions()); } public virtual async global::System.Threading.Tasks.Task SendRecordAsync(global::System.Collections.Generic.IDictionary> body, global::System.Threading.CancellationToken cancellationToken = default) { global::Sample.Argument.AssertNotNull(body, nameof(body)); - using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromDictionary(body); + using global::System.ClientModel.BinaryContent content = global::Sample.BinaryContentHelper.FromDictionary(body, _modelReaderWriterOptions); return await this.SendRecordAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingOmitsOnlyContinuationToken(False).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingOmitsOnlyContinuationToken(False).cs index 42f3a465600..7bf1a12c6c1 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingOmitsOnlyContinuationToken(False).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingOmitsOnlyContinuationToken(False).cs @@ -1,16 +1,16 @@ public virtual global::System.ClientModel.Primitives.CollectionResult GetItems(string token, string filter, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsCollectionResult(this, token, filter, options); + return new global::Sample.TestClientGetItemsCollectionResult(this, _modelReaderWriterOptions, token, filter, options); } public virtual global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(string token, string filter, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, token, filter, options); + return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, _modelReaderWriterOptions, token, filter, options); } public virtual global::System.ClientModel.CollectionResult GetItems(string token = default, string filter = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, token, filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT(this, _modelReaderWriterOptions, token, filter, cancellationToken.ToRequestOptions()); } public virtual global::System.ClientModel.AsyncCollectionResult GetItemsAsync(string token = default, string filter = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, token, filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, _modelReaderWriterOptions, token, filter, cancellationToken.ToRequestOptions()); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingOmitsOnlyContinuationToken(True).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingOmitsOnlyContinuationToken(True).cs index 5e2afbc8181..cec84475a17 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingOmitsOnlyContinuationToken(True).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingOmitsOnlyContinuationToken(True).cs @@ -1,16 +1,16 @@ public virtual global::System.ClientModel.Primitives.CollectionResult GetItems(string filter, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsCollectionResult(this, default, filter, options); + return new global::Sample.TestClientGetItemsCollectionResult(this, _modelReaderWriterOptions, default, filter, options); } public virtual global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(string filter, global::System.ClientModel.Primitives.RequestOptions options) { - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, default, filter, options); + return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, _modelReaderWriterOptions, default, filter, options); } public virtual global::System.ClientModel.CollectionResult GetItems(string filter = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, default, filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT(this, _modelReaderWriterOptions, default, filter, cancellationToken.ToRequestOptions()); } public virtual global::System.ClientModel.AsyncCollectionResult GetItemsAsync(string filter = default, global::System.Threading.CancellationToken cancellationToken = default) { - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, default, filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, _modelReaderWriterOptions, default, filter, cancellationToken.ToRequestOptions()); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingPreservesContinuationTokenOptionsBag(CustomMethods).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingPreservesContinuationTokenOptionsBag(CustomMethods).cs index 41bd43ab2b5..e51d961adb7 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingPreservesContinuationTokenOptionsBag(CustomMethods).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingPreservesContinuationTokenOptionsBag(CustomMethods).cs @@ -2,23 +2,23 @@ { global::Sample.Argument.AssertNotNull(options, nameof(options)); - return new global::Sample.TestClientGetItemsCollectionResult(this, options.Token, options.Filter, requestOptions); + return new global::Sample.TestClientGetItemsCollectionResult(this, _modelReaderWriterOptions, options.Token, options.Filter, requestOptions); } public partial global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(global::Sample.Models.GetItemsOptions options, global::System.ClientModel.Primitives.RequestOptions requestOptions) { global::Sample.Argument.AssertNotNull(options, nameof(options)); - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, options.Token, options.Filter, requestOptions); + return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, _modelReaderWriterOptions, options.Token, options.Filter, requestOptions); } public partial global::System.ClientModel.CollectionResult GetItems(global::Sample.Models.GetItemsOptions options, global::System.Threading.CancellationToken cancellationToken) { global::Sample.Argument.AssertNotNull(options, nameof(options)); - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, options.Token, options.Filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT(this, _modelReaderWriterOptions, options.Token, options.Filter, cancellationToken.ToRequestOptions()); } public partial global::System.ClientModel.AsyncCollectionResult GetItemsAsync(global::Sample.Models.GetItemsOptions options, global::System.Threading.CancellationToken cancellationToken) { global::Sample.Argument.AssertNotNull(options, nameof(options)); - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, options.Token, options.Filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, _modelReaderWriterOptions, options.Token, options.Filter, cancellationToken.ToRequestOptions()); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingPreservesContinuationTokenOptionsBag(False).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingPreservesContinuationTokenOptionsBag(False).cs index 575e297bfed..36c5ab81eb1 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingPreservesContinuationTokenOptionsBag(False).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingPreservesContinuationTokenOptionsBag(False).cs @@ -2,23 +2,23 @@ { global::Sample.Argument.AssertNotNull(options, nameof(options)); - return new global::Sample.TestClientGetItemsCollectionResult(this, token, options.Filter, requestOptions); + return new global::Sample.TestClientGetItemsCollectionResult(this, _modelReaderWriterOptions, token, options.Filter, requestOptions); } public virtual global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(global::Sample.Models.GetItemsOptions options, string token, global::System.ClientModel.Primitives.RequestOptions requestOptions) { global::Sample.Argument.AssertNotNull(options, nameof(options)); - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, token, options.Filter, requestOptions); + return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, _modelReaderWriterOptions, token, options.Filter, requestOptions); } public virtual global::System.ClientModel.CollectionResult GetItems(global::Sample.Models.GetItemsOptions options, string token = default, global::System.Threading.CancellationToken cancellationToken = default) { global::Sample.Argument.AssertNotNull(options, nameof(options)); - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, token, options.Filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT(this, _modelReaderWriterOptions, token, options.Filter, cancellationToken.ToRequestOptions()); } public virtual global::System.ClientModel.AsyncCollectionResult GetItemsAsync(global::Sample.Models.GetItemsOptions options, string token = default, global::System.Threading.CancellationToken cancellationToken = default) { global::Sample.Argument.AssertNotNull(options, nameof(options)); - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, token, options.Filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, _modelReaderWriterOptions, token, options.Filter, cancellationToken.ToRequestOptions()); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingPreservesContinuationTokenOptionsBag(True).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingPreservesContinuationTokenOptionsBag(True).cs index 8d6eda54023..5ab10504c91 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingPreservesContinuationTokenOptionsBag(True).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingPreservesContinuationTokenOptionsBag(True).cs @@ -2,23 +2,23 @@ { global::Sample.Argument.AssertNotNull(options, nameof(options)); - return new global::Sample.TestClientGetItemsCollectionResult(this, default, options.Filter, requestOptions); + return new global::Sample.TestClientGetItemsCollectionResult(this, _modelReaderWriterOptions, default, options.Filter, requestOptions); } public virtual global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(global::Sample.Models.GetItemsOptions options, global::System.ClientModel.Primitives.RequestOptions requestOptions) { global::Sample.Argument.AssertNotNull(options, nameof(options)); - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, default, options.Filter, requestOptions); + return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, _modelReaderWriterOptions, default, options.Filter, requestOptions); } public virtual global::System.ClientModel.CollectionResult GetItems(global::Sample.Models.GetItemsOptions options, global::System.Threading.CancellationToken cancellationToken = default) { global::Sample.Argument.AssertNotNull(options, nameof(options)); - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, default, options.Filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT(this, _modelReaderWriterOptions, default, options.Filter, cancellationToken.ToRequestOptions()); } public virtual global::System.ClientModel.AsyncCollectionResult GetItemsAsync(global::Sample.Models.GetItemsOptions options, global::System.Threading.CancellationToken cancellationToken = default) { global::Sample.Argument.AssertNotNull(options, nameof(options)); - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, default, options.Filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, _modelReaderWriterOptions, default, options.Filter, cancellationToken.ToRequestOptions()); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingPreservesContinuationTokenOptionsBag.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingPreservesContinuationTokenOptionsBag.cs index 8de338d62ca..b57ec56eb50 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingPreservesContinuationTokenOptionsBag.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/NextLinkPagingPreservesContinuationTokenOptionsBag.cs @@ -2,23 +2,23 @@ { global::Sample.Argument.AssertNotNull(options, nameof(options)); - return new global::Sample.TestClientGetItemsCollectionResult(this, options.Token, options.Filter, requestOptions); + return new global::Sample.TestClientGetItemsCollectionResult(this, _modelReaderWriterOptions, options.Token, options.Filter, requestOptions); } public virtual global::System.ClientModel.Primitives.AsyncCollectionResult GetItemsAsync(global::Sample.Models.GetItemsOptions options, global::System.ClientModel.Primitives.RequestOptions requestOptions) { global::Sample.Argument.AssertNotNull(options, nameof(options)); - return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, options.Token, options.Filter, requestOptions); + return new global::Sample.TestClientGetItemsAsyncCollectionResult(this, _modelReaderWriterOptions, options.Token, options.Filter, requestOptions); } public virtual global::System.ClientModel.CollectionResult GetItems(global::Sample.Models.GetItemsOptions options, global::System.Threading.CancellationToken cancellationToken = default) { global::Sample.Argument.AssertNotNull(options, nameof(options)); - return new global::Sample.TestClientGetItemsCollectionResultOfT(this, options.Token, options.Filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsCollectionResultOfT(this, _modelReaderWriterOptions, options.Token, options.Filter, cancellationToken.ToRequestOptions()); } public virtual global::System.ClientModel.AsyncCollectionResult GetItemsAsync(global::Sample.Models.GetItemsOptions options, global::System.Threading.CancellationToken cancellationToken = default) { global::Sample.Argument.AssertNotNull(options, nameof(options)); - return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, options.Token, options.Filter, cancellationToken.ToRequestOptions()); + return new global::Sample.TestClientGetItemsAsyncCollectionResultOfT(this, _modelReaderWriterOptions, options.Token, options.Filter, cancellationToken.ToRequestOptions()); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/OptionsBagOverride_PagingMethodExpandsBagForCollectionResult(Convenience).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/OptionsBagOverride_PagingMethodExpandsBagForCollectionResult(Convenience).cs index ae6b47c9f0a..67b9c3f3561 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/OptionsBagOverride_PagingMethodExpandsBagForCollectionResult(Convenience).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/OptionsBagOverride_PagingMethodExpandsBagForCollectionResult(Convenience).cs @@ -1,3 +1,3 @@ global::Sample.Argument.AssertNotNull(options, nameof(options)); -return new global::Sample.TestClientGetWidgetsCollectionResultOfT(this, options.Id, options.Filter, cancellationToken.ToRequestOptions()); +return new global::Sample.TestClientGetWidgetsCollectionResultOfT(this, _modelReaderWriterOptions, options.Id, options.Filter, cancellationToken.ToRequestOptions()); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/OptionsBagOverride_PagingMethodExpandsBagForCollectionResult(Protocol).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/OptionsBagOverride_PagingMethodExpandsBagForCollectionResult(Protocol).cs index 632c2a8b25f..fd8a6b4d4a5 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/OptionsBagOverride_PagingMethodExpandsBagForCollectionResult(Protocol).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/OptionsBagOverride_PagingMethodExpandsBagForCollectionResult(Protocol).cs @@ -1,3 +1,3 @@ global::Sample.Argument.AssertNotNull(options, nameof(options)); -return new global::Sample.TestClientGetWidgetsCollectionResult(this, options.Id, options.Filter, requestOptions); +return new global::Sample.TestClientGetWidgetsCollectionResult(this, _modelReaderWriterOptions, options.Id, options.Filter, requestOptions); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/SseEventsUnionExtendingModelUsesBaseAndParsesByEventType.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/SseEventsUnionExtendingModelUsesBaseAndParsesByEventType.cs index 23b52c352dd..4812af8b109 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/SseEventsUnionExtendingModelUsesBaseAndParsesByEventType.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ScmMethodProviderCollectionTests/SseEventsUnionExtendingModelUsesBaseAndParsesByEventType.cs @@ -4,8 +4,8 @@ message.BufferResponse = false; return global::System.ClientModel.AsyncStreamingResult.CreateSse(await Pipeline.ProcessMessageAsync(message, cancellationToken.ToRequestOptions()).ConfigureAwait(false), (eventType, data) => eventType switch { - "response.created" => global::System.ClientModel.Primitives.ModelReaderWriter.Read(global::System.BinaryData.FromBytes(data.ToArray()), global::Sample.ModelSerializationExtensions.WireOptions, global::Sample.SampleContext.Default), - "message" => global::System.ClientModel.Primitives.ModelReaderWriter.Read(global::System.BinaryData.FromBytes(data.ToArray()), global::Sample.ModelSerializationExtensions.WireOptions, global::Sample.SampleContext.Default), - _ => global::System.ClientModel.Primitives.ModelReaderWriter.Read(global::System.BinaryData.FromBytes(data.ToArray()), global::Sample.ModelSerializationExtensions.WireOptions, global::Sample.SampleContext.Default) + "response.created" => global::System.ClientModel.Primitives.ModelReaderWriter.Read(global::System.BinaryData.FromBytes(data.ToArray()), _modelReaderWriterOptions, global::Sample.SampleContext.Default), + "message" => global::System.ClientModel.Primitives.ModelReaderWriter.Read(global::System.BinaryData.FromBytes(data.ToArray()), _modelReaderWriterOptions, global::Sample.SampleContext.Default), + _ => global::System.ClientModel.Primitives.ModelReaderWriter.Read(global::System.BinaryData.FromBytes(data.ToArray()), _modelReaderWriterOptions, global::Sample.SampleContext.Default) }, null, cancellationToken); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/TestHelpers/ClientPipelineWithoutModelProxies.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/TestHelpers/ClientPipelineWithoutModelProxies.cs new file mode 100644 index 00000000000..164fc15a1ad --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/TestHelpers/ClientPipelineWithoutModelProxies.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Microsoft.TypeSpec.Generator.ClientModel.Providers; +using Microsoft.TypeSpec.Generator.Expressions; + +namespace Microsoft.TypeSpec.Generator.ClientModel.Tests +{ + /// + /// A System.ClientModel pipeline whose client options don't carry model proxies, matching pipelines such as + /// Azure.Core's that generate the pre-proxy client conversions. + /// + internal record ClientPipelineWithoutModelProxies : ClientPipelineProvider + { + private static ClientPipelineApi? _instance; + internal static new ClientPipelineApi Instance => _instance ??= new ClientPipelineWithoutModelProxies(Empty); + + public ClientPipelineWithoutModelProxies(ValueExpression original) : base(original) + { + } + + public override bool SupportsModelProxies => false; + + public override ClientPipelineApi FromExpression(ValueExpression expression) + => new ClientPipelineWithoutModelProxies(expression); + + public override ClientPipelineApi ToExpression() => this; + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/NewProjectScaffolding.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/NewProjectScaffolding.cs index 30d1b2b93a5..49b7b58cc3a 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/NewProjectScaffolding.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/NewProjectScaffolding.cs @@ -125,7 +125,7 @@ protected virtual string GetTestProjectFileContent() private static readonly IReadOnlyList _unbrandedDependencyPackages = new CSharpProjectWriter.CSProjDependencyPackage[] { - new("System.ClientModel", "1.16.0"), + new("System.ClientModel", "1.17.0-alpha.20261117.1"), }; protected virtual string GetSolutionFileContent() diff --git a/packages/http-client-csharp/generator/Packages.Data.props b/packages/http-client-csharp/generator/Packages.Data.props index 59e8f4b3be5..0acb6aa205e 100644 --- a/packages/http-client-csharp/generator/Packages.Data.props +++ b/packages/http-client-csharp/generator/Packages.Data.props @@ -14,7 +14,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Local.Tests/ModelProxyTests.cs b/packages/http-client-csharp/generator/TestProjects/Local.Tests/ModelProxyTests.cs new file mode 100644 index 00000000000..21ea1a3ef32 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Local.Tests/ModelProxyTests.cs @@ -0,0 +1,428 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using NUnit.Framework; +using SampleTypeSpec; + +namespace TestProjects.Local.Tests +{ + public class ModelProxyTests + { + [Test] + public void NestedModelReadsUseRegisteredProxy() + { + var proxy = new ThingProxy(); + var options = CreateOptions(proxy); + + var page = ReadPage("""{"items":[{"name":"first"},{"name":"second"}]}""", options); + var roundTrip = ModelReaderWriter.Read( + BinaryData.FromString("""{"requiredModel":{"name":"nested"}}"""), options, SampleTypeSpecContext.Default); + + Assert.AreEqual(new[] { "proxy:first", "proxy:second" }, page.Items.Select(item => item.Rename)); + Assert.AreEqual("proxy:nested", roundTrip!.RequiredModel.Rename); + Assert.AreEqual(3, proxy.ReadCount); + } + + [Test] + public void NestedModelWritesUseRegisteredProxy() + { + var proxy = new ThingProxy(); + var page = new PageThing([CreateThing("first"), CreateThing("second")]); + + var result = ModelReaderWriter.Write(page, CreateOptions(proxy), SampleTypeSpecContext.Default); + + using var document = JsonDocument.Parse(result); + var items = document.RootElement.GetProperty("items").EnumerateArray().ToArray(); + Assert.AreEqual(new[] { "first", "second" }, items.Select(item => item.GetProperty("proxied").GetString())); + Assert.AreEqual(2, proxy.WriteCount); + } + + [Test] + public void NestedDynamicModelReadsUseRegisteredProxy() + { + var proxy = new AnotherDynamicModelProxy(); + + var model = ModelReaderWriter.Read( + BinaryData.FromString("""{"name":"root","foo":{"bar":"single"},"listFoo":[{"bar":"item"}],"dictionaryFoo":{"key":{"bar":"value"}}}"""), + CreateOptions(proxy), + SampleTypeSpecContext.Default); + + Assert.AreEqual("proxy:single", model!.Foo.Bar); + Assert.AreEqual("proxy:item", model.ListFoo.Single().Bar); + Assert.AreEqual("proxy:value", model.DictionaryFoo["key"].Bar); + Assert.AreEqual(3, proxy.ReadCount); + } + + [Test] + public void NestedDynamicModelWritesUseRegisteredProxy() + { + var proxy = new AnotherDynamicModelProxy(); + var model = new DynamicModel( + "root", + [1], + new Dictionary(), + new Dictionary(), + new AnotherDynamicModel("single"), + [new AnotherDynamicModel("item")], + [], + new Dictionary { ["key"] = new AnotherDynamicModel("value") }, + new Dictionary>(), + new Dictionary>(), + []); + + var result = ModelReaderWriter.Write(model, CreateOptions(proxy), SampleTypeSpecContext.Default); + + using var document = JsonDocument.Parse(result); + var root = document.RootElement; + Assert.AreEqual("single", root.GetProperty("foo").GetProperty("proxied").GetString()); + Assert.AreEqual("item", root.GetProperty("listFoo")[0].GetProperty("proxied").GetString()); + Assert.AreEqual("value", root.GetProperty("dictionaryFoo").GetProperty("key").GetProperty("proxied").GetString()); + Assert.AreEqual(3, proxy.WriteCount); + } + + [Test] + public void DecliningProxyFallsBackToModelSerialization() + { + var proxy = new ThingProxy(canHandle: false); + var options = CreateOptions(proxy); + + var page = ReadPage("""{"items":[{"name":"first"}]}""", options); + var result = ModelReaderWriter.Write(new PageThing([CreateThing("second")]), options, SampleTypeSpecContext.Default); + + Assert.AreEqual("first", page.Items.Single().Rename); + using var document = JsonDocument.Parse(result); + var item = document.RootElement.GetProperty("items")[0]; + Assert.AreEqual("second", item.GetProperty("name").GetString()); + Assert.IsFalse(item.TryGetProperty("proxied", out _)); + Assert.AreEqual(0, proxy.ReadCount); + Assert.AreEqual(0, proxy.WriteCount); + } + + [Test] + public void NestedXmlModelReadsUseRegisteredProxy() + { + var nestedProxy = new XmlNestedModelProxy(); + var itemProxy = new XmlItemProxy(); + var options = new ModelReaderWriterOptions("W"); + options.Proxies.Add(nestedProxy); + options.Proxies.Add(itemProxy); + + var model = ModelReaderWriter.Read( + BinaryData.FromString("""rootfirst1nested"""), + options, + SampleTypeSpecContext.Default); + + Assert.AreEqual("proxy:nested", model!.NestedModel.Value); + Assert.AreEqual(7, model.NestedModel.NestedId); + Assert.AreEqual("proxy:first", model.Items.Single().ItemName); + Assert.AreEqual(1, nestedProxy.ReadCount); + Assert.AreEqual(1, itemProxy.ReadCount); + } + + // Clients copy the proxies configured on their options into the options they use for every operation. + [Test] + public void ClientResponsesUseClientOptionsProxies() + { + var proxy = new ThingProxy(); + var handler = new StubHandler(("""{"name":"hi"}""", "application/json")); + + var result = CreateClient(handler, proxy).SayHi("head", "query"); + + Assert.AreEqual("proxy:hi", result.Value.Rename); + Assert.AreEqual(1, proxy.ReadCount); + } + + [Test] + public void ClientRequestBodiesUseClientOptionsProxies() + { + var proxy = new ThingProxy(); + var handler = new StubHandler(("""{"requiredModel":{"name":"response"}}""", "application/json")); + var action = new RoundTripModel( + "value", + 1, + [], + new Dictionary(), + CreateThing("request"), + BinaryData.FromString("1"), + new Dictionary(), + new ModelWithRequiredNullableProperties(null, null, null), + BinaryData.FromBytes([1])); + + var result = CreateClient(handler, proxy).HelloAgain("p2", "p1", action); + + using var request = JsonDocument.Parse(handler.RequestBodies.Single()); + Assert.AreEqual("request", request.RootElement.GetProperty("requiredModel").GetProperty("proxied").GetString()); + Assert.AreEqual("proxy:response", result.Value.RequiredModel.Rename); + Assert.AreEqual(1, proxy.WriteCount); + Assert.AreEqual(1, proxy.ReadCount); + } + + [Test] + public void ClientPagesUseClientOptionsProxies() + { + var proxy = new ThingProxy(); + var handler = new StubHandler( + ("""{"things":[{"name":"first"}],"next":"https://example.com/link?page=2"}""", "application/json"), + ("""{"things":[{"name":"second"}]}""", "application/json")); + + var items = CreateClient(handler, proxy).GetWithNextLink().ToArray(); + + Assert.AreEqual(new[] { "proxy:first", "proxy:second" }, items.Select(item => item.Rename)); + Assert.AreEqual(2, handler.RequestBodies.Count); + } + + // Multipart bodies write their model parts with the client's options. + [Test] + public void ClientMultipartBodiesUseClientOptionsProxies() + { + var proxy = new ThingProxy(); + var handler = new StubHandler(HttpStatusCode.NoContent); +#pragma warning disable SCME0004 // Multipart file parts and content are evaluation-only. + var cat = new Cat( + "id", + true, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + new Dictionary(), + new Dictionary { ["key"] = CreateThing("value") }, + [], + [CreateThing("item")], + [], + BinaryData.FromString("image"), + StringExtensibleEnum.One, + StringFixedEnum.One, + IntExtensibleEnum.One, + IntFixedEnum.One); + + CreateClient(handler, proxy).UploadCat(cat); +#pragma warning restore SCME0004 + + var body = handler.RequestBodies.Single(); + StringAssert.Contains("""{"proxied":"item"}""", body); + StringAssert.Contains("""{"proxied":"value"}""", body); + Assert.AreEqual(2, proxy.WriteCount); + } + + [Test] + public void SubClientResponsesUseClientOptionsProxies() + { + var proxy = new TreeXmlProxy(); + var handler = new StubHandler(("""treet1105""", "application/xml")); + + var result = CreateClient(handler, proxy).GetPlantOperationsClient().GetTree(); + + Assert.AreEqual("proxy:t1", result.Value.Id); + Assert.AreEqual(1, proxy.ReadCount); + Assert.AreEqual("X", proxy.LastReadFormat); + } + + [Test] + public void ShouldReadThroughProxyRequiresProxiesAndBuildableModel() + { + var options = new ModelReaderWriterOptions("W"); + Assert.IsFalse(options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)); + + options.Proxies.Add(new ThingProxy()); + + // Repeat each check so the cached per-type answer is exercised as well as the first lookup. + for (int i = 0; i < 2; i++) + { + Assert.IsTrue(options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)); + // Internal models are not registered in the generated context, so they keep the static deserializer. + Assert.IsFalse(options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)); + } + } + + private static ModelReaderWriterOptions CreateOptions(ModelProxy proxy) + { + var options = new ModelReaderWriterOptions("W"); + options.Proxies.Add(proxy); + return options; + } + + private static SampleTypeSpecClient CreateClient(StubHandler handler, ModelProxy proxy) + { + var options = new SampleTypeSpecClientOptions + { + Transport = new HttpClientPipelineTransport(new HttpClient(handler)), + RetryPolicy = new ClientRetryPolicy(0) + }; + options.ModelProxies.Add(proxy); + return new SampleTypeSpecClient(new Uri("https://example.com"), new ApiKeyCredential("key"), options); + } + + // Returns the queued responses in order, or an empty response with the given status, and records each request body. + private sealed class StubHandler : HttpMessageHandler + { + private readonly Queue<(string Content, string ContentType)> _responses; + private readonly HttpStatusCode _statusCode = HttpStatusCode.OK; + + public StubHandler(params (string Content, string ContentType)[] responses) + { + _responses = new(responses); + } + + public StubHandler(HttpStatusCode statusCode) + { + _responses = new(); + _statusCode = statusCode; + } + + public List RequestBodies { get; } = []; + + protected override HttpResponseMessage Send(HttpRequestMessage request, CancellationToken cancellationToken) + { + RequestBodies.Add(request.Content?.ReadAsStringAsync(cancellationToken).GetAwaiter().GetResult() ?? string.Empty); + if (_responses.Count == 0) + { + return new HttpResponseMessage(_statusCode); + } + var (content, contentType) = _responses.Dequeue(); + return new HttpResponseMessage(_statusCode) { Content = new StringContent(content, Encoding.UTF8, contentType) }; + } + + protected override Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) + => Task.FromResult(Send(request, cancellationToken)); + } + + // PageThing is internal, so it is not buildable through the generated context; read it through its own interface. + private static PageThing ReadPage(string json, ModelReaderWriterOptions options) + => ((IPersistableModel)new PageThing([])).Create(BinaryData.FromString(json), options)!; + + private static Thing CreateThing(string name) + => new(name, BinaryData.FromString("\"union\""), "nullable", null, "description", [1], "docs"); + + private sealed class ThingProxy : TestProxy + { + public ThingProxy(bool canHandle = true) : base(canHandle) + { + } + + protected override Thing Transform(Thing model) + { + model.Rename = $"proxy:{model.Rename}"; + return model; + } + + protected override string? Describe(Thing model) => model.Rename; + } + + private sealed class AnotherDynamicModelProxy : TestProxy + { + protected override AnotherDynamicModel Transform(AnotherDynamicModel model) => new($"proxy:{model.Bar}"); + + protected override string? Describe(AnotherDynamicModel model) => model.Bar; + } + + private sealed class XmlNestedModelProxy : XmlTestProxy + { + protected override XmlNestedModel Transform(XmlNestedModel model) + { + model.Value = $"proxy:{model.Value}"; + return model; + } + } + + private sealed class XmlItemProxy : XmlTestProxy + { + protected override XmlItem Transform(XmlItem model) + { + model.ItemName = $"proxy:{model.ItemName}"; + return model; + } + } + + private sealed class TreeXmlProxy : XmlTestProxy + { + protected override Tree Transform(Tree model) + { + model.Id = $"proxy:{model.Id}"; + return model; + } + } + + // XML proxies only implement IPersistableModel; reads transform the model's own XML deserialization. + private abstract class XmlTestProxy : ModelProxy where T : class + { + public int ReadCount { get; private set; } + + public string? LastReadFormat { get; private set; } + + protected abstract T Transform(T model); + + public override T Create(BinaryData data, ModelReaderWriterOptions options) + { + ReadCount++; + LastReadFormat = options.Format; + return Transform(ModelReaderWriter.Read(data, ModelReaderWriterOptions.Xml, SampleTypeSpecContext.Default)!); + } + + public override BinaryData Write(ModelReaderWriterOptions options) => throw new NotSupportedException(); + + public override string GetFormatFromOptions(ModelReaderWriterOptions options) => "X"; + } + + // Reads by delegating to the model's own serialization and transforming the result, and writes a marker + // object describing the original model so tests can tell which serializer handled each nested model. + private abstract class TestProxy : ModelProxy, IJsonModel where T : class + { + private readonly bool _canHandle; + + protected TestProxy(bool canHandle = true) + { + _canHandle = canHandle; + } + + public int ReadCount { get; private set; } + + public int WriteCount { get; private set; } + + protected abstract T Transform(T model); + + protected abstract string? Describe(T model); + + public override bool CanHandle(T model, ModelReaderWriterOptions options) => _canHandle; + + public override bool CanHandle(ReadOnlyMemory data, ModelReaderWriterOptions options) => _canHandle; + + public override bool CanHandle(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => _canHandle; + + public override T Create(BinaryData data, ModelReaderWriterOptions options) + { + ReadCount++; + return Transform(ModelReaderWriter.Read(data, ModelReaderWriterOptions.Json, SampleTypeSpecContext.Default)!); + } + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + WriteCount++; + writer.WriteStartObject(); + writer.WriteString("proxied", Describe((T)options.ProxiedModel!)); + writer.WriteEndObject(); + } + + T IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + => throw new NotSupportedException(); + + public override BinaryData Write(ModelReaderWriterOptions options) => throw new NotSupportedException(); + + public override string GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/AnimalOperations.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/AnimalOperations.cs index 10d3b31fe97..d2ea05ce7ea 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/AnimalOperations.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/AnimalOperations.cs @@ -17,6 +17,7 @@ namespace SampleTypeSpec public partial class AnimalOperations { private readonly Uri _endpoint; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions = ModelSerializationExtensions.WireOptions; /// Initializes a new instance of AnimalOperations for mocking. protected AnimalOperations() @@ -25,11 +26,13 @@ protected AnimalOperations() /// Initializes a new instance of AnimalOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. + /// /// Service endpoint. - internal AnimalOperations(ClientPipeline pipeline, Uri endpoint) + internal AnimalOperations(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) { _endpoint = endpoint; Pipeline = pipeline; + _modelReaderWriterOptions = modelReaderWriterOptions; } /// The HTTP pipeline for sending and receiving REST requests and responses. @@ -86,8 +89,8 @@ public virtual ClientResult UpdatePetAsAnimal(Animal animal, Cancellatio { Argument.AssertNotNull(animal, nameof(animal)); - ClientResult result = UpdatePetAsAnimal(animal, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((Animal)result, result.GetRawResponse()); + ClientResult result = UpdatePetAsAnimal(animal.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); + return ClientResult.FromValue(Animal.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Update a pet as an animal. @@ -99,8 +102,8 @@ public virtual async Task> UpdatePetAsAnimalAsync(Animal an { Argument.AssertNotNull(animal, nameof(animal)); - ClientResult result = await UpdatePetAsAnimalAsync(animal, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((Animal)result, result.GetRawResponse()); + ClientResult result = await UpdatePetAsAnimalAsync(animal.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue(Animal.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -154,8 +157,8 @@ public virtual ClientResult UpdateDogAsAnimal(Animal animal, Cancellatio { Argument.AssertNotNull(animal, nameof(animal)); - ClientResult result = UpdateDogAsAnimal(animal, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((Animal)result, result.GetRawResponse()); + ClientResult result = UpdateDogAsAnimal(animal.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); + return ClientResult.FromValue(Animal.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Update a dog as an animal. @@ -167,8 +170,8 @@ public virtual async Task> UpdateDogAsAnimalAsync(Animal an { Argument.AssertNotNull(animal, nameof(animal)); - ClientResult result = await UpdateDogAsAnimalAsync(animal, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((Animal)result, result.GetRawResponse()); + ClientResult result = await UpdateDogAsAnimalAsync(animal.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue(Animal.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/ExperimentalSamplesGetAllAsyncCollectionResult.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/ExperimentalSamplesGetAllAsyncCollectionResult.cs index 34376fe00e5..379d60c8ceb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/ExperimentalSamplesGetAllAsyncCollectionResult.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/ExperimentalSamplesGetAllAsyncCollectionResult.cs @@ -17,15 +17,18 @@ internal partial class ExperimentalSamplesGetAllAsyncCollectionResult : AsyncCol #pragma warning disable SAMPLE0009 // This generated code depends on experimental functionality. private readonly ExperimentalSamples _client; #pragma warning restore SAMPLE0009 // This generated code depends on experimental functionality. + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly RequestOptions _options; /// Initializes a new instance of ExperimentalSamplesGetAllAsyncCollectionResult, which is used to iterate over the pages of a collection. /// The ExperimentalSamples client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// The request options, which can override default behaviors of the client pipeline on a per-call basis. #pragma warning disable SAMPLE0009 // This generated code depends on experimental functionality. - public ExperimentalSamplesGetAllAsyncCollectionResult(ExperimentalSamples client, RequestOptions options) + public ExperimentalSamplesGetAllAsyncCollectionResult(ExperimentalSamples client, ModelReaderWriterOptions modelReaderWriterOptions, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } #pragma warning restore SAMPLE0009 // This generated code depends on experimental functionality. diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/ExperimentalSamplesGetAllAsyncCollectionResultOfT.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/ExperimentalSamplesGetAllAsyncCollectionResultOfT.cs index bf4c99cfe70..628f8dd7899 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/ExperimentalSamplesGetAllAsyncCollectionResultOfT.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/ExperimentalSamplesGetAllAsyncCollectionResultOfT.cs @@ -18,15 +18,18 @@ internal partial class ExperimentalSamplesGetAllAsyncCollectionResultOfT : Async #pragma warning disable SAMPLE0009 // This generated code depends on experimental functionality. private readonly ExperimentalSamples _client; #pragma warning restore SAMPLE0009 // This generated code depends on experimental functionality. + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly RequestOptions _options; /// Initializes a new instance of ExperimentalSamplesGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. /// The ExperimentalSamples client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// The request options, which can override default behaviors of the client pipeline on a per-call basis. #pragma warning disable SAMPLE0009 // This generated code depends on experimental functionality. - public ExperimentalSamplesGetAllAsyncCollectionResultOfT(ExperimentalSamples client, RequestOptions options) + public ExperimentalSamplesGetAllAsyncCollectionResultOfT(ExperimentalSamples client, ModelReaderWriterOptions modelReaderWriterOptions, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } #pragma warning restore SAMPLE0009 // This generated code depends on experimental functionality. @@ -57,7 +60,7 @@ public override ContinuationToken GetContinuationToken(ClientResult page) #pragma warning disable SAMPLE0009 // This generated code depends on experimental functionality. protected override async IAsyncEnumerable GetValuesFromPageAsync(ClientResult page) { - foreach (PreviewDetails item in ((PagePreviewDetails)page).Items) + foreach (PreviewDetails item in PagePreviewDetails.FromClientResult(page, _modelReaderWriterOptions).Items) { yield return item; await Task.Yield(); diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/ExperimentalSamplesGetAllCollectionResult.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/ExperimentalSamplesGetAllCollectionResult.cs index 240b3bec9f6..2b7962ff33b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/ExperimentalSamplesGetAllCollectionResult.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/ExperimentalSamplesGetAllCollectionResult.cs @@ -16,15 +16,18 @@ internal partial class ExperimentalSamplesGetAllCollectionResult : CollectionRes #pragma warning disable SAMPLE0009 // This generated code depends on experimental functionality. private readonly ExperimentalSamples _client; #pragma warning restore SAMPLE0009 // This generated code depends on experimental functionality. + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly RequestOptions _options; /// Initializes a new instance of ExperimentalSamplesGetAllCollectionResult, which is used to iterate over the pages of a collection. /// The ExperimentalSamples client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// The request options, which can override default behaviors of the client pipeline on a per-call basis. #pragma warning disable SAMPLE0009 // This generated code depends on experimental functionality. - public ExperimentalSamplesGetAllCollectionResult(ExperimentalSamples client, RequestOptions options) + public ExperimentalSamplesGetAllCollectionResult(ExperimentalSamples client, ModelReaderWriterOptions modelReaderWriterOptions, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } #pragma warning restore SAMPLE0009 // This generated code depends on experimental functionality. diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/ExperimentalSamplesGetAllCollectionResultOfT.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/ExperimentalSamplesGetAllCollectionResultOfT.cs index 2b869e36f2b..162465f2e08 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/ExperimentalSamplesGetAllCollectionResultOfT.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/ExperimentalSamplesGetAllCollectionResultOfT.cs @@ -17,15 +17,18 @@ internal partial class ExperimentalSamplesGetAllCollectionResultOfT : Collection #pragma warning disable SAMPLE0009 // This generated code depends on experimental functionality. private readonly ExperimentalSamples _client; #pragma warning restore SAMPLE0009 // This generated code depends on experimental functionality. + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly RequestOptions _options; /// Initializes a new instance of ExperimentalSamplesGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. /// The ExperimentalSamples client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// The request options, which can override default behaviors of the client pipeline on a per-call basis. #pragma warning disable SAMPLE0009 // This generated code depends on experimental functionality. - public ExperimentalSamplesGetAllCollectionResultOfT(ExperimentalSamples client, RequestOptions options) + public ExperimentalSamplesGetAllCollectionResultOfT(ExperimentalSamples client, ModelReaderWriterOptions modelReaderWriterOptions, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } #pragma warning restore SAMPLE0009 // This generated code depends on experimental functionality. @@ -56,7 +59,7 @@ public override ContinuationToken GetContinuationToken(ClientResult page) #pragma warning disable SAMPLE0009 // This generated code depends on experimental functionality. protected override IEnumerable GetValuesFromPage(ClientResult page) { - return ((PagePreviewDetails)page).Items; + return PagePreviewDetails.FromClientResult(page, _modelReaderWriterOptions).Items; } #pragma warning restore SAMPLE0009 // This generated code depends on experimental functionality. diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResult.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResult.cs index 5f90a26974c..cacfc0b1846 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResult.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResult.cs @@ -16,16 +16,19 @@ namespace SampleTypeSpec internal partial class SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResult : AsyncCollectionResult { private readonly SampleTypeSpecClient _client; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _token; private readonly RequestOptions _options; /// Initializes a new instance of SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResult, which is used to iterate over the pages of a collection. /// The SampleTypeSpecClient client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResult(SampleTypeSpecClient client, string token, RequestOptions options) + public SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResult(SampleTypeSpecClient client, ModelReaderWriterOptions modelReaderWriterOptions, string token, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _token = token; _options = options; } @@ -41,7 +44,7 @@ public override async IAsyncEnumerable GetRawPagesAsync() ClientResult result = await GetNextResponseAsync(message).ConfigureAwait(false); yield return result; - nextToken = ((ListWithContinuationTokenResult)result).NextToken; + nextToken = ListWithContinuationTokenResult.FromClientResult(result, _modelReaderWriterOptions).NextToken; if (string.IsNullOrEmpty(nextToken)) { yield break; @@ -55,7 +58,7 @@ public override async IAsyncEnumerable GetRawPagesAsync() /// The continuation token for the specified page. public override ContinuationToken GetContinuationToken(ClientResult page) { - string nextPage = ((ListWithContinuationTokenResult)page).NextToken; + string nextPage = ListWithContinuationTokenResult.FromClientResult(page, _modelReaderWriterOptions).NextToken; if (!string.IsNullOrEmpty(nextPage)) { return ContinuationToken.FromBytes(BinaryData.FromString(nextPage)); diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResultOfT.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResultOfT.cs index 8d9683bab41..5507f61a871 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResultOfT.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResultOfT.cs @@ -16,16 +16,19 @@ namespace SampleTypeSpec internal partial class SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResultOfT : AsyncCollectionResult { private readonly SampleTypeSpecClient _client; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _token; private readonly RequestOptions _options; /// Initializes a new instance of SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. /// The SampleTypeSpecClient client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResultOfT(SampleTypeSpecClient client, string token, RequestOptions options) + public SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResultOfT(SampleTypeSpecClient client, ModelReaderWriterOptions modelReaderWriterOptions, string token, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _token = token; _options = options; } @@ -41,7 +44,7 @@ public override async IAsyncEnumerable GetRawPagesAsync() ClientResult result = await GetNextResponseAsync(message).ConfigureAwait(false); yield return result; - nextToken = ((ListWithContinuationTokenResult)result).NextToken; + nextToken = ListWithContinuationTokenResult.FromClientResult(result, _modelReaderWriterOptions).NextToken; if (string.IsNullOrEmpty(nextToken)) { yield break; @@ -55,7 +58,7 @@ public override async IAsyncEnumerable GetRawPagesAsync() /// The continuation token for the specified page. public override ContinuationToken GetContinuationToken(ClientResult page) { - string nextPage = ((ListWithContinuationTokenResult)page).NextToken; + string nextPage = ListWithContinuationTokenResult.FromClientResult(page, _modelReaderWriterOptions).NextToken; if (!string.IsNullOrEmpty(nextPage)) { return ContinuationToken.FromBytes(BinaryData.FromString(nextPage)); @@ -71,7 +74,7 @@ public override ContinuationToken GetContinuationToken(ClientResult page) /// The values from the specified page. protected override async IAsyncEnumerable GetValuesFromPageAsync(ClientResult page) { - foreach (Thing item in ((ListWithContinuationTokenResult)page).Things) + foreach (Thing item in ListWithContinuationTokenResult.FromClientResult(page, _modelReaderWriterOptions).Things) { yield return item; await Task.Yield(); diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenCollectionResult.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenCollectionResult.cs index da17822ee6c..d98eceba304 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenCollectionResult.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenCollectionResult.cs @@ -15,16 +15,19 @@ namespace SampleTypeSpec internal partial class SampleTypeSpecClientGetWithContinuationTokenCollectionResult : CollectionResult { private readonly SampleTypeSpecClient _client; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _token; private readonly RequestOptions _options; /// Initializes a new instance of SampleTypeSpecClientGetWithContinuationTokenCollectionResult, which is used to iterate over the pages of a collection. /// The SampleTypeSpecClient client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SampleTypeSpecClientGetWithContinuationTokenCollectionResult(SampleTypeSpecClient client, string token, RequestOptions options) + public SampleTypeSpecClientGetWithContinuationTokenCollectionResult(SampleTypeSpecClient client, ModelReaderWriterOptions modelReaderWriterOptions, string token, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _token = token; _options = options; } @@ -40,7 +43,7 @@ public override IEnumerable GetRawPages() ClientResult result = GetNextResponse(message); yield return result; - nextToken = ((ListWithContinuationTokenResult)result).NextToken; + nextToken = ListWithContinuationTokenResult.FromClientResult(result, _modelReaderWriterOptions).NextToken; if (string.IsNullOrEmpty(nextToken)) { yield break; @@ -54,7 +57,7 @@ public override IEnumerable GetRawPages() /// The continuation token for the specified page. public override ContinuationToken GetContinuationToken(ClientResult page) { - string nextPage = ((ListWithContinuationTokenResult)page).NextToken; + string nextPage = ListWithContinuationTokenResult.FromClientResult(page, _modelReaderWriterOptions).NextToken; if (!string.IsNullOrEmpty(nextPage)) { return ContinuationToken.FromBytes(BinaryData.FromString(nextPage)); diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenCollectionResultOfT.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenCollectionResultOfT.cs index ab20b9a9354..9c35772ecf1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenCollectionResultOfT.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenCollectionResultOfT.cs @@ -15,16 +15,19 @@ namespace SampleTypeSpec internal partial class SampleTypeSpecClientGetWithContinuationTokenCollectionResultOfT : CollectionResult { private readonly SampleTypeSpecClient _client; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _token; private readonly RequestOptions _options; /// Initializes a new instance of SampleTypeSpecClientGetWithContinuationTokenCollectionResultOfT, which is used to iterate over the pages of a collection. /// The SampleTypeSpecClient client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SampleTypeSpecClientGetWithContinuationTokenCollectionResultOfT(SampleTypeSpecClient client, string token, RequestOptions options) + public SampleTypeSpecClientGetWithContinuationTokenCollectionResultOfT(SampleTypeSpecClient client, ModelReaderWriterOptions modelReaderWriterOptions, string token, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _token = token; _options = options; } @@ -40,7 +43,7 @@ public override IEnumerable GetRawPages() ClientResult result = GetNextResponse(message); yield return result; - nextToken = ((ListWithContinuationTokenResult)result).NextToken; + nextToken = ListWithContinuationTokenResult.FromClientResult(result, _modelReaderWriterOptions).NextToken; if (string.IsNullOrEmpty(nextToken)) { yield break; @@ -54,7 +57,7 @@ public override IEnumerable GetRawPages() /// The continuation token for the specified page. public override ContinuationToken GetContinuationToken(ClientResult page) { - string nextPage = ((ListWithContinuationTokenResult)page).NextToken; + string nextPage = ListWithContinuationTokenResult.FromClientResult(page, _modelReaderWriterOptions).NextToken; if (!string.IsNullOrEmpty(nextPage)) { return ContinuationToken.FromBytes(BinaryData.FromString(nextPage)); @@ -70,7 +73,7 @@ public override ContinuationToken GetContinuationToken(ClientResult page) /// The values from the specified page. protected override IEnumerable GetValuesFromPage(ClientResult page) { - return ((ListWithContinuationTokenResult)page).Things; + return ListWithContinuationTokenResult.FromClientResult(page, _modelReaderWriterOptions).Things; } /// Sends the request in the pipeline message and returns the response. diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResult.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResult.cs index d0de57b47ec..056ed8e2e30 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResult.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResult.cs @@ -16,16 +16,19 @@ namespace SampleTypeSpec internal partial class SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResult : AsyncCollectionResult { private readonly SampleTypeSpecClient _client; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _token; private readonly RequestOptions _options; /// Initializes a new instance of SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResult, which is used to iterate over the pages of a collection. /// The SampleTypeSpecClient client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResult(SampleTypeSpecClient client, string token, RequestOptions options) + public SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResult(SampleTypeSpecClient client, ModelReaderWriterOptions modelReaderWriterOptions, string token, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _token = token; _options = options; } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResultOfT.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResultOfT.cs index e234c85759e..8527bab5937 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResultOfT.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResultOfT.cs @@ -16,16 +16,19 @@ namespace SampleTypeSpec internal partial class SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResultOfT : AsyncCollectionResult { private readonly SampleTypeSpecClient _client; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _token; private readonly RequestOptions _options; /// Initializes a new instance of SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. /// The SampleTypeSpecClient client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResultOfT(SampleTypeSpecClient client, string token, RequestOptions options) + public SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResultOfT(SampleTypeSpecClient client, ModelReaderWriterOptions modelReaderWriterOptions, string token, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _token = token; _options = options; } @@ -73,7 +76,7 @@ public override ContinuationToken GetContinuationToken(ClientResult page) /// The values from the specified page. protected override async IAsyncEnumerable GetValuesFromPageAsync(ClientResult page) { - foreach (Thing item in ((ListWithContinuationTokenHeaderResponseResult)page).Things) + foreach (Thing item in ListWithContinuationTokenHeaderResponseResult.FromClientResult(page, _modelReaderWriterOptions).Things) { yield return item; await Task.Yield(); diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResult.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResult.cs index 7e8c2afe4c8..153a4f10835 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResult.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResult.cs @@ -15,16 +15,19 @@ namespace SampleTypeSpec internal partial class SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResult : CollectionResult { private readonly SampleTypeSpecClient _client; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _token; private readonly RequestOptions _options; /// Initializes a new instance of SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResult, which is used to iterate over the pages of a collection. /// The SampleTypeSpecClient client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResult(SampleTypeSpecClient client, string token, RequestOptions options) + public SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResult(SampleTypeSpecClient client, ModelReaderWriterOptions modelReaderWriterOptions, string token, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _token = token; _options = options; } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResultOfT.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResultOfT.cs index bc0cbbc2e7d..7f7b1a8c8cf 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResultOfT.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResultOfT.cs @@ -15,16 +15,19 @@ namespace SampleTypeSpec internal partial class SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResultOfT : CollectionResult { private readonly SampleTypeSpecClient _client; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly string _token; private readonly RequestOptions _options; /// Initializes a new instance of SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResultOfT, which is used to iterate over the pages of a collection. /// The SampleTypeSpecClient client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResultOfT(SampleTypeSpecClient client, string token, RequestOptions options) + public SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResultOfT(SampleTypeSpecClient client, ModelReaderWriterOptions modelReaderWriterOptions, string token, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _token = token; _options = options; } @@ -72,7 +75,7 @@ public override ContinuationToken GetContinuationToken(ClientResult page) /// The values from the specified page. protected override IEnumerable GetValuesFromPage(ClientResult page) { - return ((ListWithContinuationTokenHeaderResponseResult)page).Things; + return ListWithContinuationTokenHeaderResponseResult.FromClientResult(page, _modelReaderWriterOptions).Things; } /// Sends the request in the pipeline message and returns the response. diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithNextLinkAsyncCollectionResult.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithNextLinkAsyncCollectionResult.cs index b1a35c06dc3..16b95fc0377 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithNextLinkAsyncCollectionResult.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithNextLinkAsyncCollectionResult.cs @@ -16,14 +16,17 @@ namespace SampleTypeSpec internal partial class SampleTypeSpecClientGetWithNextLinkAsyncCollectionResult : AsyncCollectionResult { private readonly SampleTypeSpecClient _client; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly RequestOptions _options; /// Initializes a new instance of SampleTypeSpecClientGetWithNextLinkAsyncCollectionResult, which is used to iterate over the pages of a collection. /// The SampleTypeSpecClient client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SampleTypeSpecClientGetWithNextLinkAsyncCollectionResult(SampleTypeSpecClient client, RequestOptions options) + public SampleTypeSpecClientGetWithNextLinkAsyncCollectionResult(SampleTypeSpecClient client, ModelReaderWriterOptions modelReaderWriterOptions, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -38,7 +41,7 @@ public override async IAsyncEnumerable GetRawPagesAsync() ClientResult result = await GetNextResponseAsync(message).ConfigureAwait(false); yield return result; - nextPageUri = ((ListWithNextLinkResult)result).Next; + nextPageUri = ListWithNextLinkResult.FromClientResult(result, _modelReaderWriterOptions).Next; if (nextPageUri == null) { yield break; @@ -52,7 +55,7 @@ public override async IAsyncEnumerable GetRawPagesAsync() /// The continuation token for the specified page. public override ContinuationToken GetContinuationToken(ClientResult page) { - Uri nextPage = ((ListWithNextLinkResult)page).Next; + Uri nextPage = ListWithNextLinkResult.FromClientResult(page, _modelReaderWriterOptions).Next; if (nextPage != null) { return ContinuationToken.FromBytes(BinaryData.FromString(nextPage.IsAbsoluteUri ? nextPage.AbsoluteUri : nextPage.OriginalString)); diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithNextLinkAsyncCollectionResultOfT.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithNextLinkAsyncCollectionResultOfT.cs index 77f0df84b9f..4d594a30cd3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithNextLinkAsyncCollectionResultOfT.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithNextLinkAsyncCollectionResultOfT.cs @@ -16,14 +16,17 @@ namespace SampleTypeSpec internal partial class SampleTypeSpecClientGetWithNextLinkAsyncCollectionResultOfT : AsyncCollectionResult { private readonly SampleTypeSpecClient _client; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly RequestOptions _options; /// Initializes a new instance of SampleTypeSpecClientGetWithNextLinkAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. /// The SampleTypeSpecClient client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SampleTypeSpecClientGetWithNextLinkAsyncCollectionResultOfT(SampleTypeSpecClient client, RequestOptions options) + public SampleTypeSpecClientGetWithNextLinkAsyncCollectionResultOfT(SampleTypeSpecClient client, ModelReaderWriterOptions modelReaderWriterOptions, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -38,7 +41,7 @@ public override async IAsyncEnumerable GetRawPagesAsync() ClientResult result = await GetNextResponseAsync(message).ConfigureAwait(false); yield return result; - nextPageUri = ((ListWithNextLinkResult)result).Next; + nextPageUri = ListWithNextLinkResult.FromClientResult(result, _modelReaderWriterOptions).Next; if (nextPageUri == null) { yield break; @@ -52,7 +55,7 @@ public override async IAsyncEnumerable GetRawPagesAsync() /// The continuation token for the specified page. public override ContinuationToken GetContinuationToken(ClientResult page) { - Uri nextPage = ((ListWithNextLinkResult)page).Next; + Uri nextPage = ListWithNextLinkResult.FromClientResult(page, _modelReaderWriterOptions).Next; if (nextPage != null) { return ContinuationToken.FromBytes(BinaryData.FromString(nextPage.IsAbsoluteUri ? nextPage.AbsoluteUri : nextPage.OriginalString)); @@ -68,7 +71,7 @@ public override ContinuationToken GetContinuationToken(ClientResult page) /// The values from the specified page. protected override async IAsyncEnumerable GetValuesFromPageAsync(ClientResult page) { - foreach (Thing item in ((ListWithNextLinkResult)page).Things) + foreach (Thing item in ListWithNextLinkResult.FromClientResult(page, _modelReaderWriterOptions).Things) { yield return item; await Task.Yield(); diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithNextLinkCollectionResult.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithNextLinkCollectionResult.cs index e9b516f5892..308c01b5cb5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithNextLinkCollectionResult.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithNextLinkCollectionResult.cs @@ -15,14 +15,17 @@ namespace SampleTypeSpec internal partial class SampleTypeSpecClientGetWithNextLinkCollectionResult : CollectionResult { private readonly SampleTypeSpecClient _client; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly RequestOptions _options; /// Initializes a new instance of SampleTypeSpecClientGetWithNextLinkCollectionResult, which is used to iterate over the pages of a collection. /// The SampleTypeSpecClient client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SampleTypeSpecClientGetWithNextLinkCollectionResult(SampleTypeSpecClient client, RequestOptions options) + public SampleTypeSpecClientGetWithNextLinkCollectionResult(SampleTypeSpecClient client, ModelReaderWriterOptions modelReaderWriterOptions, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -37,7 +40,7 @@ public override IEnumerable GetRawPages() ClientResult result = GetNextResponse(message); yield return result; - nextPageUri = ((ListWithNextLinkResult)result).Next; + nextPageUri = ListWithNextLinkResult.FromClientResult(result, _modelReaderWriterOptions).Next; if (nextPageUri == null) { yield break; @@ -51,7 +54,7 @@ public override IEnumerable GetRawPages() /// The continuation token for the specified page. public override ContinuationToken GetContinuationToken(ClientResult page) { - Uri nextPage = ((ListWithNextLinkResult)page).Next; + Uri nextPage = ListWithNextLinkResult.FromClientResult(page, _modelReaderWriterOptions).Next; if (nextPage != null) { return ContinuationToken.FromBytes(BinaryData.FromString(nextPage.IsAbsoluteUri ? nextPage.AbsoluteUri : nextPage.OriginalString)); diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithNextLinkCollectionResultOfT.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithNextLinkCollectionResultOfT.cs index 651d9e3487f..6ff9bfdaad7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithNextLinkCollectionResultOfT.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithNextLinkCollectionResultOfT.cs @@ -15,14 +15,17 @@ namespace SampleTypeSpec internal partial class SampleTypeSpecClientGetWithNextLinkCollectionResultOfT : CollectionResult { private readonly SampleTypeSpecClient _client; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly RequestOptions _options; /// Initializes a new instance of SampleTypeSpecClientGetWithNextLinkCollectionResultOfT, which is used to iterate over the pages of a collection. /// The SampleTypeSpecClient client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SampleTypeSpecClientGetWithNextLinkCollectionResultOfT(SampleTypeSpecClient client, RequestOptions options) + public SampleTypeSpecClientGetWithNextLinkCollectionResultOfT(SampleTypeSpecClient client, ModelReaderWriterOptions modelReaderWriterOptions, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -37,7 +40,7 @@ public override IEnumerable GetRawPages() ClientResult result = GetNextResponse(message); yield return result; - nextPageUri = ((ListWithNextLinkResult)result).Next; + nextPageUri = ListWithNextLinkResult.FromClientResult(result, _modelReaderWriterOptions).Next; if (nextPageUri == null) { yield break; @@ -51,7 +54,7 @@ public override IEnumerable GetRawPages() /// The continuation token for the specified page. public override ContinuationToken GetContinuationToken(ClientResult page) { - Uri nextPage = ((ListWithNextLinkResult)page).Next; + Uri nextPage = ListWithNextLinkResult.FromClientResult(page, _modelReaderWriterOptions).Next; if (nextPage != null) { return ContinuationToken.FromBytes(BinaryData.FromString(nextPage.IsAbsoluteUri ? nextPage.AbsoluteUri : nextPage.OriginalString)); @@ -67,7 +70,7 @@ public override ContinuationToken GetContinuationToken(ClientResult page) /// The values from the specified page. protected override IEnumerable GetValuesFromPage(ClientResult page) { - return ((ListWithNextLinkResult)page).Things; + return ListWithNextLinkResult.FromClientResult(page, _modelReaderWriterOptions).Things; } /// Sends the request in the pipeline message and returns the response. diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithPagingAsyncCollectionResult.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithPagingAsyncCollectionResult.cs index da4c0c20dc0..0c467e33857 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithPagingAsyncCollectionResult.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithPagingAsyncCollectionResult.cs @@ -15,14 +15,17 @@ namespace SampleTypeSpec internal partial class SampleTypeSpecClientGetWithPagingAsyncCollectionResult : AsyncCollectionResult { private readonly SampleTypeSpecClient _client; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly RequestOptions _options; /// Initializes a new instance of SampleTypeSpecClientGetWithPagingAsyncCollectionResult, which is used to iterate over the pages of a collection. /// The SampleTypeSpecClient client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SampleTypeSpecClientGetWithPagingAsyncCollectionResult(SampleTypeSpecClient client, RequestOptions options) + public SampleTypeSpecClientGetWithPagingAsyncCollectionResult(SampleTypeSpecClient client, ModelReaderWriterOptions modelReaderWriterOptions, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithPagingAsyncCollectionResultOfT.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithPagingAsyncCollectionResultOfT.cs index aa1a1cdf328..11b3d19cbdd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithPagingAsyncCollectionResultOfT.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithPagingAsyncCollectionResultOfT.cs @@ -15,14 +15,17 @@ namespace SampleTypeSpec internal partial class SampleTypeSpecClientGetWithPagingAsyncCollectionResultOfT : AsyncCollectionResult { private readonly SampleTypeSpecClient _client; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly RequestOptions _options; /// Initializes a new instance of SampleTypeSpecClientGetWithPagingAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. /// The SampleTypeSpecClient client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SampleTypeSpecClientGetWithPagingAsyncCollectionResultOfT(SampleTypeSpecClient client, RequestOptions options) + public SampleTypeSpecClientGetWithPagingAsyncCollectionResultOfT(SampleTypeSpecClient client, ModelReaderWriterOptions modelReaderWriterOptions, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -47,7 +50,7 @@ public override ContinuationToken GetContinuationToken(ClientResult page) /// The values from the specified page. protected override async IAsyncEnumerable GetValuesFromPageAsync(ClientResult page) { - foreach (Thing item in ((PageThing)page).Items) + foreach (Thing item in PageThing.FromClientResult(page, _modelReaderWriterOptions).Items) { yield return item; await Task.Yield(); diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithPagingCollectionResult.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithPagingCollectionResult.cs index 42a964869c8..348ae2759b5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithPagingCollectionResult.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithPagingCollectionResult.cs @@ -14,14 +14,17 @@ namespace SampleTypeSpec internal partial class SampleTypeSpecClientGetWithPagingCollectionResult : CollectionResult { private readonly SampleTypeSpecClient _client; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly RequestOptions _options; /// Initializes a new instance of SampleTypeSpecClientGetWithPagingCollectionResult, which is used to iterate over the pages of a collection. /// The SampleTypeSpecClient client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SampleTypeSpecClientGetWithPagingCollectionResult(SampleTypeSpecClient client, RequestOptions options) + public SampleTypeSpecClientGetWithPagingCollectionResult(SampleTypeSpecClient client, ModelReaderWriterOptions modelReaderWriterOptions, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithPagingCollectionResultOfT.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithPagingCollectionResultOfT.cs index fb3d1444543..7cf2649300f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithPagingCollectionResultOfT.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithPagingCollectionResultOfT.cs @@ -14,14 +14,17 @@ namespace SampleTypeSpec internal partial class SampleTypeSpecClientGetWithPagingCollectionResultOfT : CollectionResult { private readonly SampleTypeSpecClient _client; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly RequestOptions _options; /// Initializes a new instance of SampleTypeSpecClientGetWithPagingCollectionResultOfT, which is used to iterate over the pages of a collection. /// The SampleTypeSpecClient client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SampleTypeSpecClientGetWithPagingCollectionResultOfT(SampleTypeSpecClient client, RequestOptions options) + public SampleTypeSpecClientGetWithPagingCollectionResultOfT(SampleTypeSpecClient client, ModelReaderWriterOptions modelReaderWriterOptions, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -46,7 +49,7 @@ public override ContinuationToken GetContinuationToken(ClientResult page) /// The values from the specified page. protected override IEnumerable GetValuesFromPage(ClientResult page) { - return ((PageThing)page).Items; + return PageThing.FromClientResult(page, _modelReaderWriterOptions).Items; } /// Sends the request in the pipeline message and returns the response. diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResult.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResult.cs index f41c7b3d264..e3389166c14 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResult.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResult.cs @@ -16,14 +16,17 @@ namespace SampleTypeSpec internal partial class SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResult : AsyncCollectionResult { private readonly SampleTypeSpecClient _client; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly RequestOptions _options; /// Initializes a new instance of SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResult, which is used to iterate over the pages of a collection. /// The SampleTypeSpecClient client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResult(SampleTypeSpecClient client, RequestOptions options) + public SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResult(SampleTypeSpecClient client, ModelReaderWriterOptions modelReaderWriterOptions, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -38,7 +41,7 @@ public override async IAsyncEnumerable GetRawPagesAsync() ClientResult result = await GetNextResponseAsync(message).ConfigureAwait(false); yield return result; - string nextPageString = ((ListWithStringNextLinkResult)result).Next; + string nextPageString = ListWithStringNextLinkResult.FromClientResult(result, _modelReaderWriterOptions).Next; if (string.IsNullOrEmpty(nextPageString)) { yield break; @@ -53,7 +56,7 @@ public override async IAsyncEnumerable GetRawPagesAsync() /// The continuation token for the specified page. public override ContinuationToken GetContinuationToken(ClientResult page) { - string nextPage = ((ListWithStringNextLinkResult)page).Next; + string nextPage = ListWithStringNextLinkResult.FromClientResult(page, _modelReaderWriterOptions).Next; if (!string.IsNullOrEmpty(nextPage)) { return ContinuationToken.FromBytes(BinaryData.FromString(nextPage)); diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResultOfT.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResultOfT.cs index 7f48abdf7f7..66f6e6203b6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResultOfT.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResultOfT.cs @@ -16,14 +16,17 @@ namespace SampleTypeSpec internal partial class SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResultOfT : AsyncCollectionResult { private readonly SampleTypeSpecClient _client; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly RequestOptions _options; /// Initializes a new instance of SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. /// The SampleTypeSpecClient client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResultOfT(SampleTypeSpecClient client, RequestOptions options) + public SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResultOfT(SampleTypeSpecClient client, ModelReaderWriterOptions modelReaderWriterOptions, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -38,7 +41,7 @@ public override async IAsyncEnumerable GetRawPagesAsync() ClientResult result = await GetNextResponseAsync(message).ConfigureAwait(false); yield return result; - string nextPageString = ((ListWithStringNextLinkResult)result).Next; + string nextPageString = ListWithStringNextLinkResult.FromClientResult(result, _modelReaderWriterOptions).Next; if (string.IsNullOrEmpty(nextPageString)) { yield break; @@ -53,7 +56,7 @@ public override async IAsyncEnumerable GetRawPagesAsync() /// The continuation token for the specified page. public override ContinuationToken GetContinuationToken(ClientResult page) { - string nextPage = ((ListWithStringNextLinkResult)page).Next; + string nextPage = ListWithStringNextLinkResult.FromClientResult(page, _modelReaderWriterOptions).Next; if (!string.IsNullOrEmpty(nextPage)) { return ContinuationToken.FromBytes(BinaryData.FromString(nextPage)); @@ -69,7 +72,7 @@ public override ContinuationToken GetContinuationToken(ClientResult page) /// The values from the specified page. protected override async IAsyncEnumerable GetValuesFromPageAsync(ClientResult page) { - foreach (Thing item in ((ListWithStringNextLinkResult)page).Things) + foreach (Thing item in ListWithStringNextLinkResult.FromClientResult(page, _modelReaderWriterOptions).Things) { yield return item; await Task.Yield(); diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithStringNextLinkCollectionResult.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithStringNextLinkCollectionResult.cs index 1da5ae62fa4..408882693e6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithStringNextLinkCollectionResult.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithStringNextLinkCollectionResult.cs @@ -15,14 +15,17 @@ namespace SampleTypeSpec internal partial class SampleTypeSpecClientGetWithStringNextLinkCollectionResult : CollectionResult { private readonly SampleTypeSpecClient _client; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly RequestOptions _options; /// Initializes a new instance of SampleTypeSpecClientGetWithStringNextLinkCollectionResult, which is used to iterate over the pages of a collection. /// The SampleTypeSpecClient client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SampleTypeSpecClientGetWithStringNextLinkCollectionResult(SampleTypeSpecClient client, RequestOptions options) + public SampleTypeSpecClientGetWithStringNextLinkCollectionResult(SampleTypeSpecClient client, ModelReaderWriterOptions modelReaderWriterOptions, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -37,7 +40,7 @@ public override IEnumerable GetRawPages() ClientResult result = GetNextResponse(message); yield return result; - string nextPageString = ((ListWithStringNextLinkResult)result).Next; + string nextPageString = ListWithStringNextLinkResult.FromClientResult(result, _modelReaderWriterOptions).Next; if (string.IsNullOrEmpty(nextPageString)) { yield break; @@ -52,7 +55,7 @@ public override IEnumerable GetRawPages() /// The continuation token for the specified page. public override ContinuationToken GetContinuationToken(ClientResult page) { - string nextPage = ((ListWithStringNextLinkResult)page).Next; + string nextPage = ListWithStringNextLinkResult.FromClientResult(page, _modelReaderWriterOptions).Next; if (!string.IsNullOrEmpty(nextPage)) { return ContinuationToken.FromBytes(BinaryData.FromString(nextPage)); diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithStringNextLinkCollectionResultOfT.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithStringNextLinkCollectionResultOfT.cs index 462d2612bed..d132b4d7520 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithStringNextLinkCollectionResultOfT.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/CollectionResults/SampleTypeSpecClientGetWithStringNextLinkCollectionResultOfT.cs @@ -15,14 +15,17 @@ namespace SampleTypeSpec internal partial class SampleTypeSpecClientGetWithStringNextLinkCollectionResultOfT : CollectionResult { private readonly SampleTypeSpecClient _client; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions; private readonly RequestOptions _options; /// Initializes a new instance of SampleTypeSpecClientGetWithStringNextLinkCollectionResultOfT, which is used to iterate over the pages of a collection. /// The SampleTypeSpecClient client used to send requests. + /// The options used to read the pages, including the model proxies configured on the client options. /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SampleTypeSpecClientGetWithStringNextLinkCollectionResultOfT(SampleTypeSpecClient client, RequestOptions options) + public SampleTypeSpecClientGetWithStringNextLinkCollectionResultOfT(SampleTypeSpecClient client, ModelReaderWriterOptions modelReaderWriterOptions, RequestOptions options) { _client = client; + _modelReaderWriterOptions = modelReaderWriterOptions; _options = options; } @@ -37,7 +40,7 @@ public override IEnumerable GetRawPages() ClientResult result = GetNextResponse(message); yield return result; - string nextPageString = ((ListWithStringNextLinkResult)result).Next; + string nextPageString = ListWithStringNextLinkResult.FromClientResult(result, _modelReaderWriterOptions).Next; if (string.IsNullOrEmpty(nextPageString)) { yield break; @@ -52,7 +55,7 @@ public override IEnumerable GetRawPages() /// The continuation token for the specified page. public override ContinuationToken GetContinuationToken(ClientResult page) { - string nextPage = ((ListWithStringNextLinkResult)page).Next; + string nextPage = ListWithStringNextLinkResult.FromClientResult(page, _modelReaderWriterOptions).Next; if (!string.IsNullOrEmpty(nextPage)) { return ContinuationToken.FromBytes(BinaryData.FromString(nextPage)); @@ -68,7 +71,7 @@ public override ContinuationToken GetContinuationToken(ClientResult page) /// The values from the specified page. protected override IEnumerable GetValuesFromPage(ClientResult page) { - return ((ListWithStringNextLinkResult)page).Things; + return ListWithStringNextLinkResult.FromClientResult(page, _modelReaderWriterOptions).Things; } /// Sends the request in the pipeline message and returns the response. diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/ConstructorRequirements.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/ConstructorRequirements.cs index b7ea0033613..0c21199cffc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/ConstructorRequirements.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/ConstructorRequirements.cs @@ -17,6 +17,7 @@ namespace SampleTypeSpec public partial class ConstructorRequirements { private readonly Uri _endpoint; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions = ModelSerializationExtensions.WireOptions; /// Initializes a new instance of ConstructorRequirements for mocking. protected ConstructorRequirements() @@ -25,11 +26,13 @@ protected ConstructorRequirements() /// Initializes a new instance of ConstructorRequirements. /// The HTTP pipeline for sending and receiving REST requests and responses. + /// /// Service endpoint. - internal ConstructorRequirements(ClientPipeline pipeline, Uri endpoint) + internal ConstructorRequirements(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) { _endpoint = endpoint; Pipeline = pipeline; + _modelReaderWriterOptions = modelReaderWriterOptions; } /// The HTTP pipeline for sending and receiving REST requests and responses. @@ -86,7 +89,7 @@ public virtual ClientResult Send(ConstructorOverride body, CancellationToken can { Argument.AssertNotNull(body, nameof(body)); - return Send(body, cancellationToken.ToRequestOptions()); + return Send(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); } /// Send. @@ -98,7 +101,7 @@ public virtual async Task SendAsync(ConstructorOverride body, Canc { Argument.AssertNotNull(body, nameof(body)); - return await SendAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return await SendAsync(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); } /// @@ -152,7 +155,7 @@ public virtual ClientResult SendReadOnly(ConstructorReadOnlyOverride body, Cance { Argument.AssertNotNull(body, nameof(body)); - return SendReadOnly(body, cancellationToken.ToRequestOptions()); + return SendReadOnly(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); } /// SendReadOnly. @@ -164,7 +167,7 @@ public virtual async Task SendReadOnlyAsync(ConstructorReadOnlyOve { Argument.AssertNotNull(body, nameof(body)); - return await SendReadOnlyAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return await SendReadOnlyAsync(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); } /// @@ -218,7 +221,7 @@ public virtual ClientResult SendReadOnlyLeaf(ConstructorReadOnlyLeaf body, Cance { Argument.AssertNotNull(body, nameof(body)); - return SendReadOnlyLeaf(body, cancellationToken.ToRequestOptions()); + return SendReadOnlyLeaf(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); } /// SendReadOnlyLeaf. @@ -230,7 +233,7 @@ public virtual async Task SendReadOnlyLeafAsync(ConstructorReadOnl { Argument.AssertNotNull(body, nameof(body)); - return await SendReadOnlyLeafAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return await SendReadOnlyLeafAsync(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); } /// @@ -284,7 +287,7 @@ public virtual ClientResult SendXml(XmlConstructorOverride body, CancellationTok { Argument.AssertNotNull(body, nameof(body)); - return SendXml(body, cancellationToken.ToRequestOptions()); + return SendXml(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); } /// SendXml. @@ -296,7 +299,7 @@ public virtual async Task SendXmlAsync(XmlConstructorOverride body { Argument.AssertNotNull(body, nameof(body)); - return await SendXmlAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return await SendXmlAsync(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); } /// @@ -350,7 +353,7 @@ public virtual ClientResult SendInheritedLeaf(ConstructorInheritedLeaf body, Can { Argument.AssertNotNull(body, nameof(body)); - return SendInheritedLeaf(body, cancellationToken.ToRequestOptions()); + return SendInheritedLeaf(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); } /// SendInheritedLeaf. @@ -362,7 +365,7 @@ public virtual async Task SendInheritedLeafAsync(ConstructorInheri { Argument.AssertNotNull(body, nameof(body)); - return await SendInheritedLeafAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return await SendInheritedLeafAsync(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); } /// @@ -416,7 +419,7 @@ public virtual ClientResult SendRenamed(RenamedConstructorOverride body, Cancell { Argument.AssertNotNull(body, nameof(body)); - return SendRenamed(body, cancellationToken.ToRequestOptions()); + return SendRenamed(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); } /// SendRenamed. @@ -428,7 +431,7 @@ public virtual async Task SendRenamedAsync(RenamedConstructorOverr { Argument.AssertNotNull(body, nameof(body)); - return await SendRenamedAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return await SendRenamedAsync(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); } /// @@ -482,7 +485,7 @@ public virtual ClientResult SendRenamedLeaf(RenamedConstructorLeaf body, Cancell { Argument.AssertNotNull(body, nameof(body)); - return SendRenamedLeaf(body, cancellationToken.ToRequestOptions()); + return SendRenamedLeaf(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); } /// SendRenamedLeaf. @@ -494,7 +497,7 @@ public virtual async Task SendRenamedLeafAsync(RenamedConstructorL { Argument.AssertNotNull(body, nameof(body)); - return await SendRenamedLeafAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return await SendRenamedLeafAsync(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); } /// @@ -548,7 +551,7 @@ public virtual ClientResult SendWritableLeaf(ConstructorWritableLeaf body, Cance { Argument.AssertNotNull(body, nameof(body)); - return SendWritableLeaf(body, cancellationToken.ToRequestOptions()); + return SendWritableLeaf(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); } /// SendWritableLeaf. @@ -560,7 +563,7 @@ public virtual async Task SendWritableLeafAsync(ConstructorWritabl { Argument.AssertNotNull(body, nameof(body)); - return await SendWritableLeafAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return await SendWritableLeafAsync(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); } /// @@ -614,7 +617,7 @@ public virtual ClientResult SendReturnedName(RenamedConstructorReturnedName body { Argument.AssertNotNull(body, nameof(body)); - return SendReturnedName(body, cancellationToken.ToRequestOptions()); + return SendReturnedName(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); } /// SendReturnedName. @@ -626,7 +629,7 @@ public virtual async Task SendReturnedNameAsync(RenamedConstructor { Argument.AssertNotNull(body, nameof(body)); - return await SendReturnedNameAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return await SendReturnedNameAsync(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); } /// @@ -680,7 +683,7 @@ public virtual ClientResult SendRequiredRenamed(RequiredRenamedConstructorOverri { Argument.AssertNotNull(body, nameof(body)); - return SendRequiredRenamed(body, cancellationToken.ToRequestOptions()); + return SendRequiredRenamed(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); } /// SendRequiredRenamed. @@ -692,7 +695,7 @@ public virtual async Task SendRequiredRenamedAsync(RequiredRenamed { Argument.AssertNotNull(body, nameof(body)); - return await SendRequiredRenamedAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return await SendRequiredRenamedAsync(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); } /// @@ -746,7 +749,7 @@ public virtual ClientResult SendReadOnlyCollections(ConstructorReadOnlyCollectio { Argument.AssertNotNull(body, nameof(body)); - return SendReadOnlyCollections(body, cancellationToken.ToRequestOptions()); + return SendReadOnlyCollections(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); } /// SendReadOnlyCollections. @@ -758,7 +761,7 @@ public virtual async Task SendReadOnlyCollectionsAsync(Constructor { Argument.AssertNotNull(body, nameof(body)); - return await SendReadOnlyCollectionsAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return await SendReadOnlyCollectionsAsync(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); } /// @@ -812,7 +815,7 @@ public virtual ClientResult SendRequiredCollections(ConstructorRequiredCollectio { Argument.AssertNotNull(body, nameof(body)); - return SendRequiredCollections(body, cancellationToken.ToRequestOptions()); + return SendRequiredCollections(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); } /// SendRequiredCollections. @@ -824,7 +827,7 @@ public virtual async Task SendRequiredCollectionsAsync(Constructor { Argument.AssertNotNull(body, nameof(body)); - return await SendRequiredCollectionsAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return await SendRequiredCollectionsAsync(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); } /// @@ -878,8 +881,8 @@ public virtual ClientResult SendRenamedLitera { Argument.AssertNotNull(body, nameof(body)); - ClientResult result = SendRenamedLiteral(body, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((RenamedLiteralConstructorOverride)result, result.GetRawResponse()); + ClientResult result = SendRenamedLiteral(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); + return ClientResult.FromValue(RenamedLiteralConstructorOverride.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// SendRenamedLiteral. @@ -891,8 +894,8 @@ public virtual async Task> SendR { Argument.AssertNotNull(body, nameof(body)); - ClientResult result = await SendRenamedLiteralAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((RenamedLiteralConstructorOverride)result, result.GetRawResponse()); + ClientResult result = await SendRenamedLiteralAsync(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue(RenamedLiteralConstructorOverride.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -946,8 +949,8 @@ public virtual ClientResult SendClientNameCo { Argument.AssertNotNull(body, nameof(body)); - ClientResult result = SendClientNameCollision(body, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((ConstructorClientNameCollisionLeaf)result, result.GetRawResponse()); + ClientResult result = SendClientNameCollision(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); + return ClientResult.FromValue(ConstructorClientNameCollisionLeaf.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// SendClientNameCollision. @@ -959,8 +962,8 @@ public virtual async Task> Send { Argument.AssertNotNull(body, nameof(body)); - ClientResult result = await SendClientNameCollisionAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((ConstructorClientNameCollisionLeaf)result, result.GetRawResponse()); + ClientResult result = await SendClientNameCollisionAsync(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue(ConstructorClientNameCollisionLeaf.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/DogOperations.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/DogOperations.cs index a45d14cb50f..0cf0d310123 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/DogOperations.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/DogOperations.cs @@ -17,6 +17,7 @@ namespace SampleTypeSpec public partial class DogOperations { private readonly Uri _endpoint; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions = ModelSerializationExtensions.WireOptions; /// Initializes a new instance of DogOperations for mocking. protected DogOperations() @@ -25,11 +26,13 @@ protected DogOperations() /// Initializes a new instance of DogOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. + /// /// Service endpoint. - internal DogOperations(ClientPipeline pipeline, Uri endpoint) + internal DogOperations(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) { _endpoint = endpoint; Pipeline = pipeline; + _modelReaderWriterOptions = modelReaderWriterOptions; } /// The HTTP pipeline for sending and receiving REST requests and responses. @@ -86,8 +89,8 @@ public virtual ClientResult UpdateDogAsDog(Dog dog, CancellationToken cance { Argument.AssertNotNull(dog, nameof(dog)); - ClientResult result = UpdateDogAsDog(dog, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((Dog)result, result.GetRawResponse()); + ClientResult result = UpdateDogAsDog(dog.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); + return ClientResult.FromValue(Dog.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Update a dog as a dog. @@ -99,8 +102,8 @@ public virtual async Task> UpdateDogAsDogAsync(Dog dog, Cancel { Argument.AssertNotNull(dog, nameof(dog)); - ClientResult result = await UpdateDogAsDogAsync(dog, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((Dog)result, result.GetRawResponse()); + ClientResult result = await UpdateDogAsDogAsync(dog.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue(Dog.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/ExperimentalSamples.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/ExperimentalSamples.cs index 79f25e0d36c..526982dbb88 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/ExperimentalSamples.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/ExperimentalSamples.cs @@ -19,6 +19,7 @@ namespace SampleTypeSpec public partial class ExperimentalSamples { private readonly Uri _endpoint; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions = ModelSerializationExtensions.WireOptions; /// Initializes a new instance of ExperimentalSamples for mocking. protected ExperimentalSamples() @@ -27,11 +28,13 @@ protected ExperimentalSamples() /// Initializes a new instance of ExperimentalSamples. /// The HTTP pipeline for sending and receiving REST requests and responses. + /// /// Service endpoint. - internal ExperimentalSamples(ClientPipeline pipeline, Uri endpoint) + internal ExperimentalSamples(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) { _endpoint = endpoint; Pipeline = pipeline; + _modelReaderWriterOptions = modelReaderWriterOptions; } /// The HTTP pipeline for sending and receiving REST requests and responses. @@ -77,7 +80,7 @@ public virtual async Task ReadAsync(RequestOptions options) public virtual ClientResult Read(CancellationToken cancellationToken = default) { ClientResult result = Read(cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((LifecycleModel)result, result.GetRawResponse()); + return ClientResult.FromValue(LifecycleModel.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Read. @@ -86,7 +89,7 @@ public virtual ClientResult Read(CancellationToken cancellationT public virtual async Task> ReadAsync(CancellationToken cancellationToken = default) { ClientResult result = await ReadAsync(cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((LifecycleModel)result, result.GetRawResponse()); + return ClientResult.FromValue(LifecycleModel.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -102,7 +105,7 @@ public virtual async Task> ReadAsync(CancellationTo /// The response returned from the service. public virtual CollectionResult GetAll(RequestOptions options) { - return new ExperimentalSamplesGetAllCollectionResult(this, options); + return new ExperimentalSamplesGetAllCollectionResult(this, _modelReaderWriterOptions, options); } /// @@ -118,7 +121,7 @@ public virtual CollectionResult GetAll(RequestOptions options) /// The response returned from the service. public virtual AsyncCollectionResult GetAllAsync(RequestOptions options) { - return new ExperimentalSamplesGetAllAsyncCollectionResult(this, options); + return new ExperimentalSamplesGetAllAsyncCollectionResult(this, _modelReaderWriterOptions, options); } /// GetAll. @@ -127,7 +130,7 @@ public virtual AsyncCollectionResult GetAllAsync(RequestOptions options) #pragma warning disable SAMPLE0003 // This generated code depends on experimental functionality. public virtual CollectionResult GetAll(CancellationToken cancellationToken = default) { - return new ExperimentalSamplesGetAllCollectionResultOfT(this, cancellationToken.ToRequestOptions()); + return new ExperimentalSamplesGetAllCollectionResultOfT(this, _modelReaderWriterOptions, cancellationToken.ToRequestOptions()); } #pragma warning restore SAMPLE0003 // This generated code depends on experimental functionality. @@ -137,7 +140,7 @@ public virtual CollectionResult GetAll(CancellationToken cancell #pragma warning disable SAMPLE0003 // This generated code depends on experimental functionality. public virtual AsyncCollectionResult GetAllAsync(CancellationToken cancellationToken = default) { - return new ExperimentalSamplesGetAllAsyncCollectionResultOfT(this, cancellationToken.ToRequestOptions()); + return new ExperimentalSamplesGetAllAsyncCollectionResultOfT(this, _modelReaderWriterOptions, cancellationToken.ToRequestOptions()); } #pragma warning restore SAMPLE0003 // This generated code depends on experimental functionality. } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Internal/BinaryContentHelper.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Internal/BinaryContentHelper.cs index b76cf24aa37..05dd6f65630 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Internal/BinaryContentHelper.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Internal/BinaryContentHelper.cs @@ -7,6 +7,7 @@ using System; using System.ClientModel; +using System.ClientModel.Primitives; using System.Collections.Generic; using System.IO; using System.Text.Json; @@ -17,14 +18,16 @@ namespace SampleTypeSpec internal static partial class BinaryContentHelper { /// - public static BinaryContent FromEnumerable(IEnumerable enumerable) + /// + public static BinaryContent FromEnumerable(IEnumerable enumerable, ModelReaderWriterOptions options = null) where T : notnull { + options ??= ModelSerializationExtensions.WireOptions; Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); content.JsonWriter.WriteStartArray(); foreach (var item in enumerable) { - content.JsonWriter.WriteObjectValue(item, ModelSerializationExtensions.WireOptions); + content.JsonWriter.WriteObjectValue(item, options); } content.JsonWriter.WriteEndArray(); @@ -60,15 +63,17 @@ public static BinaryContent FromEnumerable(IEnumerable enumerable) } /// - public static BinaryContent FromEnumerable(ReadOnlySpan span) + /// + public static BinaryContent FromEnumerable(ReadOnlySpan span, ModelReaderWriterOptions options = null) where T : notnull { + options ??= ModelSerializationExtensions.WireOptions; Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); content.JsonWriter.WriteStartArray(); int i = 0; for (; i < span.Length; i++) { - content.JsonWriter.WriteObjectValue(span[i], ModelSerializationExtensions.WireOptions); + content.JsonWriter.WriteObjectValue(span[i], options); } content.JsonWriter.WriteEndArray(); @@ -76,15 +81,17 @@ public static BinaryContent FromEnumerable(ReadOnlySpan span) } /// - public static BinaryContent FromDictionary(IDictionary dictionary) + /// + public static BinaryContent FromDictionary(IDictionary dictionary, ModelReaderWriterOptions options = null) where TValue : notnull { + options ??= ModelSerializationExtensions.WireOptions; Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); content.JsonWriter.WriteStartObject(); foreach (var item in dictionary) { content.JsonWriter.WritePropertyName(item.Key); - content.JsonWriter.WriteObjectValue(item.Value, ModelSerializationExtensions.WireOptions); + content.JsonWriter.WriteObjectValue(item.Value, options); } content.JsonWriter.WriteEndObject(); @@ -146,9 +153,11 @@ public static BinaryContent FromObject(BinaryData value) /// /// /// - public static BinaryContent FromEnumerable(IEnumerable enumerable, string rootNameHint, string childNameHint) + /// + public static BinaryContent FromEnumerable(IEnumerable enumerable, string rootNameHint, string childNameHint, ModelReaderWriterOptions options = null) where T : notnull { + options ??= ModelSerializationExtensions.WireOptions; using (MemoryStream stream = new MemoryStream(256)) { using (XmlWriter writer = XmlWriter.Create(stream, ModelSerializationExtensions.XmlWriterSettings)) @@ -156,7 +165,7 @@ public static BinaryContent FromEnumerable(IEnumerable enumerable, string writer.WriteStartElement(rootNameHint); foreach (var item in enumerable) { - writer.WriteObjectValue(item, ModelSerializationExtensions.WireOptions, childNameHint); + writer.WriteObjectValue(item, options, childNameHint); } writer.WriteEndElement(); } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Internal/ModelSerializationExtensions.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Internal/ModelSerializationExtensions.cs index d02d4900909..b4df3bddaec 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Internal/ModelSerializationExtensions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Internal/ModelSerializationExtensions.cs @@ -250,7 +250,12 @@ public static void WriteObjectValue(this Utf8JsonWriter writer, T value, Mode writer.WriteNullValue(); break; case IJsonModel jsonModel: - jsonModel.Write(writer, options ?? WireOptions); + options ??= WireOptions; + if (options.Proxies.Count > 0) + { + jsonModel = options.ResolveProxy(jsonModel); + } + jsonModel.Write(writer, options); break; case byte[] bytes: writer.WriteBase64StringValue(bytes); @@ -349,6 +354,25 @@ public static BinaryData GetUtf8Bytes(this JsonElement element) #endif } + public static bool ShouldReadThroughProxy(this ModelReaderWriterOptions options, ModelReaderWriterContext context) + { + return options.Proxies.Count > 0 && ProxyReadEligibility.IsBuildable(context); + } + + public static ModelReaderWriterOptions ToWireOptions(this IList modelProxies) + { + if (modelProxies.Count == 0) + { + return WireOptions; + } + ModelReaderWriterOptions options = new ModelReaderWriterOptions("W"); + foreach (ModelProxy proxy in modelProxies) + { + options.Proxies.Add(proxy); + } + return options; + } + public static ReadOnlySpan SliceToStartOfPropertyName(this ReadOnlySpan jsonPath) { ReadOnlySpan local = jsonPath; @@ -450,6 +474,22 @@ public static ReadOnlySpan GetRemainder(this ReadOnlySpan jsonPath, _ => throw new ArgumentException("Format is not supported: ", nameof(format)) }; + public static BinaryData GetUtf8Bytes(this XElement element) => BinaryData.FromString(element.ToString(SaveOptions.DisableFormatting)); + + public static ModelReaderWriterOptions ToXmlOptions(this ModelReaderWriterOptions options) + { + if (options.Format == "X") + { + return options; + } + ModelReaderWriterOptions xmlOptions = new ModelReaderWriterOptions("X"); + foreach (ModelProxy proxy in options.Proxies) + { + xmlOptions.Proxies.Add(proxy); + } + return xmlOptions; + } + public static void WriteStringValue(this XmlWriter writer, DateTimeOffset value, string format) { writer.WriteValue(TypeFormatters.ToString(value, format)); @@ -503,5 +543,21 @@ public static void WriteObjectValue(this XmlWriter writer, T value, ModelRead throw new NotSupportedException($"Not supported type {typeof(T)}"); } } + + private static class ProxyReadEligibility + { + private static int s_state; + + public static bool IsBuildable(ModelReaderWriterContext context) + { + int state = s_state; + if (state == 0) + { + state = context.TryGetTypeBuilder(typeof(T), out _) ? 1 : 2; + s_state = state; + } + return state == 1; + } + } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Metrics.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Metrics.cs index 28bf5903d4a..c432567441d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Metrics.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Metrics.cs @@ -19,6 +19,7 @@ namespace SampleTypeSpec public partial class Metrics { private readonly Uri _endpoint; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions = ModelSerializationExtensions.WireOptions; private const string AuthorizationHeader = "my-api-key"; /// The OAuth2 flows supported by the service. private static readonly Dictionary[] _flows = new Dictionary[] @@ -39,12 +40,14 @@ protected Metrics() /// Initializes a new instance of Metrics. /// The HTTP pipeline for sending and receiving REST requests and responses. + /// /// Service endpoint. /// - internal Metrics(ClientPipeline pipeline, Uri endpoint, string metricsNamespace) + internal Metrics(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, string metricsNamespace) { _endpoint = endpoint; Pipeline = pipeline; + _modelReaderWriterOptions = modelReaderWriterOptions; _metricsNamespace = metricsNamespace; } @@ -90,6 +93,7 @@ internal Metrics(AuthenticationPolicy authenticationPolicy, Uri endpoint, string { Pipeline = ClientPipeline.Create(options, Array.Empty(), new PipelinePolicy[] { new UserAgentPolicy(typeof(Metrics).Assembly) }, Array.Empty()); } + _modelReaderWriterOptions = options.ModelProxies.ToWireOptions(); } /// Initializes a new instance of Metrics. @@ -167,7 +171,7 @@ public virtual async Task GetWidgetMetricsAsync(string day, Reques public virtual ClientResult GetWidgetMetrics(DaysOfWeekExtensibleEnum day, CancellationToken cancellationToken = default) { ClientResult result = GetWidgetMetrics(day.ToString(), cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((GetWidgetMetricsResult)result, result.GetRawResponse()); + return ClientResult.FromValue(GetWidgetMetricsResult.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Get Widget metrics for given day of week. @@ -177,7 +181,7 @@ public virtual ClientResult GetWidgetMetrics(DaysOfWeekE public virtual async Task> GetWidgetMetricsAsync(DaysOfWeekExtensibleEnum day, CancellationToken cancellationToken = default) { ClientResult result = await GetWidgetMetricsAsync(day.ToString(), cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((GetWidgetMetricsResult)result, result.GetRawResponse()); + return ClientResult.FromValue(GetWidgetMetricsResult.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Animal.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Animal.Serialization.cs index cccad18165e..41050c0d811 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Animal.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Animal.Serialization.cs @@ -74,6 +74,13 @@ public static implicit operator BinaryContent(Animal animal) return BinaryContent.Create(animal, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The to deserialize the from. public static explicit operator Animal(ClientResult result) { @@ -82,6 +89,19 @@ public static explicit operator Animal(ClientResult result) return DeserializeAnimal(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static Animal FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAnimal(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Cat.Serialization.Multipart.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Cat.Serialization.Multipart.cs index d30bad1d64e..93afff924df 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Cat.Serialization.Multipart.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Cat.Serialization.Multipart.cs @@ -22,7 +22,8 @@ internal Cat() } /// - internal MultiPartFormContent ToMultipartFormContent() + /// The options used to write the model parts, including the registered model proxies. + internal MultiPartFormContent ToMultipartFormContent(ModelReaderWriterOptions options) { MultiPartFormContent content = new MultiPartFormContent(); @@ -37,11 +38,11 @@ internal MultiPartFormContent ToMultipartFormContent() content.Add("uint8Part", Uint8Part, "text/plain"); BinaryData dictionaryPartData = MultipartFormDataHelper.FromDictionary(DictionaryPart, "application/json"); content.Add("dictionaryPart", dictionaryPartData); - BinaryData dictionaryModelPartData = ModelReaderWriter.Write(DictionaryModelPart, ModelSerializationExtensions.WireOptions, SampleTypeSpecContext.Default).WithMediaType("application/json"); + BinaryData dictionaryModelPartData = ModelReaderWriter.Write(DictionaryModelPart, options, SampleTypeSpecContext.Default).WithMediaType("application/json"); content.Add("dictionaryModelPart", dictionaryModelPartData); BinaryData listPartData = MultipartFormDataHelper.FromEnumerable(ListPart, "application/json"); content.Add("listPart", listPartData); - BinaryData listModelPartData = ModelReaderWriter.Write(ListModelPart, ModelSerializationExtensions.WireOptions, SampleTypeSpecContext.Default).WithMediaType("application/json"); + BinaryData listModelPartData = ModelReaderWriter.Write(ListModelPart, options, SampleTypeSpecContext.Default).WithMediaType("application/json"); content.Add("listModelPart", listModelPartData); foreach (string item in MultipleListPart) { diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/CollisionPetsUnion.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/CollisionPetsUnion.Serialization.cs index 4784feacd2a..94f2bff15de 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/CollisionPetsUnion.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/CollisionPetsUnion.Serialization.cs @@ -162,7 +162,7 @@ internal static CollisionPetsUnion DeserializeCollisionPetsUnion1(JsonElement el switch (discriminator.GetString()) { case "mammal": - return NestedMammal.DeserializeNestedMammal(discriminator0, options); + return options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(discriminator0.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : NestedMammal.DeserializeNestedMammal(discriminator0, options); default: throw new JsonException("Unknown discriminator value for union 'CollisionPets'."); } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorClientNameCollisionLeaf.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorClientNameCollisionLeaf.Serialization.cs index 80fac3f6cc5..09a7e4de5f3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorClientNameCollisionLeaf.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorClientNameCollisionLeaf.Serialization.cs @@ -71,6 +71,13 @@ public static implicit operator BinaryContent(ConstructorClientNameCollisionLeaf return BinaryContent.Create(constructorClientNameCollisionLeaf, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The to deserialize the from. public static explicit operator ConstructorClientNameCollisionLeaf(ClientResult result) { @@ -79,6 +86,19 @@ public static explicit operator ConstructorClientNameCollisionLeaf(ClientResult return DeserializeConstructorClientNameCollisionLeaf(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static ConstructorClientNameCollisionLeaf FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConstructorClientNameCollisionLeaf(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorInheritedLeaf.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorInheritedLeaf.Serialization.cs index dbb06537776..fd94cf366dd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorInheritedLeaf.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorInheritedLeaf.Serialization.cs @@ -71,6 +71,13 @@ public static implicit operator BinaryContent(ConstructorInheritedLeaf construct return BinaryContent.Create(constructorInheritedLeaf, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal new BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorOverride.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorOverride.Serialization.cs index 788b33f45dd..bbcdab9e5a6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorOverride.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorOverride.Serialization.cs @@ -71,6 +71,13 @@ public static implicit operator BinaryContent(ConstructorOverride constructorOve return BinaryContent.Create(constructorOverride, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorReadOnlyCollectionOverride.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorReadOnlyCollectionOverride.Serialization.cs index 67d869b0f2f..6fc9bba3f89 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorReadOnlyCollectionOverride.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorReadOnlyCollectionOverride.Serialization.cs @@ -66,6 +66,13 @@ public static implicit operator BinaryContent(ConstructorReadOnlyCollectionOverr return BinaryContent.Create(constructorReadOnlyCollectionOverride, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorReadOnlyLeaf.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorReadOnlyLeaf.Serialization.cs index 06741a7cd7b..870a09e62e9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorReadOnlyLeaf.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorReadOnlyLeaf.Serialization.cs @@ -66,6 +66,13 @@ public static implicit operator BinaryContent(ConstructorReadOnlyLeaf constructo return BinaryContent.Create(constructorReadOnlyLeaf, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal new BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorReadOnlyOverride.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorReadOnlyOverride.Serialization.cs index 81da3ef45ae..74b0981859a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorReadOnlyOverride.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorReadOnlyOverride.Serialization.cs @@ -66,6 +66,13 @@ public static implicit operator BinaryContent(ConstructorReadOnlyOverride constr return BinaryContent.Create(constructorReadOnlyOverride, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorRequiredCollectionOverride.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorRequiredCollectionOverride.Serialization.cs index fb2fdf730ad..495f5fdd6ad 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorRequiredCollectionOverride.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorRequiredCollectionOverride.Serialization.cs @@ -71,6 +71,13 @@ public static implicit operator BinaryContent(ConstructorRequiredCollectionOverr return BinaryContent.Create(constructorRequiredCollectionOverride, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal new BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorWritableLeaf.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorWritableLeaf.Serialization.cs index d86ab9037da..7a4bbe19f77 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorWritableLeaf.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ConstructorWritableLeaf.Serialization.cs @@ -66,6 +66,13 @@ public static implicit operator BinaryContent(ConstructorWritableLeaf constructo return BinaryContent.Create(constructorWritableLeaf, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/CustomIntermediateCat.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/CustomIntermediateCat.Serialization.cs index 7cb30913575..2ff044881f6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/CustomIntermediateCat.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/CustomIntermediateCat.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator CustomIntermediateCat(ClientResult result) return DeserializeCustomIntermediateCat(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static CustomIntermediateCat FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCustomIntermediateCat(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/CustomUnionCat.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/CustomUnionCat.Serialization.cs index cf2ec3b5b94..1b216bb4e37 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/CustomUnionCat.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/CustomUnionCat.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator CustomUnionCat(ClientResult result) return DeserializeCustomUnionCat(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static CustomUnionCat FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCustomUnionCat(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/CustomUnionPet.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/CustomUnionPet.Serialization.cs index 6b52ae07a5c..f0d863ec871 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/CustomUnionPet.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/CustomUnionPet.Serialization.cs @@ -66,6 +66,13 @@ public static implicit operator BinaryContent(CustomUnionPet customUnionPet) return BinaryContent.Create(customUnionPet, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The to deserialize the from. public static explicit operator CustomUnionPet(ClientResult result) { @@ -74,6 +81,19 @@ public static explicit operator CustomUnionPet(ClientResult result) return DeserializeCustomUnionPet(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static CustomUnionPet FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCustomUnionPet(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DescendantUnionCat.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DescendantUnionCat.Serialization.cs index 1fc91e598d0..a9b5ee64d46 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DescendantUnionCat.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DescendantUnionCat.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator DescendantUnionCat(ClientResult result) return DeserializeDescendantUnionCat(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static DescendantUnionCat FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDescendantUnionCat(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DescendantUnionPet.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DescendantUnionPet.Serialization.cs index 4d21a0ba64e..8c9dfcadca2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DescendantUnionPet.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DescendantUnionPet.Serialization.cs @@ -162,7 +162,7 @@ internal static DescendantUnionPet DeserializeDescendantPetsUnion1(JsonElement e switch (discriminator.GetString()) { case "cat": - return DescendantUnionCat.DeserializeDescendantUnionCat(discriminator0, options); + return options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(discriminator0.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : DescendantUnionCat.DeserializeDescendantUnionCat(discriminator0, options); default: throw new JsonException("Unknown discriminator value for union 'DescendantPets'."); } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DeserializeNamedCat.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DeserializeNamedCat.Serialization.cs index 1785af09e45..8e5c6702f6a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DeserializeNamedCat.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DeserializeNamedCat.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator DeserializeNamedCat(ClientResult result) return DeserializeDeserializeNamedCat(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static DeserializeNamedCat FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDeserializeNamedCat(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DeserializePetsUnion.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DeserializePetsUnion.Serialization.cs index dcdf49c598d..15d2cdd93ab 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DeserializePetsUnion.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DeserializePetsUnion.Serialization.cs @@ -162,7 +162,7 @@ internal static DeserializePetsUnion DeserializePetsUnion1(JsonElement element, switch (discriminator.GetString()) { case "cat": - return DeserializeNamedCat.DeserializeDeserializeNamedCat(discriminator0, options); + return options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(discriminator0.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : DeserializeNamedCat.DeserializeDeserializeNamedCat(discriminator0, options); default: throw new JsonException("Unknown discriminator value for union 'Pets'."); } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DeserializerPet.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DeserializerPet.Serialization.cs index 963edc5c177..0012402aafe 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DeserializerPet.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DeserializerPet.Serialization.cs @@ -162,7 +162,7 @@ internal static DeserializerPet DeserializePetsUnion1(JsonElement element, Model switch (discriminator.GetString()) { case "pet": - return PetsUnion.DeserializePetsUnion(discriminator0, options); + return options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(discriminator0.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : PetsUnion.DeserializePetsUnion(discriminator0, options); default: throw new JsonException("Unknown discriminator value for union 'Pets'."); } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DirectUnionCat.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DirectUnionCat.Serialization.cs index 774fd645832..3ef98acf42a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DirectUnionCat.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DirectUnionCat.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator DirectUnionCat(ClientResult result) return DeserializeDirectUnionCat(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static new DirectUnionCat FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDirectUnionCat(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DirectUnionPet.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DirectUnionPet.Serialization.cs index bb6c4cb002b..9623ee8e43d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DirectUnionPet.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DirectUnionPet.Serialization.cs @@ -71,6 +71,13 @@ public static implicit operator BinaryContent(DirectUnionPet directUnionPet) return BinaryContent.Create(directUnionPet, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The to deserialize the from. public static explicit operator DirectUnionPet(ClientResult result) { @@ -79,6 +86,19 @@ public static explicit operator DirectUnionPet(ClientResult result) return DeserializeDirectUnionPet(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static DirectUnionPet FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDirectUnionPet(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -218,7 +238,7 @@ internal static DirectUnionPet DeserializeDirectPetsUnion3(JsonElement element, switch (discriminator.GetString()) { case "cat": - return DirectUnionCat.DeserializeDirectUnionCat(discriminator0, options); + return options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(discriminator0.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : DirectUnionCat.DeserializeDirectUnionCat(discriminator0, options); default: throw new JsonException("Unknown discriminator value for union 'DirectPets'."); } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DirectUnionPetContainer.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DirectUnionPetContainer.Serialization.cs index e68260747ff..94240ee3746 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DirectUnionPetContainer.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DirectUnionPetContainer.Serialization.cs @@ -71,6 +71,13 @@ public static implicit operator BinaryContent(DirectUnionPetContainer directUnio return BinaryContent.Create(directUnionPetContainer, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The to deserialize the from. public static explicit operator DirectUnionPetContainer(ClientResult result) { @@ -79,6 +86,19 @@ public static explicit operator DirectUnionPetContainer(ClientResult result) return DeserializeDirectUnionPetContainer(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static DirectUnionPetContainer FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDirectUnionPetContainer(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -147,7 +167,7 @@ internal static DirectUnionPetContainer DeserializeDirectUnionPetContainer(JsonE { if (prop.NameEquals("pet"u8)) { - pet = DirectUnionPet.DeserializeDirectUnionPet(prop.Value, options); + pet = options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(prop.Value.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : DirectUnionPet.DeserializeDirectUnionPet(prop.Value, options); continue; } if (options.Format != "W") diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Dog.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Dog.Serialization.cs index 1847d7df606..1a1d14c4fa9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Dog.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Dog.Serialization.cs @@ -71,6 +71,13 @@ public static implicit operator BinaryContent(Dog dog) return BinaryContent.Create(dog, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal new BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The to deserialize the from. public static explicit operator Dog(ClientResult result) { @@ -79,6 +86,19 @@ public static explicit operator Dog(ClientResult result) return DeserializeDog(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static new Dog FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDog(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DynamicModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DynamicModel.Serialization.cs index fb666c7a7f0..6ed2e423614 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DynamicModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DynamicModel.Serialization.cs @@ -72,6 +72,13 @@ public static implicit operator BinaryContent(DynamicModel dynamicModel) return BinaryContent.Create(dynamicModel, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -769,7 +776,7 @@ internal static DynamicModel DeserializeDynamicModel(JsonElement element, Binary } if (prop.NameEquals("foo"u8)) { - foo = AnotherDynamicModel.DeserializeAnotherDynamicModel(prop.Value, prop.Value.GetUtf8Bytes(), options); + foo = options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(prop.Value.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : AnotherDynamicModel.DeserializeAnotherDynamicModel(prop.Value, prop.Value.GetUtf8Bytes(), options); continue; } if (prop.NameEquals("listFoo"u8)) @@ -777,7 +784,7 @@ internal static DynamicModel DeserializeDynamicModel(JsonElement element, Binary List array = new List(); foreach (var item in prop.Value.EnumerateArray()) { - array.Add(AnotherDynamicModel.DeserializeAnotherDynamicModel(item, item.GetUtf8Bytes(), options)); + array.Add(options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(item.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : AnotherDynamicModel.DeserializeAnotherDynamicModel(item, item.GetUtf8Bytes(), options)); } listFoo = array; continue; @@ -796,7 +803,7 @@ internal static DynamicModel DeserializeDynamicModel(JsonElement element, Binary List array0 = new List(); foreach (var item0 in item.EnumerateArray()) { - array0.Add(AnotherDynamicModel.DeserializeAnotherDynamicModel(item0, item0.GetUtf8Bytes(), options)); + array0.Add(options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(item0.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : AnotherDynamicModel.DeserializeAnotherDynamicModel(item0, item0.GetUtf8Bytes(), options)); } array.Add(array0); } @@ -809,7 +816,7 @@ internal static DynamicModel DeserializeDynamicModel(JsonElement element, Binary Dictionary dictionary = new Dictionary(); foreach (var prop0 in prop.Value.EnumerateObject()) { - dictionary.Add(prop0.Name, AnotherDynamicModel.DeserializeAnotherDynamicModel(prop0.Value, prop0.Value.GetUtf8Bytes(), options)); + dictionary.Add(prop0.Name, options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(prop0.Value.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : AnotherDynamicModel.DeserializeAnotherDynamicModel(prop0.Value, prop0.Value.GetUtf8Bytes(), options)); } dictionaryFoo = dictionary; continue; @@ -828,7 +835,7 @@ internal static DynamicModel DeserializeDynamicModel(JsonElement element, Binary Dictionary dictionary0 = new Dictionary(); foreach (var prop1 in prop0.Value.EnumerateObject()) { - dictionary0.Add(prop1.Name, AnotherDynamicModel.DeserializeAnotherDynamicModel(prop1.Value, prop1.Value.GetUtf8Bytes(), options)); + dictionary0.Add(prop1.Name, options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(prop1.Value.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : AnotherDynamicModel.DeserializeAnotherDynamicModel(prop1.Value, prop1.Value.GetUtf8Bytes(), options)); } dictionary.Add(prop0.Name, dictionary0); } @@ -850,7 +857,7 @@ internal static DynamicModel DeserializeDynamicModel(JsonElement element, Binary List array = new List(); foreach (var item in prop0.Value.EnumerateArray()) { - array.Add(AnotherDynamicModel.DeserializeAnotherDynamicModel(item, item.GetUtf8Bytes(), options)); + array.Add(options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(item.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : AnotherDynamicModel.DeserializeAnotherDynamicModel(item, item.GetUtf8Bytes(), options)); } dictionary.Add(prop0.Name, array); } @@ -872,7 +879,7 @@ internal static DynamicModel DeserializeDynamicModel(JsonElement element, Binary Dictionary dictionary = new Dictionary(); foreach (var prop0 in item.EnumerateObject()) { - dictionary.Add(prop0.Name, AnotherDynamicModel.DeserializeAnotherDynamicModel(prop0.Value, prop0.Value.GetUtf8Bytes(), options)); + dictionary.Add(prop0.Name, options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(prop0.Value.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : AnotherDynamicModel.DeserializeAnotherDynamicModel(prop0.Value, prop0.Value.GetUtf8Bytes(), options)); } array.Add(dictionary); } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DynamicUnionPetContainer.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DynamicUnionPetContainer.Serialization.cs index f8c0914bb15..3d7e61e258b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DynamicUnionPetContainer.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DynamicUnionPetContainer.Serialization.cs @@ -67,6 +67,13 @@ public static implicit operator BinaryContent(DynamicUnionPetContainer dynamicUn return BinaryContent.Create(dynamicUnionPetContainer, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The to deserialize the from. public static explicit operator DynamicUnionPetContainer(ClientResult result) { @@ -76,6 +83,20 @@ public static explicit operator DynamicUnionPetContainer(ClientResult result) return DeserializeDynamicUnionPetContainer(document.RootElement, data, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static DynamicUnionPetContainer FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + BinaryData data = response.Content; + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDynamicUnionPetContainer(document.RootElement, data, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ExperimentalUnionCat.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ExperimentalUnionCat.Serialization.cs index e3a6fb44533..fc3df09a9aa 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ExperimentalUnionCat.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ExperimentalUnionCat.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator ExperimentalUnionCat(ClientResult result) return DeserializeExperimentalUnionCat(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static new ExperimentalUnionCat FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeExperimentalUnionCat(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ExternalUnionCat.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ExternalUnionCat.Serialization.cs index 2a8f00fcf52..b98055fdc36 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ExternalUnionCat.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ExternalUnionCat.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator ExternalUnionCat(ClientResult result) return DeserializeExternalUnionCat(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static ExternalUnionCat FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeExternalUnionCat(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Friend.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Friend.Serialization.cs index b973e4b76e0..63357ed959e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Friend.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Friend.Serialization.cs @@ -72,6 +72,13 @@ public static implicit operator BinaryContent(Friend friend) return BinaryContent.Create(friend, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The to deserialize the from. public static explicit operator Friend(ClientResult result) { @@ -80,6 +87,19 @@ public static explicit operator Friend(ClientResult result) return DeserializeFriend(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static Friend FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFriend(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/GetNotebookResult.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/GetNotebookResult.Serialization.cs index 14a86aef841..21df05e4538 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/GetNotebookResult.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/GetNotebookResult.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator GetNotebookResult(ClientResult result) return DeserializeGetNotebookResult(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static GetNotebookResult FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeGetNotebookResult(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/GetWidgetMetricsResult.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/GetWidgetMetricsResult.Serialization.cs index 732ec427356..3fb983d66b0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/GetWidgetMetricsResult.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/GetWidgetMetricsResult.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator GetWidgetMetricsResult(ClientResult result) return DeserializeGetWidgetMetricsResult(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static GetWidgetMetricsResult FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeGetWidgetMetricsResult(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/IntermediateUnionCat.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/IntermediateUnionCat.Serialization.cs index d1bda3045c1..e9123ad43af 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/IntermediateUnionCat.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/IntermediateUnionCat.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator IntermediateUnionCat(ClientResult result) return DeserializeIntermediateUnionCat(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static IntermediateUnionCat FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeIntermediateUnionCat(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/LifecycleModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/LifecycleModel.Serialization.cs index aa1414688cb..17002a9903a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/LifecycleModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/LifecycleModel.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator LifecycleModel(ClientResult result) return DeserializeLifecycleModel(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static LifecycleModel FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLifecycleModel(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -155,7 +168,7 @@ internal static LifecycleModel DeserializeLifecycleModel(JsonElement element, Mo { continue; } - preview = PreviewDetails.DeserializePreviewDetails(prop.Value, options); + preview = options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(prop.Value.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : PreviewDetails.DeserializePreviewDetails(prop.Value, options); continue; } if (prop.NameEquals("choice"u8)) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithContinuationTokenHeaderResponseResult.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithContinuationTokenHeaderResponseResult.Serialization.cs index 2ee695f08e1..193ecabf0f6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithContinuationTokenHeaderResponseResult.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithContinuationTokenHeaderResponseResult.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator ListWithContinuationTokenHeaderResponseResult(Cl return DeserializeListWithContinuationTokenHeaderResponseResult(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static ListWithContinuationTokenHeaderResponseResult FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeListWithContinuationTokenHeaderResponseResult(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -145,7 +158,7 @@ internal static ListWithContinuationTokenHeaderResponseResult DeserializeListWit List array = new List(); foreach (var item in prop.Value.EnumerateArray()) { - array.Add(Thing.DeserializeThing(item, options)); + array.Add(options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(item.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : Thing.DeserializeThing(item, options)); } things = array; continue; diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithContinuationTokenResult.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithContinuationTokenResult.Serialization.cs index 4f0310ae3c8..0b8d7a992e8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithContinuationTokenResult.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithContinuationTokenResult.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator ListWithContinuationTokenResult(ClientResult res return DeserializeListWithContinuationTokenResult(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static ListWithContinuationTokenResult FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeListWithContinuationTokenResult(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -151,7 +164,7 @@ internal static ListWithContinuationTokenResult DeserializeListWithContinuationT List array = new List(); foreach (var item in prop.Value.EnumerateArray()) { - array.Add(Thing.DeserializeThing(item, options)); + array.Add(options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(item.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : Thing.DeserializeThing(item, options)); } things = array; continue; diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithNextLinkResult.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithNextLinkResult.Serialization.cs index 05411d9837c..770cad97405 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithNextLinkResult.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithNextLinkResult.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator ListWithNextLinkResult(ClientResult result) return DeserializeListWithNextLinkResult(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static ListWithNextLinkResult FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeListWithNextLinkResult(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -151,7 +164,7 @@ internal static ListWithNextLinkResult DeserializeListWithNextLinkResult(JsonEle List array = new List(); foreach (var item in prop.Value.EnumerateArray()) { - array.Add(Thing.DeserializeThing(item, options)); + array.Add(options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(item.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : Thing.DeserializeThing(item, options)); } things = array; continue; diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithStringNextLinkResult.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithStringNextLinkResult.Serialization.cs index dbe94bf0dd0..3e78e825b40 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithStringNextLinkResult.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithStringNextLinkResult.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator ListWithStringNextLinkResult(ClientResult result return DeserializeListWithStringNextLinkResult(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static ListWithStringNextLinkResult FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeListWithStringNextLinkResult(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -151,7 +164,7 @@ internal static ListWithStringNextLinkResult DeserializeListWithStringNextLinkRe List array = new List(); foreach (var item in prop.Value.EnumerateArray()) { - array.Add(Thing.DeserializeThing(item, options)); + array.Add(options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(item.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : Thing.DeserializeThing(item, options)); } things = array; continue; diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ModelWithEmbeddedNonBodyParameters.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ModelWithEmbeddedNonBodyParameters.Serialization.cs index e97166f3199..d51683b458a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ModelWithEmbeddedNonBodyParameters.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ModelWithEmbeddedNonBodyParameters.Serialization.cs @@ -71,6 +71,13 @@ public static implicit operator BinaryContent(ModelWithEmbeddedNonBodyParameters return BinaryContent.Create(modelWithEmbeddedNonBodyParameters, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/NestedMammal.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/NestedMammal.Serialization.cs index b344bf80e02..a71b07bdae5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/NestedMammal.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/NestedMammal.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator NestedMammal(ClientResult result) return DeserializeNestedMammal(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static NestedMammal FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeNestedMammal(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -173,7 +186,7 @@ internal static NestedMammal DeserializeNestedPetsUnion(JsonElement element, Mod switch (discriminator.GetString()) { case "cat": - return ExperimentalUnionCat.DeserializeExperimentalUnionCat(discriminator0, options); + return options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(discriminator0.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : ExperimentalUnionCat.DeserializeExperimentalUnionCat(discriminator0, options); default: throw new JsonException("Unknown discriminator value for union 'NestedPets'."); } @@ -221,7 +234,7 @@ internal static NestedMammal DeserializeCollisionPetsUnion2(JsonElement element, switch (discriminator.GetString()) { case "cat": - return ExperimentalUnionCat.DeserializeExperimentalUnionCat(discriminator0, options); + return options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(discriminator0.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : ExperimentalUnionCat.DeserializeExperimentalUnionCat(discriminator0, options); default: throw new JsonException("Unknown discriminator value for union 'CollisionPets'."); } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/NullableDynamicModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/NullableDynamicModel.Serialization.cs index 86479056edf..85ad5cafcee 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/NullableDynamicModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/NullableDynamicModel.Serialization.cs @@ -505,7 +505,7 @@ internal static NullableDynamicModel DeserializeNullableDynamicModel(JsonElement modelValue = null; continue; } - modelValue = AnotherDynamicModel.DeserializeAnotherDynamicModel(prop.Value, prop.Value.GetUtf8Bytes(), options); + modelValue = options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(prop.Value.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : AnotherDynamicModel.DeserializeAnotherDynamicModel(prop.Value, prop.Value.GetUtf8Bytes(), options); continue; } if (prop.NameEquals("children"u8)) @@ -518,7 +518,7 @@ internal static NullableDynamicModel DeserializeNullableDynamicModel(JsonElement List array = new List(); foreach (var item in prop.Value.EnumerateArray()) { - array.Add(AnotherDynamicModel.DeserializeAnotherDynamicModel(item, item.GetUtf8Bytes(), options)); + array.Add(options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(item.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : AnotherDynamicModel.DeserializeAnotherDynamicModel(item, item.GetUtf8Bytes(), options)); } children = array; continue; @@ -533,7 +533,7 @@ internal static NullableDynamicModel DeserializeNullableDynamicModel(JsonElement Dictionary dictionary = new Dictionary(); foreach (var prop0 in prop.Value.EnumerateObject()) { - dictionary.Add(prop0.Name, AnotherDynamicModel.DeserializeAnotherDynamicModel(prop0.Value, prop0.Value.GetUtf8Bytes(), options)); + dictionary.Add(prop0.Name, options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(prop0.Value.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : AnotherDynamicModel.DeserializeAnotherDynamicModel(prop0.Value, prop0.Value.GetUtf8Bytes(), options)); } childDictionary = dictionary; continue; @@ -557,7 +557,7 @@ internal static NullableDynamicModel DeserializeNullableDynamicModel(JsonElement List array0 = new List(); foreach (var item0 in item.EnumerateArray()) { - array0.Add(AnotherDynamicModel.DeserializeAnotherDynamicModel(item0, item0.GetUtf8Bytes(), options)); + array0.Add(options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(item0.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : AnotherDynamicModel.DeserializeAnotherDynamicModel(item0, item0.GetUtf8Bytes(), options)); } array.Add(array0); } @@ -584,7 +584,7 @@ internal static NullableDynamicModel DeserializeNullableDynamicModel(JsonElement Dictionary dictionary0 = new Dictionary(); foreach (var prop1 in prop0.Value.EnumerateObject()) { - dictionary0.Add(prop1.Name, AnotherDynamicModel.DeserializeAnotherDynamicModel(prop1.Value, prop1.Value.GetUtf8Bytes(), options)); + dictionary0.Add(prop1.Name, options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(prop1.Value.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : AnotherDynamicModel.DeserializeAnotherDynamicModel(prop1.Value, prop1.Value.GetUtf8Bytes(), options)); } dictionary.Add(prop0.Name, dictionary0); } @@ -611,7 +611,7 @@ internal static NullableDynamicModel DeserializeNullableDynamicModel(JsonElement List array = new List(); foreach (var item in prop0.Value.EnumerateArray()) { - array.Add(AnotherDynamicModel.DeserializeAnotherDynamicModel(item, item.GetUtf8Bytes(), options)); + array.Add(options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(item.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : AnotherDynamicModel.DeserializeAnotherDynamicModel(item, item.GetUtf8Bytes(), options)); } dictionary.Add(prop0.Name, array); } @@ -638,7 +638,7 @@ internal static NullableDynamicModel DeserializeNullableDynamicModel(JsonElement Dictionary dictionary = new Dictionary(); foreach (var prop0 in item.EnumerateObject()) { - dictionary.Add(prop0.Name, AnotherDynamicModel.DeserializeAnotherDynamicModel(prop0.Value, prop0.Value.GetUtf8Bytes(), options)); + dictionary.Add(prop0.Name, options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(prop0.Value.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : AnotherDynamicModel.DeserializeAnotherDynamicModel(prop0.Value, prop0.Value.GetUtf8Bytes(), options)); } array.Add(dictionary); } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/OptionalNullableContainer.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/OptionalNullableContainer.Serialization.cs index f1c7c65686e..b2525f1313b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/OptionalNullableContainer.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/OptionalNullableContainer.Serialization.cs @@ -128,7 +128,7 @@ internal static OptionalNullableContainer DeserializeOptionalNullableContainer(J { if (prop.NameEquals("child"u8)) { - child = OptionalNullableProperties.DeserializeOptionalNullableProperties(prop.Value, options); + child = options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(prop.Value.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : OptionalNullableProperties.DeserializeOptionalNullableProperties(prop.Value, options); continue; } if (options.Format != "W") diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/OptionalNullableProperties.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/OptionalNullableProperties.Serialization.cs index fc903561509..e63be9e94da 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/OptionalNullableProperties.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/OptionalNullableProperties.Serialization.cs @@ -311,7 +311,7 @@ internal static OptionalNullableProperties DeserializeOptionalNullableProperties nullableModel = null; continue; } - nullableModel = OptionalNullableChild.DeserializeOptionalNullableChild(prop.Value, options); + nullableModel = options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(prop.Value.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : OptionalNullableChild.DeserializeOptionalNullableChild(prop.Value, options); continue; } if (prop.NameEquals("nullableString"u8)) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/PagePreviewDetails.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/PagePreviewDetails.Serialization.cs index e58a7bf0bc7..421a06eff09 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/PagePreviewDetails.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/PagePreviewDetails.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator PagePreviewDetails(ClientResult result) return DeserializePagePreviewDetails(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static PagePreviewDetails FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePagePreviewDetails(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -148,7 +161,7 @@ internal static PagePreviewDetails DeserializePagePreviewDetails(JsonElement ele List array = new List(); foreach (var item in prop.Value.EnumerateArray()) { - array.Add(PreviewDetails.DeserializePreviewDetails(item, options)); + array.Add(options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(item.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : PreviewDetails.DeserializePreviewDetails(item, options)); } items = array; continue; diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/PageThing.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/PageThing.Serialization.cs index 508a1aa2181..9b1458e9938 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/PageThing.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/PageThing.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator PageThing(ClientResult result) return DeserializePageThing(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static PageThing FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePageThing(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -145,7 +158,7 @@ internal static PageThing DeserializePageThing(JsonElement element, ModelReaderW List array = new List(); foreach (var item in prop.Value.EnumerateArray()) { - array.Add(Thing.DeserializeThing(item, options)); + array.Add(options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(item.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : Thing.DeserializeThing(item, options)); } items = array; continue; diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Pet.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Pet.Serialization.cs index 8aa4a4afecf..84c4cf74805 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Pet.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Pet.Serialization.cs @@ -70,6 +70,13 @@ public static implicit operator BinaryContent(Pet pet) return BinaryContent.Create(pet, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal new BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The to deserialize the from. public static explicit operator Pet(ClientResult result) { @@ -78,6 +85,19 @@ public static explicit operator Pet(ClientResult result) return DeserializePet(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static new Pet FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePet(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/PetsUnion.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/PetsUnion.Serialization.cs index ae1bbd408d7..686920402c7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/PetsUnion.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/PetsUnion.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator PetsUnion(ClientResult result) return DeserializePetsUnion(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static PetsUnion FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePetsUnion(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RawUnionPetContainer.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RawUnionPetContainer.Serialization.cs index 817735db22a..db78324e0e2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RawUnionPetContainer.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RawUnionPetContainer.Serialization.cs @@ -71,6 +71,13 @@ public static implicit operator BinaryContent(RawUnionPetContainer rawUnionPetCo return BinaryContent.Create(rawUnionPetContainer, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The to deserialize the from. public static explicit operator RawUnionPetContainer(ClientResult result) { @@ -79,6 +86,19 @@ public static explicit operator RawUnionPetContainer(ClientResult result) return DeserializeRawUnionPetContainer(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static RawUnionPetContainer FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRawUnionPetContainer(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RebasedUnionA.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RebasedUnionA.Serialization.cs index 575f4bfc70b..c91debd40e2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RebasedUnionA.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RebasedUnionA.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator RebasedUnionA(ClientResult result) return DeserializeRebasedUnionA(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static RebasedUnionA FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRebasedUnionA(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -170,7 +183,7 @@ internal static RebasedUnionA DeserializePetsUnion(JsonElement element, ModelRea switch (discriminator.GetString()) { case "a": - return RebasedUnionALeaf.DeserializeRebasedUnionALeaf(discriminator0, options); + return options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(discriminator0.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : RebasedUnionALeaf.DeserializeRebasedUnionALeaf(discriminator0, options); default: throw new JsonException("Unknown discriminator value for union 'Pets'."); } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RebasedUnionALeaf.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RebasedUnionALeaf.Serialization.cs index 6ebf38f35fd..3ad0927f63d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RebasedUnionALeaf.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RebasedUnionALeaf.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator RebasedUnionALeaf(ClientResult result) return DeserializeRebasedUnionALeaf(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static new RebasedUnionALeaf FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRebasedUnionALeaf(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RebasedUnionB.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RebasedUnionB.Serialization.cs index 109326028fc..ff00f928839 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RebasedUnionB.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RebasedUnionB.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator RebasedUnionB(ClientResult result) return DeserializeRebasedUnionB(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static new RebasedUnionB FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRebasedUnionB(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -170,7 +183,7 @@ internal static RebasedUnionB DeserializePetsUnion1(JsonElement element, ModelRe switch (discriminator.GetString()) { case "b": - return RebasedUnionBLeaf.DeserializeRebasedUnionBLeaf(discriminator0, options); + return options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(discriminator0.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : RebasedUnionBLeaf.DeserializeRebasedUnionBLeaf(discriminator0, options); default: throw new JsonException("Unknown discriminator value for union 'Pets'."); } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RebasedUnionBLeaf.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RebasedUnionBLeaf.Serialization.cs index 1b90afb5e32..9f8963b0d75 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RebasedUnionBLeaf.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RebasedUnionBLeaf.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator RebasedUnionBLeaf(ClientResult result) return DeserializeRebasedUnionBLeaf(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static new RebasedUnionBLeaf FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRebasedUnionBLeaf(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RebasedUnionPet.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RebasedUnionPet.Serialization.cs index 7c2ae03fdc1..e35bfe7c54a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RebasedUnionPet.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RebasedUnionPet.Serialization.cs @@ -172,9 +172,9 @@ internal static RebasedUnionPet DeserializeRebasedPetsUnion(JsonElement element, switch (discriminator.GetString()) { case "a": - return RebasedUnionA.DeserializeRebasedUnionA(discriminator0, options); + return options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(discriminator0.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : RebasedUnionA.DeserializeRebasedUnionA(discriminator0, options); case "b": - return RebasedUnionB.DeserializeRebasedUnionB(discriminator0, options); + return options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(discriminator0.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : RebasedUnionB.DeserializeRebasedUnionB(discriminator0, options); default: throw new JsonException("Unknown discriminator value for union 'RebasedPets'."); } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedConstructorLeaf.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedConstructorLeaf.Serialization.cs index b950c87ccab..086929914c8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedConstructorLeaf.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedConstructorLeaf.Serialization.cs @@ -71,6 +71,13 @@ public static implicit operator BinaryContent(RenamedConstructorLeaf renamedCons return BinaryContent.Create(renamedConstructorLeaf, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal new BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedConstructorOverride.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedConstructorOverride.Serialization.cs index 823d1327b99..d0911b8739c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedConstructorOverride.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedConstructorOverride.Serialization.cs @@ -71,6 +71,13 @@ public static implicit operator BinaryContent(RenamedConstructorOverride renamed return BinaryContent.Create(renamedConstructorOverride, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedConstructorReturnedName.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedConstructorReturnedName.Serialization.cs index c661992dbcf..c6ce7a0fb91 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedConstructorReturnedName.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedConstructorReturnedName.Serialization.cs @@ -71,6 +71,13 @@ public static implicit operator BinaryContent(RenamedConstructorReturnedName ren return BinaryContent.Create(renamedConstructorReturnedName, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal new BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedLiteralConstructorOverride.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedLiteralConstructorOverride.Serialization.cs index 96f393ab9da..8e517ac4292 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedLiteralConstructorOverride.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedLiteralConstructorOverride.Serialization.cs @@ -66,6 +66,13 @@ public static implicit operator BinaryContent(RenamedLiteralConstructorOverride return BinaryContent.Create(renamedLiteralConstructorOverride, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The to deserialize the from. public static explicit operator RenamedLiteralConstructorOverride(ClientResult result) { @@ -74,6 +81,19 @@ public static explicit operator RenamedLiteralConstructorOverride(ClientResult r return DeserializeRenamedLiteralConstructorOverride(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static RenamedLiteralConstructorOverride FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRenamedLiteralConstructorOverride(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedModelCustom.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedModelCustom.Serialization.cs index 67020de86a5..a8a6be91f95 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedModelCustom.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedModelCustom.Serialization.cs @@ -72,6 +72,13 @@ public static implicit operator BinaryContent(RenamedModelCustom renamedModelCus return BinaryContent.Create(renamedModelCustom, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal new BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The to deserialize the from. public static explicit operator RenamedModelCustom(ClientResult result) { @@ -80,6 +87,19 @@ public static explicit operator RenamedModelCustom(ClientResult result) return DeserializeRenamedModelCustom(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static new RenamedModelCustom FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRenamedModelCustom(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RequiredRenamedConstructorOverride.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RequiredRenamedConstructorOverride.Serialization.cs index 69f6ad2a475..603cf603a68 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RequiredRenamedConstructorOverride.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RequiredRenamedConstructorOverride.Serialization.cs @@ -71,6 +71,13 @@ public static implicit operator BinaryContent(RequiredRenamedConstructorOverride return BinaryContent.Create(requiredRenamedConstructorOverride, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal new BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ReturnsAnonymousModelResult.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ReturnsAnonymousModelResult.Serialization.cs index 9d0371e973a..44f8339e568 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ReturnsAnonymousModelResult.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ReturnsAnonymousModelResult.Serialization.cs @@ -64,6 +64,19 @@ public static explicit operator ReturnsAnonymousModelResult(ClientResult result) return DeserializeReturnsAnonymousModelResult(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static ReturnsAnonymousModelResult FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeReturnsAnonymousModelResult(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RoundTripModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RoundTripModel.Serialization.cs index d382367cb0d..d1df1d691ba 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RoundTripModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RoundTripModel.Serialization.cs @@ -71,6 +71,13 @@ public static implicit operator BinaryContent(RoundTripModel roundTripModel) return BinaryContent.Create(roundTripModel, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The to deserialize the from. public static explicit operator RoundTripModel(ClientResult result) { @@ -79,6 +86,19 @@ public static explicit operator RoundTripModel(ClientResult result) return DeserializeRoundTripModel(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static RoundTripModel FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRoundTripModel(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -408,7 +428,7 @@ internal static RoundTripModel DeserializeRoundTripModel(JsonElement element, Mo } if (prop.NameEquals("requiredModel"u8)) { - requiredModel = Thing.DeserializeThing(prop.Value, options); + requiredModel = options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(prop.Value.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : Thing.DeserializeThing(prop.Value, options); continue; } if (prop.NameEquals("intExtensibleEnum"u8)) @@ -622,7 +642,7 @@ internal static RoundTripModel DeserializeRoundTripModel(JsonElement element, Mo } if (prop.NameEquals("modelWithRequiredNullable"u8)) { - modelWithRequiredNullable = ModelWithRequiredNullableProperties.DeserializeModelWithRequiredNullableProperties(prop.Value, options); + modelWithRequiredNullable = options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(prop.Value.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : ModelWithRequiredNullableProperties.DeserializeModelWithRequiredNullableProperties(prop.Value, options); continue; } if (prop.NameEquals("requiredBytes"u8)) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/SerializeNamedCat.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/SerializeNamedCat.Serialization.cs index e88f1f970f9..eac59be4cef 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/SerializeNamedCat.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/SerializeNamedCat.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator SerializeNamedCat(ClientResult result) return DeserializeSerializeNamedCat(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static SerializeNamedCat FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSerializeNamedCat(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/SerializePetsUnion.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/SerializePetsUnion.Serialization.cs index 0967899b911..e99120f2bb1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/SerializePetsUnion.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/SerializePetsUnion.Serialization.cs @@ -162,7 +162,7 @@ internal static SerializePetsUnion DeserializePetsUnion1(JsonElement element, Mo switch (discriminator.GetString()) { case "cat": - return SerializeNamedCat.DeserializeSerializeNamedCat(discriminator0, options); + return options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(discriminator0.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : SerializeNamedCat.DeserializeSerializeNamedCat(discriminator0, options); default: throw new JsonException("Unknown discriminator value for union 'Pets'."); } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Thing.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Thing.Serialization.cs index eb3496cb386..75d6cc2ffdb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Thing.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Thing.Serialization.cs @@ -71,6 +71,13 @@ public static implicit operator BinaryContent(Thing thing) return BinaryContent.Create(thing, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The to deserialize the from. public static explicit operator Thing(ClientResult result) { @@ -79,6 +86,19 @@ public static explicit operator Thing(ClientResult result) return DeserializeThing(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static Thing FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeThing(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Tree.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Tree.Serialization.cs index f8ecfe7a503..0c381eb5528 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Tree.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Tree.Serialization.cs @@ -95,11 +95,10 @@ public static implicit operator BinaryContent(Tree tree) return BinaryContent.Create(tree, ModelSerializationExtensions.WireOptions); } - /// Converts the model to BinaryContent using the specified format. - /// The format to use for serialization. - internal BinaryContent ToBinaryContent(string format) + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) { - ModelReaderWriterOptions options = new ModelReaderWriterOptions(format); return BinaryContent.Create(this, options); } @@ -123,6 +122,35 @@ public static explicit operator Tree(ClientResult result) return DeserializeTree(XElement.Load(stream, LoadOptions.PreserveWhitespace), ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static Tree FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + + if (response.Headers.TryGetValue("Content-Type", out string value) && value.StartsWith("application/json", StringComparison.OrdinalIgnoreCase)) + { + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTree(document.RootElement, options); + } + + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options.ToXmlOptions(), SampleTypeSpecContext.Default); + } + using Stream stream = response.ContentStream; + if (stream == null) + { + return default; + } + + return DeserializeTree(XElement.Load(stream, LoadOptions.PreserveWhitespace), options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnionCat.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnionCat.Serialization.cs index ec67ac876b5..751f50b1e40 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnionCat.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnionCat.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator UnionCat(ClientResult result) return DeserializeUnionCat(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static UnionCat FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnionCat(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnionDog.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnionDog.Serialization.cs index 0a8fae55e16..01bdcac2933 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnionDog.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnionDog.Serialization.cs @@ -69,6 +69,19 @@ public static explicit operator UnionDog(ClientResult result) return DeserializeUnionDog(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static UnionDog FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnionDog(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnionPet.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnionPet.Serialization.cs index 18616419207..573effb81c9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnionPet.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnionPet.Serialization.cs @@ -172,9 +172,9 @@ internal static UnionPet DeserializeUnionPetsUnion(JsonElement element, ModelRea switch (discriminator.GetString()) { case "cat": - return UnionCat.DeserializeUnionCat(discriminator0, options); + return options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(discriminator0.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : UnionCat.DeserializeUnionCat(discriminator0, options); case "dog": - return UnionDog.DeserializeUnionDog(discriminator0, options); + return options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(discriminator0.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : UnionDog.DeserializeUnionDog(discriminator0, options); default: throw new JsonException("Unknown discriminator value for union 'UnionPets'."); } @@ -228,9 +228,9 @@ internal static UnionPet DeserializeAlternateUnionPetsUnion(JsonElement element, switch (discriminator.GetString()) { case "feline": - return UnionCat.DeserializeUnionCat(discriminator0, options); + return options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(discriminator0.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : UnionCat.DeserializeUnionCat(discriminator0, options); case "canine": - return UnionDog.DeserializeUnionDog(discriminator0, options); + return options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(discriminator0.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : UnionDog.DeserializeUnionDog(discriminator0, options); default: throw new JsonException("Unknown discriminator value for union 'AlternateUnionPets'."); } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnionPetContainer.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnionPetContainer.Serialization.cs index e3f5647dd12..d77a28dbb51 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnionPetContainer.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnionPetContainer.Serialization.cs @@ -71,6 +71,13 @@ public static implicit operator BinaryContent(UnionPetContainer unionPetContaine return BinaryContent.Create(unionPetContainer, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The to deserialize the from. public static explicit operator UnionPetContainer(ClientResult result) { @@ -79,6 +86,19 @@ public static explicit operator UnionPetContainer(ClientResult result) return DeserializeUnionPetContainer(document.RootElement, ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static UnionPetContainer FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnionPetContainer(document.RootElement, options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Wrapper.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Wrapper.Serialization.cs index 39a4f0f0767..2ba0bb83bfc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Wrapper.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Wrapper.Serialization.cs @@ -130,7 +130,7 @@ internal static Wrapper DeserializeWrapper(JsonElement element, ModelReaderWrite { if (prop.NameEquals("action"u8)) { - action = RoundTripModel.DeserializeRoundTripModel(prop.Value, options); + action = options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(prop.Value.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : RoundTripModel.DeserializeRoundTripModel(prop.Value, options); continue; } if (options.Format != "W") diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlAdvancedModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlAdvancedModel.Serialization.cs index 5792b8a6f46..a2e4a817022 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlAdvancedModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlAdvancedModel.Serialization.cs @@ -87,6 +87,13 @@ public static implicit operator BinaryContent(XmlAdvancedModel xmlAdvancedModel) return BinaryContent.Create(xmlAdvancedModel, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The to deserialize the from. public static explicit operator XmlAdvancedModel(ClientResult result) { @@ -100,6 +107,24 @@ public static explicit operator XmlAdvancedModel(ClientResult result) return DeserializeXmlAdvancedModel(XElement.Load(stream, LoadOptions.PreserveWhitespace), ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static XmlAdvancedModel FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using Stream stream = response.ContentStream; + if (stream == null) + { + return default; + } + + return DeserializeXmlAdvancedModel(XElement.Load(stream, LoadOptions.PreserveWhitespace), options); + } + /// The XML writer. /// The client options for reading and writing models. /// An optional name hint. @@ -499,7 +524,7 @@ internal static XmlAdvancedModel DeserializeXmlAdvancedModel(XElement element, M } if (localName == "unwrappedItems") { - unwrappedItems.Add(XmlItem.DeserializeXmlItem(child, options)); + unwrappedItems.Add(options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(child.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : XmlItem.DeserializeXmlItem(child, options)); continue; } if (localName == "wrappedColors") @@ -517,19 +542,19 @@ internal static XmlAdvancedModel DeserializeXmlAdvancedModel(XElement element, M List array = new List(); foreach (var e in child.Elements("Item")) { - array.Add(XmlItem.DeserializeXmlItem(e, options)); + array.Add(options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(e.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : XmlItem.DeserializeXmlItem(e, options)); } items = array; continue; } if (localName == "nestedModel") { - nestedModel = XmlNestedModel.DeserializeXmlNestedModel(child, options); + nestedModel = options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(child.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : XmlNestedModel.DeserializeXmlNestedModel(child, options); continue; } if (localName == "optionalNestedModel") { - optionalNestedModel = XmlNestedModel.DeserializeXmlNestedModel(child, options); + optionalNestedModel = options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(child.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : XmlNestedModel.DeserializeXmlNestedModel(child, options); continue; } if (localName == "metadata") @@ -604,7 +629,7 @@ internal static XmlAdvancedModel DeserializeXmlAdvancedModel(XElement element, M } if (localName == "anotherModel" && ns == anotherModelNs) { - anotherModel = XmlNestedModel.DeserializeXmlNestedModel(child, options); + anotherModel = options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(child.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : XmlNestedModel.DeserializeXmlNestedModel(child, options); continue; } if (localName == "modelsWithNamespaces") @@ -612,14 +637,14 @@ internal static XmlAdvancedModel DeserializeXmlAdvancedModel(XElement element, M List array = new List(); foreach (var e in child.Elements(modelsWithNamespacesNs + "XmlModelWithNamespace")) { - array.Add(XmlModelWithNamespace.DeserializeXmlModelWithNamespace(e, options)); + array.Add(options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(e.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : XmlModelWithNamespace.DeserializeXmlModelWithNamespace(e, options)); } modelsWithNamespaces = array; continue; } if (localName == "unwrappedModelsWithNamespaces") { - unwrappedModelsWithNamespaces.Add(XmlModelWithNamespace.DeserializeXmlModelWithNamespace(child, options)); + unwrappedModelsWithNamespaces.Add(options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(child.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : XmlModelWithNamespace.DeserializeXmlModelWithNamespace(child, options)); continue; } if (localName == "listOfListFoo") @@ -630,7 +655,7 @@ internal static XmlAdvancedModel DeserializeXmlAdvancedModel(XElement element, M List list = new List(); foreach (var item in e.Elements()) { - list.Add(XmlItem.DeserializeXmlItem(item, options)); + list.Add(options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(item.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : XmlItem.DeserializeXmlItem(item, options)); } array.Add(list); } @@ -642,7 +667,7 @@ internal static XmlAdvancedModel DeserializeXmlAdvancedModel(XElement element, M Dictionary dictionary = new Dictionary(); foreach (var e in child.Elements()) { - dictionary.Add(e.Name.LocalName, XmlItem.DeserializeXmlItem(e, options)); + dictionary.Add(e.Name.LocalName, options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(e.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : XmlItem.DeserializeXmlItem(e, options)); } dictionaryFoo = dictionary; continue; @@ -655,7 +680,7 @@ internal static XmlAdvancedModel DeserializeXmlAdvancedModel(XElement element, M Dictionary dict = new Dictionary(); foreach (var item in e.Elements()) { - dict.Add(item.Name.LocalName, XmlItem.DeserializeXmlItem(item, options)); + dict.Add(item.Name.LocalName, options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(item.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : XmlItem.DeserializeXmlItem(item, options)); } dictionary.Add(e.Name.LocalName, dict); } @@ -670,7 +695,7 @@ internal static XmlAdvancedModel DeserializeXmlAdvancedModel(XElement element, M List list = new List(); foreach (var item in e.Elements()) { - list.Add(XmlItem.DeserializeXmlItem(item, options)); + list.Add(options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(item.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : XmlItem.DeserializeXmlItem(item, options)); } dictionary.Add(e.Name.LocalName, list); } @@ -685,7 +710,7 @@ internal static XmlAdvancedModel DeserializeXmlAdvancedModel(XElement element, M Dictionary dict = new Dictionary(); foreach (var item in e.Elements()) { - dict.Add(item.Name.LocalName, XmlItem.DeserializeXmlItem(item, options)); + dict.Add(item.Name.LocalName, options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(item.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : XmlItem.DeserializeXmlItem(item, options)); } array.Add(dict); } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlConstructorOverride.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlConstructorOverride.Serialization.cs index 6a9c9cdac38..f0a50256110 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlConstructorOverride.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlConstructorOverride.Serialization.cs @@ -86,6 +86,13 @@ public static implicit operator BinaryContent(XmlConstructorOverride xmlConstruc return BinaryContent.Create(xmlConstructorOverride, ModelSerializationExtensions.WireOptions); } + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) + { + return BinaryContent.Create(this, options); + } + /// The XML writer. /// The client options for reading and writing models. /// An optional name hint. diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlUnionCat.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlUnionCat.Serialization.cs index 2379e622e56..afffa11e99b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlUnionCat.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlUnionCat.Serialization.cs @@ -105,6 +105,35 @@ public static explicit operator XmlUnionCat(ClientResult result) return DeserializeXmlUnionCat(XElement.Load(stream, LoadOptions.PreserveWhitespace), ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static new XmlUnionCat FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + + if (response.Headers.TryGetValue("Content-Type", out string value) && value.StartsWith("application/json", StringComparison.OrdinalIgnoreCase)) + { + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeXmlUnionCat(document.RootElement, options); + } + + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options.ToXmlOptions(), SampleTypeSpecContext.Default); + } + using Stream stream = response.ContentStream; + if (stream == null) + { + return default; + } + + return DeserializeXmlUnionCat(XElement.Load(stream, LoadOptions.PreserveWhitespace), options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlUnionPet.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlUnionPet.Serialization.cs index 9abb9feb40a..fd3e5dce926 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlUnionPet.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlUnionPet.Serialization.cs @@ -95,11 +95,10 @@ public static implicit operator BinaryContent(XmlUnionPet xmlUnionPet) return BinaryContent.Create(xmlUnionPet, ModelSerializationExtensions.WireOptions); } - /// Converts the model to BinaryContent using the specified format. - /// The format to use for serialization. - internal BinaryContent ToBinaryContent(string format) + /// Converts the model to BinaryContent using the specified options. + /// The options used to write the model, including the registered model proxies. + internal BinaryContent ToBinaryContent(ModelReaderWriterOptions options) { - ModelReaderWriterOptions options = new ModelReaderWriterOptions(format); return BinaryContent.Create(this, options); } @@ -123,6 +122,35 @@ public static explicit operator XmlUnionPet(ClientResult result) return DeserializeXmlUnionPet(XElement.Load(stream, LoadOptions.PreserveWhitespace), ModelSerializationExtensions.WireOptions); } + /// The to deserialize the from. + /// The options used to read the model, including the registered model proxies. + internal static XmlUnionPet FromClientResult(ClientResult result, ModelReaderWriterOptions options) + { + PipelineResponse response = result.GetRawResponse(); + + if (response.Headers.TryGetValue("Content-Type", out string value) && value.StartsWith("application/json", StringComparison.OrdinalIgnoreCase)) + { + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options, SampleTypeSpecContext.Default); + } + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeXmlUnionPet(document.RootElement, options); + } + + if (options.ShouldReadThroughProxy(SampleTypeSpecContext.Default)) + { + return ModelReaderWriter.Read(response.Content, options.ToXmlOptions(), SampleTypeSpecContext.Default); + } + using Stream stream = response.ContentStream; + if (stream == null) + { + return default; + } + + return DeserializeXmlUnionPet(XElement.Load(stream, LoadOptions.PreserveWhitespace), options); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -240,7 +268,7 @@ internal static XmlUnionPet DeserializeXmlUnionPetsUnion(JsonElement element, Mo switch (discriminator.GetString()) { case "cat": - return XmlUnionCat.DeserializeXmlUnionCat(discriminator0, options); + return options.ShouldReadThroughProxy(SampleTypeSpecContext.Default) ? ModelReaderWriter.Read(discriminator0.GetUtf8Bytes(), options, SampleTypeSpecContext.Default) : XmlUnionCat.DeserializeXmlUnionCat(discriminator0, options); default: throw new JsonException("Unknown discriminator value for union 'XmlUnionPets'."); } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Notebooks.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Notebooks.cs index 1fecec56e9e..13fad2632dd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Notebooks.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Notebooks.cs @@ -19,6 +19,7 @@ namespace SampleTypeSpec public partial class Notebooks { private readonly Uri _endpoint; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions = ModelSerializationExtensions.WireOptions; private const string AuthorizationHeader = "my-api-key"; /// The OAuth2 flows supported by the service. private static readonly Dictionary[] _flows = new Dictionary[] @@ -39,12 +40,14 @@ protected Notebooks() /// Initializes a new instance of Notebooks. /// The HTTP pipeline for sending and receiving REST requests and responses. + /// /// Service endpoint. /// - internal Notebooks(ClientPipeline pipeline, Uri endpoint, string notebook) + internal Notebooks(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, string notebook) { _endpoint = endpoint; Pipeline = pipeline; + _modelReaderWriterOptions = modelReaderWriterOptions; _notebook = notebook; } @@ -90,6 +93,7 @@ internal Notebooks(AuthenticationPolicy authenticationPolicy, Uri endpoint, stri { Pipeline = ClientPipeline.Create(options, Array.Empty(), new PipelinePolicy[] { new UserAgentPolicy(typeof(Notebooks).Assembly) }, Array.Empty()); } + _modelReaderWriterOptions = options.ModelProxies.ToWireOptions(); } /// Initializes a new instance of Notebooks. @@ -164,7 +168,7 @@ public virtual async Task GetNotebookAsync(RequestOptions options) public virtual ClientResult GetNotebook(CancellationToken cancellationToken = default) { ClientResult result = GetNotebook(cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((GetNotebookResult)result, result.GetRawResponse()); + return ClientResult.FromValue(GetNotebookResult.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Get a notebook by name. @@ -173,7 +177,7 @@ public virtual ClientResult GetNotebook(CancellationToken can public virtual async Task> GetNotebookAsync(CancellationToken cancellationToken = default) { ClientResult result = await GetNotebookAsync(cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((GetNotebookResult)result, result.GetRawResponse()); + return ClientResult.FromValue(GetNotebookResult.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/PetOperations.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/PetOperations.cs index 7f7531baa9d..eb9d413ba53 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/PetOperations.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/PetOperations.cs @@ -17,6 +17,7 @@ namespace SampleTypeSpec public partial class PetOperations { private readonly Uri _endpoint; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions = ModelSerializationExtensions.WireOptions; /// Initializes a new instance of PetOperations for mocking. protected PetOperations() @@ -25,11 +26,13 @@ protected PetOperations() /// Initializes a new instance of PetOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. + /// /// Service endpoint. - internal PetOperations(ClientPipeline pipeline, Uri endpoint) + internal PetOperations(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) { _endpoint = endpoint; Pipeline = pipeline; + _modelReaderWriterOptions = modelReaderWriterOptions; } /// The HTTP pipeline for sending and receiving REST requests and responses. @@ -86,8 +89,8 @@ public virtual ClientResult UpdatePetAsPet(Pet pet, CancellationToken cance { Argument.AssertNotNull(pet, nameof(pet)); - ClientResult result = UpdatePetAsPet(pet, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((Pet)result, result.GetRawResponse()); + ClientResult result = UpdatePetAsPet(pet.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); + return ClientResult.FromValue(Pet.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Update a pet as a pet. @@ -99,8 +102,8 @@ public virtual async Task> UpdatePetAsPetAsync(Pet pet, Cancel { Argument.AssertNotNull(pet, nameof(pet)); - ClientResult result = await UpdatePetAsPetAsync(pet, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((Pet)result, result.GetRawResponse()); + ClientResult result = await UpdatePetAsPetAsync(pet.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue(Pet.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -154,8 +157,8 @@ public virtual ClientResult UpdateDogAsPet(Pet pet, CancellationToken cance { Argument.AssertNotNull(pet, nameof(pet)); - ClientResult result = UpdateDogAsPet(pet, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((Pet)result, result.GetRawResponse()); + ClientResult result = UpdateDogAsPet(pet.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); + return ClientResult.FromValue(Pet.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Update a dog as a pet. @@ -167,8 +170,8 @@ public virtual async Task> UpdateDogAsPetAsync(Pet pet, Cancel { Argument.AssertNotNull(pet, nameof(pet)); - ClientResult result = await UpdateDogAsPetAsync(pet, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((Pet)result, result.GetRawResponse()); + ClientResult result = await UpdateDogAsPetAsync(pet.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue(Pet.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/PlantOperations.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/PlantOperations.cs index 6db6d1ce51e..c7f18920a6c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/PlantOperations.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/PlantOperations.cs @@ -17,6 +17,7 @@ namespace SampleTypeSpec public partial class PlantOperations { private readonly Uri _endpoint; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions = ModelSerializationExtensions.WireOptions; /// Initializes a new instance of PlantOperations for mocking. protected PlantOperations() @@ -25,11 +26,13 @@ protected PlantOperations() /// Initializes a new instance of PlantOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. + /// /// Service endpoint. - internal PlantOperations(ClientPipeline pipeline, Uri endpoint) + internal PlantOperations(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) { _endpoint = endpoint; Pipeline = pipeline; + _modelReaderWriterOptions = modelReaderWriterOptions; } /// The HTTP pipeline for sending and receiving REST requests and responses. @@ -75,7 +78,7 @@ public virtual async Task GetTreeAsync(RequestOptions options) public virtual ClientResult GetTree(CancellationToken cancellationToken = default) { ClientResult result = GetTree(cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((Tree)result, result.GetRawResponse()); + return ClientResult.FromValue(Tree.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Get a tree as a plant. @@ -84,7 +87,7 @@ public virtual ClientResult GetTree(CancellationToken cancellationToken = public virtual async Task> GetTreeAsync(CancellationToken cancellationToken = default) { ClientResult result = await GetTreeAsync(cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((Tree)result, result.GetRawResponse()); + return ClientResult.FromValue(Tree.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -127,7 +130,7 @@ public virtual async Task GetTreeAsJsonAsync(RequestOptions option public virtual ClientResult GetTreeAsJson(CancellationToken cancellationToken = default) { ClientResult result = GetTreeAsJson(cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((Tree)result, result.GetRawResponse()); + return ClientResult.FromValue(Tree.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Get a tree as a plant. @@ -136,7 +139,7 @@ public virtual ClientResult GetTreeAsJson(CancellationToken cancellationTo public virtual async Task> GetTreeAsJsonAsync(CancellationToken cancellationToken = default) { ClientResult result = await GetTreeAsJsonAsync(cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((Tree)result, result.GetRawResponse()); + return ClientResult.FromValue(Tree.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -190,9 +193,9 @@ public virtual ClientResult UpdateTree(Tree tree, CancellationToken cancel { Argument.AssertNotNull(tree, nameof(tree)); - using BinaryContent content = tree.ToBinaryContent("X"); + using BinaryContent content = tree.ToBinaryContent(_modelReaderWriterOptions.ToXmlOptions()); ClientResult result = UpdateTree(content, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((Tree)result, result.GetRawResponse()); + return ClientResult.FromValue(Tree.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Update a tree as a plant. @@ -204,9 +207,9 @@ public virtual async Task> UpdateTreeAsync(Tree tree, Cancell { Argument.AssertNotNull(tree, nameof(tree)); - using BinaryContent content = tree.ToBinaryContent("X"); + using BinaryContent content = tree.ToBinaryContent(_modelReaderWriterOptions.ToXmlOptions()); ClientResult result = await UpdateTreeAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((Tree)result, result.GetRawResponse()); + return ClientResult.FromValue(Tree.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -260,9 +263,9 @@ public virtual ClientResult UpdateTreeAsJson(Tree tree, CancellationToken { Argument.AssertNotNull(tree, nameof(tree)); - using BinaryContent content = tree.ToBinaryContent("J"); + using BinaryContent content = tree.ToBinaryContent(_modelReaderWriterOptions); ClientResult result = UpdateTreeAsJson(content, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((Tree)result, result.GetRawResponse()); + return ClientResult.FromValue(Tree.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Update a tree as a plant. @@ -274,9 +277,9 @@ public virtual async Task> UpdateTreeAsJsonAsync(Tree tree, C { Argument.AssertNotNull(tree, nameof(tree)); - using BinaryContent content = tree.ToBinaryContent("J"); + using BinaryContent content = tree.ToBinaryContent(_modelReaderWriterOptions); ClientResult result = await UpdateTreeAsJsonAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((Tree)result, result.GetRawResponse()); + return ClientResult.FromValue(Tree.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs index e6b211b5bab..8cee9356e00 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs @@ -22,6 +22,7 @@ namespace SampleTypeSpec public partial class SampleTypeSpecClient { private readonly Uri _endpoint; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions = ModelSerializationExtensions.WireOptions; private const string AuthorizationHeader = "my-api-key"; /// The OAuth2 flows supported by the service. private static readonly Dictionary[] _flows = new Dictionary[] @@ -76,6 +77,7 @@ internal SampleTypeSpecClient(AuthenticationPolicy authenticationPolicy, Uri end { Pipeline = ClientPipeline.Create(options, Array.Empty(), new PipelinePolicy[] { new UserAgentPolicy(typeof(SampleTypeSpecClient).Assembly) }, Array.Empty()); } + _modelReaderWriterOptions = options.ModelProxies.ToWireOptions(); _apiVersion = options.Version; } @@ -171,7 +173,7 @@ public virtual ClientResult SayHi(string headParameter, string queryParam Argument.AssertNotNullOrEmpty(queryParameter, nameof(queryParameter)); ClientResult result = SayHi(headParameter, queryParameter, optionalQuery, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((Thing)result, result.GetRawResponse()); + return ClientResult.FromValue(Thing.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Return hi. @@ -188,7 +190,7 @@ public virtual async Task> SayHiAsync(string headParameter, Argument.AssertNotNullOrEmpty(queryParameter, nameof(queryParameter)); ClientResult result = await SayHiAsync(headParameter, queryParameter, optionalQuery, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((Thing)result, result.GetRawResponse()); + return ClientResult.FromValue(Thing.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -257,8 +259,8 @@ public virtual ClientResult HelloAgain(string p2, string p1, Rou Argument.AssertNotNullOrEmpty(p1, nameof(p1)); Argument.AssertNotNull(action, nameof(action)); - ClientResult result = HelloAgain(p2, p1, action, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((RoundTripModel)result, result.GetRawResponse()); + ClientResult result = HelloAgain(p2, p1, action.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); + return ClientResult.FromValue(RoundTripModel.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Return hi again. @@ -275,8 +277,8 @@ public virtual async Task> HelloAgainAsync(string p Argument.AssertNotNullOrEmpty(p1, nameof(p1)); Argument.AssertNotNull(action, nameof(action)); - ClientResult result = await HelloAgainAsync(p2, p1, action, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((RoundTripModel)result, result.GetRawResponse()); + ClientResult result = await HelloAgainAsync(p2, p1, action.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue(RoundTripModel.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -341,7 +343,7 @@ public virtual ClientResult NoContentType(Wrapper info, Cancella Argument.AssertNotNull(info, nameof(info)); ClientResult result = NoContentType(info.P2, info.P1, info.Action, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((RoundTripModel)result, result.GetRawResponse()); + return ClientResult.FromValue(RoundTripModel.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Return hi again. @@ -354,7 +356,7 @@ public virtual async Task> NoContentTypeAsync(Wrapp Argument.AssertNotNull(info, nameof(info)); ClientResult result = await NoContentTypeAsync(info.P2, info.P1, info.Action, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((RoundTripModel)result, result.GetRawResponse()); + return ClientResult.FromValue(RoundTripModel.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -400,7 +402,7 @@ public virtual async Task HelloDemo2Async(RequestOptions options) public virtual ClientResult HelloDemo2(CancellationToken cancellationToken = default) { ClientResult result = HelloDemo2(cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((Thing)result, result.GetRawResponse()); + return ClientResult.FromValue(Thing.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Return hi in demo2. @@ -410,7 +412,7 @@ public virtual ClientResult HelloDemo2(CancellationToken cancellationToke public virtual async Task> HelloDemo2Async(CancellationToken cancellationToken = default) { ClientResult result = await HelloDemo2Async(cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((Thing)result, result.GetRawResponse()); + return ClientResult.FromValue(Thing.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -464,8 +466,8 @@ public virtual ClientResult CreateLiteral(Thing body, CancellationToken c { Argument.AssertNotNull(body, nameof(body)); - ClientResult result = CreateLiteral(body, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((Thing)result, result.GetRawResponse()); + ClientResult result = CreateLiteral(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); + return ClientResult.FromValue(Thing.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Create with literal value. @@ -477,8 +479,8 @@ public virtual async Task> CreateLiteralAsync(Thing body, Ca { Argument.AssertNotNull(body, nameof(body)); - ClientResult result = await CreateLiteralAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((Thing)result, result.GetRawResponse()); + ClientResult result = await CreateLiteralAsync(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue(Thing.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -521,7 +523,7 @@ public virtual async Task HelloLiteralAsync(RequestOptions options public virtual ClientResult HelloLiteral(CancellationToken cancellationToken = default) { ClientResult result = HelloLiteral(cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((Thing)result, result.GetRawResponse()); + return ClientResult.FromValue(Thing.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Send literal parameters. @@ -530,7 +532,7 @@ public virtual ClientResult HelloLiteral(CancellationToken cancellationTo public virtual async Task> HelloLiteralAsync(CancellationToken cancellationToken = default) { ClientResult result = await HelloLiteralAsync(cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((Thing)result, result.GetRawResponse()); + return ClientResult.FromValue(Thing.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -576,7 +578,7 @@ public virtual async Task TopActionAsync(DateTimeOffset action, Re public virtual ClientResult TopAction(DateTimeOffset action, CancellationToken cancellationToken = default) { ClientResult result = TopAction(action, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((Thing)result, result.GetRawResponse()); + return ClientResult.FromValue(Thing.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// top level method. @@ -586,7 +588,7 @@ public virtual ClientResult TopAction(DateTimeOffset action, Cancellation public virtual async Task> TopActionAsync(DateTimeOffset action, CancellationToken cancellationToken = default) { ClientResult result = await TopActionAsync(action, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((Thing)result, result.GetRawResponse()); + return ClientResult.FromValue(Thing.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -754,8 +756,8 @@ public virtual ClientResult AnonymousBody(string name, BinaryData require requiredNullableList?.ToList() as IList ?? new ChangeTrackingList(), propertyWithSpecialDocs, default); - ClientResult result = AnonymousBody(spreadModel, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((Thing)result, result.GetRawResponse()); + ClientResult result = AnonymousBody(spreadModel.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); + return ClientResult.FromValue(Thing.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// body parameter without body decorator. @@ -805,8 +807,8 @@ public virtual async Task> AnonymousBodyAsync(string name, B requiredNullableList?.ToList() as IList ?? new ChangeTrackingList(), propertyWithSpecialDocs, default); - ClientResult result = await AnonymousBodyAsync(spreadModel, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((Thing)result, result.GetRawResponse()); + ClientResult result = await AnonymousBodyAsync(spreadModel.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue(Thing.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -862,8 +864,8 @@ public virtual ClientResult FriendlyModel(string name, CancellationToken Argument.AssertNotNullOrEmpty(name, nameof(name)); Friend spreadModel = new Friend(name, default); - ClientResult result = FriendlyModel(spreadModel, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((Friend)result, result.GetRawResponse()); + ClientResult result = FriendlyModel(spreadModel.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); + return ClientResult.FromValue(Friend.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Model can have its friendly name. @@ -877,8 +879,8 @@ public virtual async Task> FriendlyModelAsync(string name, Argument.AssertNotNullOrEmpty(name, nameof(name)); Friend spreadModel = new Friend(name, default); - ClientResult result = await FriendlyModelAsync(spreadModel, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((Friend)result, result.GetRawResponse()); + ClientResult result = await FriendlyModelAsync(spreadModel.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue(Friend.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -984,8 +986,8 @@ public virtual ClientResult ProjectedNameModel(string otherN Argument.AssertNotNullOrEmpty(otherName, nameof(otherName)); RenamedModelCustom spreadModel = new RenamedModelCustom(default, otherName); - ClientResult result = ProjectedNameModel(spreadModel, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((RenamedModelCustom)result, result.GetRawResponse()); + ClientResult result = ProjectedNameModel(spreadModel.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); + return ClientResult.FromValue(RenamedModelCustom.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Model can have its projected name. @@ -999,8 +1001,8 @@ public virtual async Task> ProjectedNameModelAs Argument.AssertNotNullOrEmpty(otherName, nameof(otherName)); RenamedModelCustom spreadModel = new RenamedModelCustom(default, otherName); - ClientResult result = await ProjectedNameModelAsync(spreadModel, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((RenamedModelCustom)result, result.GetRawResponse()); + ClientResult result = await ProjectedNameModelAsync(spreadModel.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue(RenamedModelCustom.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -1043,7 +1045,7 @@ public virtual async Task ReturnsAnonymousModelAsync(RequestOption public virtual ClientResult ReturnsAnonymousModel(CancellationToken cancellationToken = default) { ClientResult result = ReturnsAnonymousModel(cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((ReturnsAnonymousModelResult)result, result.GetRawResponse()); + return ClientResult.FromValue(ReturnsAnonymousModelResult.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// return anonymous model. @@ -1052,7 +1054,7 @@ public virtual ClientResult ReturnsAnonymousModel(C public virtual async Task> ReturnsAnonymousModelAsync(CancellationToken cancellationToken = default) { ClientResult result = await ReturnsAnonymousModelAsync(cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((ReturnsAnonymousModelResult)result, result.GetRawResponse()); + return ClientResult.FromValue(ReturnsAnonymousModelResult.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -1154,8 +1156,8 @@ public virtual ClientResult InternalProtocol(Thing body, CancellationToke { Argument.AssertNotNull(body, nameof(body)); - ClientResult result = InternalProtocol(body, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((Thing)result, result.GetRawResponse()); + ClientResult result = InternalProtocol(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); + return ClientResult.FromValue(Thing.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// When set protocol false and convenient true, then the protocol method should be internal. @@ -1167,8 +1169,8 @@ public virtual async Task> InternalProtocolAsync(Thing body, { Argument.AssertNotNull(body, nameof(body)); - ClientResult result = await InternalProtocolAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((Thing)result, result.GetRawResponse()); + ClientResult result = await InternalProtocolAsync(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue(Thing.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -1374,7 +1376,7 @@ public virtual async Task WithApiVersionAsync(string p1, Cancellat /// The response returned from the service. public virtual CollectionResult GetWithNextLink(RequestOptions options) { - return new SampleTypeSpecClientGetWithNextLinkCollectionResult(this, options); + return new SampleTypeSpecClientGetWithNextLinkCollectionResult(this, _modelReaderWriterOptions, options); } /// @@ -1390,7 +1392,7 @@ public virtual CollectionResult GetWithNextLink(RequestOptions options) /// The response returned from the service. public virtual AsyncCollectionResult GetWithNextLinkAsync(RequestOptions options) { - return new SampleTypeSpecClientGetWithNextLinkAsyncCollectionResult(this, options); + return new SampleTypeSpecClientGetWithNextLinkAsyncCollectionResult(this, _modelReaderWriterOptions, options); } /// List things with nextlink. @@ -1398,7 +1400,7 @@ public virtual AsyncCollectionResult GetWithNextLinkAsync(RequestOptions options /// Service returned a non-success status code. public virtual CollectionResult GetWithNextLink(CancellationToken cancellationToken = default) { - return new SampleTypeSpecClientGetWithNextLinkCollectionResultOfT(this, cancellationToken.ToRequestOptions()); + return new SampleTypeSpecClientGetWithNextLinkCollectionResultOfT(this, _modelReaderWriterOptions, cancellationToken.ToRequestOptions()); } /// List things with nextlink. @@ -1406,7 +1408,7 @@ public virtual CollectionResult GetWithNextLink(CancellationToken cancell /// Service returned a non-success status code. public virtual AsyncCollectionResult GetWithNextLinkAsync(CancellationToken cancellationToken = default) { - return new SampleTypeSpecClientGetWithNextLinkAsyncCollectionResultOfT(this, cancellationToken.ToRequestOptions()); + return new SampleTypeSpecClientGetWithNextLinkAsyncCollectionResultOfT(this, _modelReaderWriterOptions, cancellationToken.ToRequestOptions()); } /// @@ -1422,7 +1424,7 @@ public virtual AsyncCollectionResult GetWithNextLinkAsync(CancellationTok /// The response returned from the service. public virtual CollectionResult GetWithStringNextLink(RequestOptions options) { - return new SampleTypeSpecClientGetWithStringNextLinkCollectionResult(this, options); + return new SampleTypeSpecClientGetWithStringNextLinkCollectionResult(this, _modelReaderWriterOptions, options); } /// @@ -1438,7 +1440,7 @@ public virtual CollectionResult GetWithStringNextLink(RequestOptions options) /// The response returned from the service. public virtual AsyncCollectionResult GetWithStringNextLinkAsync(RequestOptions options) { - return new SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResult(this, options); + return new SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResult(this, _modelReaderWriterOptions, options); } /// List things with nextlink. @@ -1446,7 +1448,7 @@ public virtual AsyncCollectionResult GetWithStringNextLinkAsync(RequestOptions o /// Service returned a non-success status code. public virtual CollectionResult GetWithStringNextLink(CancellationToken cancellationToken = default) { - return new SampleTypeSpecClientGetWithStringNextLinkCollectionResultOfT(this, cancellationToken.ToRequestOptions()); + return new SampleTypeSpecClientGetWithStringNextLinkCollectionResultOfT(this, _modelReaderWriterOptions, cancellationToken.ToRequestOptions()); } /// List things with nextlink. @@ -1454,7 +1456,7 @@ public virtual CollectionResult GetWithStringNextLink(CancellationToken c /// Service returned a non-success status code. public virtual AsyncCollectionResult GetWithStringNextLinkAsync(CancellationToken cancellationToken = default) { - return new SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResultOfT(this, cancellationToken.ToRequestOptions()); + return new SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResultOfT(this, _modelReaderWriterOptions, cancellationToken.ToRequestOptions()); } /// @@ -1471,7 +1473,7 @@ public virtual AsyncCollectionResult GetWithStringNextLinkAsync(Cancellat /// The response returned from the service. public virtual CollectionResult GetWithContinuationToken(string token, RequestOptions options) { - return new SampleTypeSpecClientGetWithContinuationTokenCollectionResult(this, token, options); + return new SampleTypeSpecClientGetWithContinuationTokenCollectionResult(this, _modelReaderWriterOptions, token, options); } /// @@ -1488,7 +1490,7 @@ public virtual CollectionResult GetWithContinuationToken(string token, RequestOp /// The response returned from the service. public virtual AsyncCollectionResult GetWithContinuationTokenAsync(string token, RequestOptions options) { - return new SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResult(this, token, options); + return new SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResult(this, _modelReaderWriterOptions, token, options); } /// List things with continuation token. @@ -1497,7 +1499,7 @@ public virtual AsyncCollectionResult GetWithContinuationTokenAsync(string token, /// Service returned a non-success status code. public virtual CollectionResult GetWithContinuationToken(string token = default, CancellationToken cancellationToken = default) { - return new SampleTypeSpecClientGetWithContinuationTokenCollectionResultOfT(this, token, cancellationToken.ToRequestOptions()); + return new SampleTypeSpecClientGetWithContinuationTokenCollectionResultOfT(this, _modelReaderWriterOptions, token, cancellationToken.ToRequestOptions()); } /// List things with continuation token. @@ -1506,7 +1508,7 @@ public virtual CollectionResult GetWithContinuationToken(string token = d /// Service returned a non-success status code. public virtual AsyncCollectionResult GetWithContinuationTokenAsync(string token = default, CancellationToken cancellationToken = default) { - return new SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResultOfT(this, token, cancellationToken.ToRequestOptions()); + return new SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResultOfT(this, _modelReaderWriterOptions, token, cancellationToken.ToRequestOptions()); } /// @@ -1523,7 +1525,7 @@ public virtual AsyncCollectionResult GetWithContinuationTokenAsync(string /// The response returned from the service. public virtual CollectionResult GetWithContinuationTokenHeaderResponse(string token, RequestOptions options) { - return new SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResult(this, token, options); + return new SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResult(this, _modelReaderWriterOptions, token, options); } /// @@ -1540,7 +1542,7 @@ public virtual CollectionResult GetWithContinuationTokenHeaderResponse(string to /// The response returned from the service. public virtual AsyncCollectionResult GetWithContinuationTokenHeaderResponseAsync(string token, RequestOptions options) { - return new SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResult(this, token, options); + return new SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResult(this, _modelReaderWriterOptions, token, options); } /// List things with continuation token header response. @@ -1549,7 +1551,7 @@ public virtual AsyncCollectionResult GetWithContinuationTokenHeaderResponseAsync /// Service returned a non-success status code. public virtual CollectionResult GetWithContinuationTokenHeaderResponse(string token = default, CancellationToken cancellationToken = default) { - return new SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResultOfT(this, token, cancellationToken.ToRequestOptions()); + return new SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResultOfT(this, _modelReaderWriterOptions, token, cancellationToken.ToRequestOptions()); } /// List things with continuation token header response. @@ -1558,7 +1560,7 @@ public virtual CollectionResult GetWithContinuationTokenHeaderResponse(st /// Service returned a non-success status code. public virtual AsyncCollectionResult GetWithContinuationTokenHeaderResponseAsync(string token = default, CancellationToken cancellationToken = default) { - return new SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResultOfT(this, token, cancellationToken.ToRequestOptions()); + return new SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResultOfT(this, _modelReaderWriterOptions, token, cancellationToken.ToRequestOptions()); } /// @@ -1574,7 +1576,7 @@ public virtual AsyncCollectionResult GetWithContinuationTokenHeaderRespon /// The response returned from the service. public virtual CollectionResult GetWithPaging(RequestOptions options) { - return new SampleTypeSpecClientGetWithPagingCollectionResult(this, options); + return new SampleTypeSpecClientGetWithPagingCollectionResult(this, _modelReaderWriterOptions, options); } /// @@ -1590,7 +1592,7 @@ public virtual CollectionResult GetWithPaging(RequestOptions options) /// The response returned from the service. public virtual AsyncCollectionResult GetWithPagingAsync(RequestOptions options) { - return new SampleTypeSpecClientGetWithPagingAsyncCollectionResult(this, options); + return new SampleTypeSpecClientGetWithPagingAsyncCollectionResult(this, _modelReaderWriterOptions, options); } /// List things with paging. @@ -1598,7 +1600,7 @@ public virtual AsyncCollectionResult GetWithPagingAsync(RequestOptions options) /// Service returned a non-success status code. public virtual CollectionResult GetWithPaging(CancellationToken cancellationToken = default) { - return new SampleTypeSpecClientGetWithPagingCollectionResultOfT(this, cancellationToken.ToRequestOptions()); + return new SampleTypeSpecClientGetWithPagingCollectionResultOfT(this, _modelReaderWriterOptions, cancellationToken.ToRequestOptions()); } /// List things with paging. @@ -1606,7 +1608,7 @@ public virtual CollectionResult GetWithPaging(CancellationToken cancellat /// Service returned a non-success status code. public virtual AsyncCollectionResult GetWithPagingAsync(CancellationToken cancellationToken = default) { - return new SampleTypeSpecClientGetWithPagingAsyncCollectionResultOfT(this, cancellationToken.ToRequestOptions()); + return new SampleTypeSpecClientGetWithPagingAsyncCollectionResultOfT(this, _modelReaderWriterOptions, cancellationToken.ToRequestOptions()); } /// @@ -1674,7 +1676,7 @@ public virtual ClientResult EmbeddedParameters(ModelWithEmbeddedNonBodyParameter { Argument.AssertNotNull(body, nameof(body)); - return EmbeddedParameters(body.RequiredHeader, body.RequiredQuery, body, body.OptionalHeader, body.OptionalQuery, cancellationToken.ToRequestOptions()); + return EmbeddedParameters(body.RequiredHeader, body.RequiredQuery, body.ToBinaryContent(_modelReaderWriterOptions), body.OptionalHeader, body.OptionalQuery, cancellationToken.ToRequestOptions()); } /// An operation with embedded parameters within the body. @@ -1686,7 +1688,7 @@ public virtual async Task EmbeddedParametersAsync(ModelWithEmbedde { Argument.AssertNotNull(body, nameof(body)); - return await EmbeddedParametersAsync(body.RequiredHeader, body.RequiredQuery, body, body.OptionalHeader, body.OptionalQuery, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return await EmbeddedParametersAsync(body.RequiredHeader, body.RequiredQuery, body.ToBinaryContent(_modelReaderWriterOptions), body.OptionalHeader, body.OptionalQuery, cancellationToken.ToRequestOptions()).ConfigureAwait(false); } /// @@ -1748,7 +1750,7 @@ public virtual ClientResult DynamicModelOperation(DynamicModel body, Cancellatio { Argument.AssertNotNull(body, nameof(body)); - return DynamicModelOperation(body, cancellationToken.ToRequestOptions()); + return DynamicModelOperation(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); } #pragma warning restore SCME0001 // This generated code depends on experimental functionality. @@ -1763,7 +1765,7 @@ public virtual async Task DynamicModelOperationAsync(DynamicModel { Argument.AssertNotNull(body, nameof(body)); - return await DynamicModelOperationAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return await DynamicModelOperationAsync(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); } #pragma warning restore SCME0001 // This generated code depends on experimental functionality. @@ -1807,7 +1809,7 @@ public virtual async Task GetXmlAdvancedModelAsync(RequestOptions public virtual ClientResult GetXmlAdvancedModel(CancellationToken cancellationToken = default) { ClientResult result = GetXmlAdvancedModel(cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((XmlAdvancedModel)result, result.GetRawResponse()); + return ClientResult.FromValue(XmlAdvancedModel.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Get an advanced XML model with various property types. @@ -1816,7 +1818,7 @@ public virtual ClientResult GetXmlAdvancedModel(CancellationTo public virtual async Task> GetXmlAdvancedModelAsync(CancellationToken cancellationToken = default) { ClientResult result = await GetXmlAdvancedModelAsync(cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((XmlAdvancedModel)result, result.GetRawResponse()); + return ClientResult.FromValue(XmlAdvancedModel.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -1870,8 +1872,8 @@ public virtual ClientResult UpdateXmlAdvancedModel(XmlAdvanced { Argument.AssertNotNull(body, nameof(body)); - ClientResult result = UpdateXmlAdvancedModel(body, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((XmlAdvancedModel)result, result.GetRawResponse()); + ClientResult result = UpdateXmlAdvancedModel(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); + return ClientResult.FromValue(XmlAdvancedModel.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// Update an advanced XML model with various property types. @@ -1883,8 +1885,8 @@ public virtual async Task> UpdateXmlAdvancedModel { Argument.AssertNotNull(body, nameof(body)); - ClientResult result = await UpdateXmlAdvancedModelAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((XmlAdvancedModel)result, result.GetRawResponse()); + ClientResult result = await UpdateXmlAdvancedModelAsync(body.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue(XmlAdvancedModel.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -1945,7 +1947,7 @@ public virtual ClientResult UploadCat(Cat body, CancellationToken cancellationTo { Argument.AssertNotNull(body, nameof(body)); - using MultiPartFormContent content = body.ToMultipartFormContent(); + using MultiPartFormContent content = body.ToMultipartFormContent(_modelReaderWriterOptions); return UploadCat(content, content.MediaType, cancellationToken.ToRequestOptions()); } @@ -1959,7 +1961,7 @@ public virtual async Task UploadCatAsync(Cat body, CancellationTok { Argument.AssertNotNull(body, nameof(body)); - using MultiPartFormContent content = body.ToMultipartFormContent(); + using MultiPartFormContent content = body.ToMultipartFormContent(_modelReaderWriterOptions); return await UploadCatAsync(content, content.MediaType, cancellationToken.ToRequestOptions()).ConfigureAwait(false); } @@ -2043,7 +2045,7 @@ public virtual async Task> ReceiveJsonLinesA { using PipelineMessage message = CreateReceiveJsonLinesRequest(cancellationToken.ToRequestOptions()); message.BufferResponse = false; - return AsyncStreamingResult.CreateJsonLines(await Pipeline.ProcessMessageAsync(message, cancellationToken.ToRequestOptions()).ConfigureAwait(false), data => ModelReaderWriter.Read(data, ModelSerializationExtensions.WireOptions, SampleTypeSpecContext.Default), cancellationToken); + return AsyncStreamingResult.CreateJsonLines(await Pipeline.ProcessMessageAsync(message, cancellationToken.ToRequestOptions()).ConfigureAwait(false), data => ModelReaderWriter.Read(data, _modelReaderWriterOptions, SampleTypeSpecContext.Default), cancellationToken); } /// @@ -2071,7 +2073,7 @@ public virtual async Task>> ReceiveS { using PipelineMessage message = CreateReceiveSseRequest(cancellationToken.ToRequestOptions()); message.BufferResponse = false; - return AsyncStreamingResult.CreateSse(await Pipeline.ProcessMessageAsync(message, cancellationToken.ToRequestOptions()).ConfigureAwait(false), (@_, data) => ModelReaderWriter.Read(BinaryData.FromBytes(data.ToArray()), ModelSerializationExtensions.WireOptions, SampleTypeSpecContext.Default), item => item.Data.ToString() == "[DONE]", cancellationToken); + return AsyncStreamingResult.CreateSse(await Pipeline.ProcessMessageAsync(message, cancellationToken.ToRequestOptions()).ConfigureAwait(false), (@_, data) => ModelReaderWriter.Read(BinaryData.FromBytes(data.ToArray()), _modelReaderWriterOptions, SampleTypeSpecContext.Default), item => item.Data.ToString() == "[DONE]", cancellationToken); } /// @@ -2101,9 +2103,9 @@ public virtual async Task>> Re message.BufferResponse = false; return AsyncStreamingResult.CreateSse(await Pipeline.ProcessMessageAsync(message, cancellationToken.ToRequestOptions()).ConfigureAwait(false), (eventType, data) => eventType switch { - "response.created" => ModelReaderWriter.Read(BinaryData.FromBytes(data.ToArray()), ModelSerializationExtensions.WireOptions, SampleTypeSpecContext.Default), - "response.output_text.delta" => ModelReaderWriter.Read(BinaryData.FromBytes(data.ToArray()), ModelSerializationExtensions.WireOptions, SampleTypeSpecContext.Default), - _ => ModelReaderWriter.Read(BinaryData.FromBytes(data.ToArray()), ModelSerializationExtensions.WireOptions, SampleTypeSpecContext.Default) + "response.created" => ModelReaderWriter.Read(BinaryData.FromBytes(data.ToArray()), _modelReaderWriterOptions, SampleTypeSpecContext.Default), + "response.output_text.delta" => ModelReaderWriter.Read(BinaryData.FromBytes(data.ToArray()), _modelReaderWriterOptions, SampleTypeSpecContext.Default), + _ => ModelReaderWriter.Read(BinaryData.FromBytes(data.ToArray()), _modelReaderWriterOptions, SampleTypeSpecContext.Default) }, null, cancellationToken); } @@ -2135,7 +2137,7 @@ public virtual async Task> ReceiveExperimen { using PipelineMessage message = CreateReceiveExperimentalJsonLinesRequest(cancellationToken.ToRequestOptions()); message.BufferResponse = false; - return AsyncStreamingResult.CreateJsonLines(await Pipeline.ProcessMessageAsync(message, cancellationToken.ToRequestOptions()).ConfigureAwait(false), data => ModelReaderWriter.Read(data, ModelSerializationExtensions.WireOptions, SampleTypeSpecContext.Default), cancellationToken); + return AsyncStreamingResult.CreateJsonLines(await Pipeline.ProcessMessageAsync(message, cancellationToken.ToRequestOptions()).ConfigureAwait(false), data => ModelReaderWriter.Read(data, _modelReaderWriterOptions, SampleTypeSpecContext.Default), cancellationToken); } #pragma warning restore SAMPLE0003 // This generated code depends on experimental functionality. @@ -2295,32 +2297,32 @@ public virtual async Task SetAcronymAddressesAsync(string ipv4Addr #pragma warning disable SAMPLE0009 // This generated code depends on experimental functionality. public virtual ExperimentalSamples GetExperimentalSamplesClient() { - return Volatile.Read(ref _cachedExperimentalSamples) ?? Interlocked.CompareExchange(ref _cachedExperimentalSamples, new ExperimentalSamples(Pipeline, _endpoint), null) ?? _cachedExperimentalSamples; + return Volatile.Read(ref _cachedExperimentalSamples) ?? Interlocked.CompareExchange(ref _cachedExperimentalSamples, new ExperimentalSamples(Pipeline, _modelReaderWriterOptions, _endpoint), null) ?? _cachedExperimentalSamples; } #pragma warning restore SAMPLE0009 // This generated code depends on experimental functionality. /// Initializes a new instance of AnimalOperations. public virtual AnimalOperations GetAnimalOperationsClient() { - return Volatile.Read(ref _cachedAnimalOperations) ?? Interlocked.CompareExchange(ref _cachedAnimalOperations, new AnimalOperations(Pipeline, _endpoint), null) ?? _cachedAnimalOperations; + return Volatile.Read(ref _cachedAnimalOperations) ?? Interlocked.CompareExchange(ref _cachedAnimalOperations, new AnimalOperations(Pipeline, _modelReaderWriterOptions, _endpoint), null) ?? _cachedAnimalOperations; } /// Initializes a new instance of PetOperations. public virtual PetOperations GetPetOperationsClient() { - return Volatile.Read(ref _cachedPetOperations) ?? Interlocked.CompareExchange(ref _cachedPetOperations, new PetOperations(Pipeline, _endpoint), null) ?? _cachedPetOperations; + return Volatile.Read(ref _cachedPetOperations) ?? Interlocked.CompareExchange(ref _cachedPetOperations, new PetOperations(Pipeline, _modelReaderWriterOptions, _endpoint), null) ?? _cachedPetOperations; } /// Initializes a new instance of DogOperations. public virtual DogOperations GetDogOperationsClient() { - return Volatile.Read(ref _cachedDogOperations) ?? Interlocked.CompareExchange(ref _cachedDogOperations, new DogOperations(Pipeline, _endpoint), null) ?? _cachedDogOperations; + return Volatile.Read(ref _cachedDogOperations) ?? Interlocked.CompareExchange(ref _cachedDogOperations, new DogOperations(Pipeline, _modelReaderWriterOptions, _endpoint), null) ?? _cachedDogOperations; } /// Initializes a new instance of PlantOperations. public virtual PlantOperations GetPlantOperationsClient() { - return Volatile.Read(ref _cachedPlantOperations) ?? Interlocked.CompareExchange(ref _cachedPlantOperations, new PlantOperations(Pipeline, _endpoint), null) ?? _cachedPlantOperations; + return Volatile.Read(ref _cachedPlantOperations) ?? Interlocked.CompareExchange(ref _cachedPlantOperations, new PlantOperations(Pipeline, _modelReaderWriterOptions, _endpoint), null) ?? _cachedPlantOperations; } /// Initializes a new instance of Metrics. @@ -2330,7 +2332,7 @@ public virtual Metrics GetMetricsClient(string metricsNamespace) { Argument.AssertNotNull(metricsNamespace, nameof(metricsNamespace)); - return new Metrics(Pipeline, _endpoint, metricsNamespace); + return new Metrics(Pipeline, _modelReaderWriterOptions, _endpoint, metricsNamespace); } /// Initializes a new instance of Notebooks. @@ -2340,19 +2342,19 @@ public virtual Notebooks GetNotebooksClient(string notebook) { Argument.AssertNotNull(notebook, nameof(notebook)); - return new Notebooks(Pipeline, _endpoint, notebook); + return new Notebooks(Pipeline, _modelReaderWriterOptions, _endpoint, notebook); } /// Initializes a new instance of UnionExtends. public virtual UnionExtends GetUnionExtendsClient() { - return Volatile.Read(ref _cachedUnionExtends) ?? Interlocked.CompareExchange(ref _cachedUnionExtends, new UnionExtends(Pipeline, _endpoint), null) ?? _cachedUnionExtends; + return Volatile.Read(ref _cachedUnionExtends) ?? Interlocked.CompareExchange(ref _cachedUnionExtends, new UnionExtends(Pipeline, _modelReaderWriterOptions, _endpoint), null) ?? _cachedUnionExtends; } /// Initializes a new instance of ConstructorRequirements. public virtual ConstructorRequirements GetConstructorRequirementsClient() { - return Volatile.Read(ref _cachedConstructorRequirements) ?? Interlocked.CompareExchange(ref _cachedConstructorRequirements, new ConstructorRequirements(Pipeline, _endpoint), null) ?? _cachedConstructorRequirements; + return Volatile.Read(ref _cachedConstructorRequirements) ?? Interlocked.CompareExchange(ref _cachedConstructorRequirements, new ConstructorRequirements(Pipeline, _modelReaderWriterOptions, _endpoint), null) ?? _cachedConstructorRequirements; } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/UnionExtends.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/UnionExtends.cs index b84a7bf4fa7..7203382cbb9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/UnionExtends.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/UnionExtends.cs @@ -19,6 +19,7 @@ namespace SampleTypeSpec public partial class UnionExtends { private readonly Uri _endpoint; + private readonly ModelReaderWriterOptions _modelReaderWriterOptions = ModelSerializationExtensions.WireOptions; /// Initializes a new instance of UnionExtends for mocking. protected UnionExtends() @@ -27,11 +28,13 @@ protected UnionExtends() /// Initializes a new instance of UnionExtends. /// The HTTP pipeline for sending and receiving REST requests and responses. + /// /// Service endpoint. - internal UnionExtends(ClientPipeline pipeline, Uri endpoint) + internal UnionExtends(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) { _endpoint = endpoint; Pipeline = pipeline; + _modelReaderWriterOptions = modelReaderWriterOptions; } /// The HTTP pipeline for sending and receiving REST requests and responses. @@ -89,11 +92,11 @@ public virtual ClientResult Echo(UnionPet pet, CancellationToken cance Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - UnionPet.SerializeUnionPetsUnion(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + UnionPet.SerializeUnionPetsUnion(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = Echo(content, cancellationToken.ToRequestOptions()); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(UnionPet.DeserializeUnionPetsUnion(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(UnionPet.DeserializeUnionPetsUnion(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// Echo. @@ -106,11 +109,11 @@ public virtual async Task> EchoAsync(UnionPet pet, Cancel Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - UnionPet.SerializeUnionPetsUnion(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + UnionPet.SerializeUnionPetsUnion(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = await EchoAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(UnionPet.DeserializeUnionPetsUnion(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(UnionPet.DeserializeUnionPetsUnion(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -232,8 +235,8 @@ public virtual ClientResult EchoContainer(UnionPetContainer c { Argument.AssertNotNull(container, nameof(container)); - ClientResult result = EchoContainer(container, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((UnionPetContainer)result, result.GetRawResponse()); + ClientResult result = EchoContainer(container.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); + return ClientResult.FromValue(UnionPetContainer.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// EchoContainer. @@ -245,8 +248,8 @@ public virtual async Task> EchoContainerAsync(Un { Argument.AssertNotNull(container, nameof(container)); - ClientResult result = await EchoContainerAsync(container, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((UnionPetContainer)result, result.GetRawResponse()); + ClientResult result = await EchoContainerAsync(container.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue(UnionPetContainer.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -300,8 +303,8 @@ public virtual ClientResult EchoRawContainer(RawUnionPetCo { Argument.AssertNotNull(container, nameof(container)); - ClientResult result = EchoRawContainer(container, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((RawUnionPetContainer)result, result.GetRawResponse()); + ClientResult result = EchoRawContainer(container.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); + return ClientResult.FromValue(RawUnionPetContainer.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// EchoRawContainer. @@ -313,8 +316,8 @@ public virtual async Task> EchoRawContainerAs { Argument.AssertNotNull(container, nameof(container)); - ClientResult result = await EchoRawContainerAsync(container, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((RawUnionPetContainer)result, result.GetRawResponse()); + ClientResult result = await EchoRawContainerAsync(container.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue(RawUnionPetContainer.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -369,11 +372,11 @@ public virtual ClientResult EchoNestedOuter(CollisionPetsUni Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - CollisionPetsUnion.SerializeCollisionPetsUnion1(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + CollisionPetsUnion.SerializeCollisionPetsUnion1(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = EchoNestedOuter(content, cancellationToken.ToRequestOptions()); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(CollisionPetsUnion.DeserializeCollisionPetsUnion1(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(CollisionPetsUnion.DeserializeCollisionPetsUnion1(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// EchoNestedOuter. @@ -386,11 +389,11 @@ public virtual async Task> EchoNestedOuterAsync Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - CollisionPetsUnion.SerializeCollisionPetsUnion1(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + CollisionPetsUnion.SerializeCollisionPetsUnion1(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = await EchoNestedOuterAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(CollisionPetsUnion.DeserializeCollisionPetsUnion1(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(CollisionPetsUnion.DeserializeCollisionPetsUnion1(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -450,11 +453,11 @@ public virtual ClientResult EchoNestedInner(NestedMammal pet, Canc Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - NestedMammal.SerializeNestedPetsUnion(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + NestedMammal.SerializeNestedPetsUnion(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = EchoNestedInner(content, cancellationToken.ToRequestOptions()); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(NestedMammal.DeserializeNestedPetsUnion(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(NestedMammal.DeserializeNestedPetsUnion(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } #pragma warning restore UNION001 // This generated code depends on experimental functionality. @@ -469,11 +472,11 @@ public virtual async Task> EchoNestedInnerAsync(Neste Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - NestedMammal.SerializeNestedPetsUnion(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + NestedMammal.SerializeNestedPetsUnion(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = await EchoNestedInnerAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(NestedMammal.DeserializeNestedPetsUnion(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(NestedMammal.DeserializeNestedPetsUnion(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } #pragma warning restore UNION001 // This generated code depends on experimental functionality. @@ -534,11 +537,11 @@ public virtual ClientResult EchoNestedSameName(NestedMammal pet, C Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - NestedMammal.SerializeCollisionPetsUnion2(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + NestedMammal.SerializeCollisionPetsUnion2(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = EchoNestedSameName(content, cancellationToken.ToRequestOptions()); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(NestedMammal.DeserializeCollisionPetsUnion2(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(NestedMammal.DeserializeCollisionPetsUnion2(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } #pragma warning restore UNION001 // This generated code depends on experimental functionality. @@ -553,11 +556,11 @@ public virtual async Task> EchoNestedSameNameAsync(Ne Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - NestedMammal.SerializeCollisionPetsUnion2(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + NestedMammal.SerializeCollisionPetsUnion2(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = await EchoNestedSameNameAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(NestedMammal.DeserializeCollisionPetsUnion2(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(NestedMammal.DeserializeCollisionPetsUnion2(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } #pragma warning restore UNION001 // This generated code depends on experimental functionality. @@ -613,11 +616,11 @@ public virtual ClientResult EchoXmlPets(XmlUnionPet pet, Cancellati Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - XmlUnionPet.SerializeXmlUnionPetsUnion(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + XmlUnionPet.SerializeXmlUnionPetsUnion(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = EchoXmlPets(content, cancellationToken.ToRequestOptions()); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(XmlUnionPet.DeserializeXmlUnionPetsUnion(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(XmlUnionPet.DeserializeXmlUnionPetsUnion(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// EchoXmlPets. @@ -630,11 +633,11 @@ public virtual async Task> EchoXmlPetsAsync(XmlUnionPe Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - XmlUnionPet.SerializeXmlUnionPetsUnion(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + XmlUnionPet.SerializeXmlUnionPetsUnion(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = await EchoXmlPetsAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(XmlUnionPet.DeserializeXmlUnionPetsUnion(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(XmlUnionPet.DeserializeXmlUnionPetsUnion(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -688,9 +691,9 @@ public virtual ClientResult EchoXmlBase(XmlUnionPet pet, Cancellati { Argument.AssertNotNull(pet, nameof(pet)); - using BinaryContent content = pet.ToBinaryContent("X"); + using BinaryContent content = pet.ToBinaryContent(_modelReaderWriterOptions.ToXmlOptions()); ClientResult result = EchoXmlBase(content, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((XmlUnionPet)result, result.GetRawResponse()); + return ClientResult.FromValue(XmlUnionPet.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// EchoXmlBase. @@ -702,9 +705,9 @@ public virtual async Task> EchoXmlBaseAsync(XmlUnionPe { Argument.AssertNotNull(pet, nameof(pet)); - using BinaryContent content = pet.ToBinaryContent("X"); + using BinaryContent content = pet.ToBinaryContent(_modelReaderWriterOptions.ToXmlOptions()); ClientResult result = await EchoXmlBaseAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((XmlUnionPet)result, result.GetRawResponse()); + return ClientResult.FromValue(XmlUnionPet.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -966,8 +969,8 @@ public virtual ClientResult EchoDirectBase(DirectUnionPet pet, C { Argument.AssertNotNull(pet, nameof(pet)); - ClientResult result = EchoDirectBase(pet, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((DirectUnionPet)result, result.GetRawResponse()); + ClientResult result = EchoDirectBase(pet.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); + return ClientResult.FromValue(DirectUnionPet.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// EchoDirectBase. @@ -979,8 +982,8 @@ public virtual async Task> EchoDirectBaseAsync(Dire { Argument.AssertNotNull(pet, nameof(pet)); - ClientResult result = await EchoDirectBaseAsync(pet, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((DirectUnionPet)result, result.GetRawResponse()); + ClientResult result = await EchoDirectBaseAsync(pet.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue(DirectUnionPet.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -1035,11 +1038,11 @@ public virtual ClientResult EchoDirectUnion(DirectUnionPet pet, Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - DirectUnionPet.SerializeDirectPetsUnion3(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + DirectUnionPet.SerializeDirectPetsUnion3(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = EchoDirectUnion(content, cancellationToken.ToRequestOptions()); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(DirectUnionPet.DeserializeDirectPetsUnion3(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(DirectUnionPet.DeserializeDirectPetsUnion3(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// EchoDirectUnion. @@ -1052,11 +1055,11 @@ public virtual async Task> EchoDirectUnionAsync(Dir Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - DirectUnionPet.SerializeDirectPetsUnion3(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + DirectUnionPet.SerializeDirectPetsUnion3(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = await EchoDirectUnionAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(DirectUnionPet.DeserializeDirectPetsUnion3(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(DirectUnionPet.DeserializeDirectPetsUnion3(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -1110,8 +1113,8 @@ public virtual ClientResult EchoDirectContainer(DirectU { Argument.AssertNotNull(container, nameof(container)); - ClientResult result = EchoDirectContainer(container, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((DirectUnionPetContainer)result, result.GetRawResponse()); + ClientResult result = EchoDirectContainer(container.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); + return ClientResult.FromValue(DirectUnionPetContainer.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// EchoDirectContainer. @@ -1123,8 +1126,8 @@ public virtual async Task> EchoDirectConta { Argument.AssertNotNull(container, nameof(container)); - ClientResult result = await EchoDirectContainerAsync(container, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((DirectUnionPetContainer)result, result.GetRawResponse()); + ClientResult result = await EchoDirectContainerAsync(container.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue(DirectUnionPetContainer.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -1178,8 +1181,8 @@ public virtual ClientResult EchoDynamicContainer(Dynam { Argument.AssertNotNull(container, nameof(container)); - ClientResult result = EchoDynamicContainer(container, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((DynamicUnionPetContainer)result, result.GetRawResponse()); + ClientResult result = EchoDynamicContainer(container.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); + return ClientResult.FromValue(DynamicUnionPetContainer.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// EchoDynamicContainer. @@ -1191,8 +1194,8 @@ public virtual async Task> EchoDynamicCon { Argument.AssertNotNull(container, nameof(container)); - ClientResult result = await EchoDynamicContainerAsync(container, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((DynamicUnionPetContainer)result, result.GetRawResponse()); + ClientResult result = await EchoDynamicContainerAsync(container.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue(DynamicUnionPetContainer.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -1247,11 +1250,11 @@ public virtual ClientResult EchoDescendantMembers(Descendant Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - DescendantUnionPet.SerializeDescendantPetsUnion1(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + DescendantUnionPet.SerializeDescendantPetsUnion1(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = EchoDescendantMembers(content, cancellationToken.ToRequestOptions()); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(DescendantUnionPet.DeserializeDescendantPetsUnion1(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(DescendantUnionPet.DeserializeDescendantPetsUnion1(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// EchoDescendantMembers. @@ -1264,11 +1267,11 @@ public virtual async Task> EchoDescendantMember Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - DescendantUnionPet.SerializeDescendantPetsUnion1(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + DescendantUnionPet.SerializeDescendantPetsUnion1(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = await EchoDescendantMembersAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(DescendantUnionPet.DeserializeDescendantPetsUnion1(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(DescendantUnionPet.DeserializeDescendantPetsUnion1(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -1391,11 +1394,11 @@ public virtual ClientResult EchoSerializeClassName(Serialize Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - SerializePetsUnion.SerializePetsUnion1(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + SerializePetsUnion.SerializePetsUnion1(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = EchoSerializeClassName(content, cancellationToken.ToRequestOptions()); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(SerializePetsUnion.DeserializePetsUnion1(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(SerializePetsUnion.DeserializePetsUnion1(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// EchoSerializeClassName. @@ -1408,11 +1411,11 @@ public virtual async Task> EchoSerializeClassNa Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - SerializePetsUnion.SerializePetsUnion1(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + SerializePetsUnion.SerializePetsUnion1(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = await EchoSerializeClassNameAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(SerializePetsUnion.DeserializePetsUnion1(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(SerializePetsUnion.DeserializePetsUnion1(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -1467,11 +1470,11 @@ public virtual ClientResult EchoDeserializeClassName(Deser Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - DeserializePetsUnion.SerializePetsUnion1(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + DeserializePetsUnion.SerializePetsUnion1(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = EchoDeserializeClassName(content, cancellationToken.ToRequestOptions()); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(DeserializePetsUnion.DeserializePetsUnion1(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(DeserializePetsUnion.DeserializePetsUnion1(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// EchoDeserializeClassName. @@ -1484,11 +1487,11 @@ public virtual async Task> EchoDeserializeCla Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - DeserializePetsUnion.SerializePetsUnion1(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + DeserializePetsUnion.SerializePetsUnion1(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = await EchoDeserializeClassNameAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(DeserializePetsUnion.DeserializePetsUnion1(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(DeserializePetsUnion.DeserializePetsUnion1(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -1610,8 +1613,8 @@ public virtual ClientResult EchoCustomContainer(CustomUnionPet p { Argument.AssertNotNull(pet, nameof(pet)); - ClientResult result = EchoCustomContainer(pet, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((CustomUnionPet)result, result.GetRawResponse()); + ClientResult result = EchoCustomContainer(pet.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()); + return ClientResult.FromValue(CustomUnionPet.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// EchoCustomContainer. @@ -1623,8 +1626,8 @@ public virtual async Task> EchoCustomContainerAsync { Argument.AssertNotNull(pet, nameof(pet)); - ClientResult result = await EchoCustomContainerAsync(pet, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((CustomUnionPet)result, result.GetRawResponse()); + ClientResult result = await EchoCustomContainerAsync(pet.ToBinaryContent(_modelReaderWriterOptions), cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue(CustomUnionPet.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -1747,11 +1750,11 @@ public virtual ClientResult EchoRebasedVariants(RebasedUnionPet Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - RebasedUnionPet.SerializeRebasedPetsUnion(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + RebasedUnionPet.SerializeRebasedPetsUnion(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = EchoRebasedVariants(content, cancellationToken.ToRequestOptions()); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(RebasedUnionPet.DeserializeRebasedPetsUnion(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(RebasedUnionPet.DeserializeRebasedPetsUnion(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// EchoRebasedVariants. @@ -1764,11 +1767,11 @@ public virtual async Task> EchoRebasedVariantsAsyn Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - RebasedUnionPet.SerializeRebasedPetsUnion(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + RebasedUnionPet.SerializeRebasedPetsUnion(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = await EchoRebasedVariantsAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(RebasedUnionPet.DeserializeRebasedPetsUnion(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(RebasedUnionPet.DeserializeRebasedPetsUnion(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -1823,11 +1826,11 @@ public virtual ClientResult EchoRebasedBase(RebasedUnionA pet, Ca Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - RebasedUnionA.SerializePetsUnion(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + RebasedUnionA.SerializePetsUnion(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = EchoRebasedBase(content, cancellationToken.ToRequestOptions()); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(RebasedUnionA.DeserializePetsUnion(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(RebasedUnionA.DeserializePetsUnion(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// EchoRebasedBase. @@ -1840,11 +1843,11 @@ public virtual async Task> EchoRebasedBaseAsync(Reba Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - RebasedUnionA.SerializePetsUnion(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + RebasedUnionA.SerializePetsUnion(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = await EchoRebasedBaseAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(RebasedUnionA.DeserializePetsUnion(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(RebasedUnionA.DeserializePetsUnion(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -1899,11 +1902,11 @@ public virtual ClientResult EchoRebasedDerived(RebasedUnionB pet, Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - RebasedUnionB.SerializePetsUnion1(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + RebasedUnionB.SerializePetsUnion1(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = EchoRebasedDerived(content, cancellationToken.ToRequestOptions()); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(RebasedUnionB.DeserializePetsUnion1(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(RebasedUnionB.DeserializePetsUnion1(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// EchoRebasedDerived. @@ -1916,11 +1919,11 @@ public virtual async Task> EchoRebasedDerivedAsync(R Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - RebasedUnionB.SerializePetsUnion1(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + RebasedUnionB.SerializePetsUnion1(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = await EchoRebasedDerivedAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(RebasedUnionB.DeserializePetsUnion1(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(RebasedUnionB.DeserializePetsUnion1(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -1975,11 +1978,11 @@ public virtual ClientResult EchoDescendantDeserializer(Deserial Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - DeserializerPet.SerializePetsUnion1(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + DeserializerPet.SerializePetsUnion1(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = EchoDescendantDeserializer(content, cancellationToken.ToRequestOptions()); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(DeserializerPet.DeserializePetsUnion1(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(DeserializerPet.DeserializePetsUnion1(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// EchoDescendantDeserializer. @@ -1992,11 +1995,11 @@ public virtual async Task> EchoDescendantDeseriali Argument.AssertNotNull(pet, nameof(pet)); using Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - DeserializerPet.SerializePetsUnion1(content.JsonWriter, pet, ModelSerializationExtensions.WireOptions); + DeserializerPet.SerializePetsUnion1(content.JsonWriter, pet, _modelReaderWriterOptions); ClientResult result = await EchoDescendantDeserializerAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); BinaryData data = result.GetRawResponse().Content; using JsonDocument document = JsonDocument.Parse(data); - return ClientResult.FromValue(DeserializerPet.DeserializePetsUnion1(document.RootElement, ModelSerializationExtensions.WireOptions), result.GetRawResponse()); + return ClientResult.FromValue(DeserializerPet.DeserializePetsUnion1(document.RootElement, _modelReaderWriterOptions), result.GetRawResponse()); } /// @@ -2198,7 +2201,7 @@ public virtual ClientResult> EchoPets(IEnumerable> EchoPets(IEnumerable array = new List(); foreach (var item in document.RootElement.EnumerateArray()) { - array.Add(UnionPet.DeserializeUnionPetsUnion(item, ModelSerializationExtensions.WireOptions)); + array.Add(UnionPet.DeserializeUnionPetsUnion(item, _modelReaderWriterOptions)); } unionValue = array; } @@ -2237,7 +2240,7 @@ public virtual async Task>> EchoPetsAsync(I content.JsonWriter.WriteStartArray(); foreach (var item in pets) { - UnionPet.SerializeUnionPetsUnion(content.JsonWriter, item, ModelSerializationExtensions.WireOptions); + UnionPet.SerializeUnionPetsUnion(content.JsonWriter, item, _modelReaderWriterOptions); } content.JsonWriter.WriteEndArray(); } @@ -2250,7 +2253,7 @@ public virtual async Task>> EchoPetsAsync(I List array = new List(); foreach (var item in document.RootElement.EnumerateArray()) { - array.Add(UnionPet.DeserializeUnionPetsUnion(item, ModelSerializationExtensions.WireOptions)); + array.Add(UnionPet.DeserializeUnionPetsUnion(item, _modelReaderWriterOptions)); } unionValue = array; } @@ -2319,7 +2322,7 @@ public virtual ClientResult> EchoLookup(ID foreach (var item in pets) { content.JsonWriter.WritePropertyName(item.Key); - UnionPet.SerializeUnionPetsUnion(content.JsonWriter, item.Value, ModelSerializationExtensions.WireOptions); + UnionPet.SerializeUnionPetsUnion(content.JsonWriter, item.Value, _modelReaderWriterOptions); } content.JsonWriter.WriteEndObject(); } @@ -2332,7 +2335,7 @@ public virtual ClientResult> EchoLookup(ID Dictionary dictionary = new Dictionary(); foreach (var @property in document.RootElement.EnumerateObject()) { - dictionary.Add(@property.Name, UnionPet.DeserializeUnionPetsUnion(@property.Value, ModelSerializationExtensions.WireOptions)); + dictionary.Add(@property.Name, UnionPet.DeserializeUnionPetsUnion(@property.Value, _modelReaderWriterOptions)); } unionValue = dictionary; } @@ -2359,7 +2362,7 @@ public virtual async Task>> E foreach (var item in pets) { content.JsonWriter.WritePropertyName(item.Key); - UnionPet.SerializeUnionPetsUnion(content.JsonWriter, item.Value, ModelSerializationExtensions.WireOptions); + UnionPet.SerializeUnionPetsUnion(content.JsonWriter, item.Value, _modelReaderWriterOptions); } content.JsonWriter.WriteEndObject(); } @@ -2372,7 +2375,7 @@ public virtual async Task>> E Dictionary dictionary = new Dictionary(); foreach (var @property in document.RootElement.EnumerateObject()) { - dictionary.Add(@property.Name, UnionPet.DeserializeUnionPetsUnion(@property.Value, ModelSerializationExtensions.WireOptions)); + dictionary.Add(@property.Name, UnionPet.DeserializeUnionPetsUnion(@property.Value, _modelReaderWriterOptions)); } unionValue = dictionary; } @@ -2419,7 +2422,7 @@ public virtual async Task GetCatAsync(RequestOptions options) public virtual ClientResult GetCat(CancellationToken cancellationToken = default) { ClientResult result = GetCat(cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((UnionCat)result, result.GetRawResponse()); + return ClientResult.FromValue(UnionCat.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } /// GetCat. @@ -2428,7 +2431,7 @@ public virtual ClientResult GetCat(CancellationToken cancellationToken public virtual async Task> GetCatAsync(CancellationToken cancellationToken = default) { ClientResult result = await GetCatAsync(cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((UnionCat)result, result.GetRawResponse()); + return ClientResult.FromValue(UnionCat.FromClientResult(result, _modelReaderWriterOptions), result.GetRawResponse()); } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/SampleTypeSpec.csproj b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/SampleTypeSpec.csproj index a87f7fc1c1d..6e1ffc0ed16 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/SampleTypeSpec.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/SampleTypeSpec.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Authentication.ApiKey.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Authentication.ApiKey.csproj index e6cff2c1e64..1652eff7942 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Authentication.ApiKey.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Authentication.ApiKey.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Authentication.Http.Custom.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Authentication.Http.Custom.csproj index 41b05b03937..2a8fbab6573 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Authentication.Http.Custom.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Authentication.Http.Custom.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Authentication.OAuth2.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Authentication.OAuth2.csproj index f849240e7f4..9a62789597c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Authentication.OAuth2.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Authentication.OAuth2.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Authentication.Union.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Authentication.Union.csproj index ba7ec8d71ed..25a384bcc3c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Authentication.Union.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Authentication.Union.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/azure/client-generator-core/response-as-bool/src/Generated/HeadAsBoolean.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/azure/client-generator-core/response-as-bool/src/Generated/HeadAsBoolean.cs index 3ca237dbe29..ba0f4b23cf8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/azure/client-generator-core/response-as-bool/src/Generated/HeadAsBoolean.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/azure/client-generator-core/response-as-bool/src/Generated/HeadAsBoolean.cs @@ -14,7 +14,7 @@ public partial class HeadAsBoolean { protected HeadAsBoolean() => throw null; - internal HeadAsBoolean(ClientPipeline pipeline, Uri endpoint) => throw null; + internal HeadAsBoolean(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/azure/client-generator-core/response-as-bool/src/_Specs_.Azure.ClientGenerator.Core.ResponseAsBool.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/azure/client-generator-core/response-as-bool/src/_Specs_.Azure.ClientGenerator.Core.ResponseAsBool.csproj index 6c9750f6ff1..51a0a6ea257 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/azure/client-generator-core/response-as-bool/src/_Specs_.Azure.ClientGenerator.Core.ResponseAsBool.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/azure/client-generator-core/response-as-bool/src/_Specs_.Azure.ClientGenerator.Core.ResponseAsBool.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/azure/client-generator-core/response-replacement/src/_Specs_.Azure.ClientGenerator.Core.ResponseReplacement.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/azure/client-generator-core/response-replacement/src/_Specs_.Azure.ClientGenerator.Core.ResponseReplacement.csproj index e294e96b2b4..3dcc064780e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/azure/client-generator-core/response-replacement/src/_Specs_.Azure.ClientGenerator.Core.ResponseReplacement.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/azure/client-generator-core/response-replacement/src/_Specs_.Azure.ClientGenerator.Core.ResponseReplacement.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Client.Structure.Service.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Client.Structure.Service.csproj index c3e4db2072c..3a3db903876 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Client.Structure.Service.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Client.Structure.Service.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group3.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group3.cs index 424b1f729bd..5e6e3761f47 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group3.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group3.cs @@ -15,7 +15,7 @@ public partial class Group3 { protected Group3() => throw null; - internal Group3(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + internal Group3(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, ClientType client) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group4.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group4.cs index 6f372e14c53..d1579247787 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group4.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group4.cs @@ -15,7 +15,7 @@ public partial class Group4 { protected Group4() => throw null; - internal Group4(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + internal Group4(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, ClientType client) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group5.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group5.cs index 16a035048f3..97e661da026 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group5.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group5.cs @@ -15,7 +15,7 @@ public partial class Group5 { protected Group5() => throw null; - internal Group5(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + internal Group5(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, ClientType client) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Client.Structure.Service.Default.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Client.Structure.Service.Default.csproj index b760230385e..2ee346668e1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Client.Structure.Service.Default.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Client.Structure.Service.Default.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Bar.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Bar.cs index ecb520de880..b286b0c8a54 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Bar.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Bar.cs @@ -14,7 +14,7 @@ public partial class Bar { protected Bar() => throw null; - internal Bar(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + internal Bar(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, ClientType client) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Baz.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Baz.cs index 9846828d6a2..f437ba4160a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Baz.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Baz.cs @@ -12,7 +12,7 @@ public partial class Baz { protected Baz() => throw null; - internal Baz(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + internal Baz(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, ClientType client) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/BazFoo.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/BazFoo.cs index 4b8d81d5939..26fab414a86 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/BazFoo.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/BazFoo.cs @@ -15,7 +15,7 @@ public partial class BazFoo { protected BazFoo() => throw null; - internal BazFoo(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + internal BazFoo(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, ClientType client) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Foo.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Foo.cs index 40c3caa537f..e3c6b900912 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Foo.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Foo.cs @@ -14,7 +14,7 @@ public partial class Foo { protected Foo() => throw null; - internal Foo(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + internal Foo(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, ClientType client) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Qux.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Qux.cs index 886bf284df7..c61c9881395 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Qux.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Qux.cs @@ -15,7 +15,7 @@ public partial class Qux { protected Qux() => throw null; - internal Qux(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + internal Qux(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, ClientType client) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/QuxBar.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/QuxBar.cs index 5b7bc794ae7..07ce200cc10 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/QuxBar.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/QuxBar.cs @@ -15,7 +15,7 @@ public partial class QuxBar { protected QuxBar() => throw null; - internal QuxBar(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + internal QuxBar(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, ClientType client) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Client.Structure.Service.Multi.Client.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Client.Structure.Service.Multi.Client.csproj index de3df7167e6..2b087a6b24d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Client.Structure.Service.Multi.Client.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Client.Structure.Service.Multi.Client.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Client.Structure.Service.Renamed.Operation.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Client.Structure.Service.Renamed.Operation.csproj index bec91378bff..07b94e1edb2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Client.Structure.Service.Renamed.Operation.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Client.Structure.Service.Renamed.Operation.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/Group.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/Group.cs index f9ce619bfe6..f81bcf57a71 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/Group.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/Group.cs @@ -15,7 +15,7 @@ public partial class Group { protected Group() => throw null; - internal Group(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + internal Group(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, ClientType client) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Client.Structure.Service.TwoOperationGroup.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Client.Structure.Service.TwoOperationGroup.csproj index e63542948e9..a20f4881647 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Client.Structure.Service.TwoOperationGroup.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Client.Structure.Service.TwoOperationGroup.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group1.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group1.cs index 292fd14c3c6..5173bcffc76 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group1.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group1.cs @@ -15,7 +15,7 @@ public partial class Group1 { protected Group1() => throw null; - internal Group1(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + internal Group1(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, ClientType client) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group2.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group2.cs index 9b04ac2eba9..04b489f302b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group2.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group2.cs @@ -15,7 +15,7 @@ public partial class Group2 { protected Group2() => throw null; - internal Group2(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + internal Group2(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, ClientType client) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Documentation.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Documentation.csproj index 6896d28e273..ae9662f8847 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Documentation.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Documentation.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/Lists.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/Lists.cs index 448bdd8c7c6..a245efb2984 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/Lists.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/Lists.cs @@ -14,7 +14,7 @@ public partial class Lists { protected Lists() => throw null; - internal Lists(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Lists(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/TextFormatting.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/TextFormatting.cs index d2190f98461..54b8edda959 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/TextFormatting.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/TextFormatting.cs @@ -14,7 +14,7 @@ public partial class TextFormatting { protected TextFormatting() => throw null; - internal TextFormatting(ClientPipeline pipeline, Uri endpoint) => throw null; + internal TextFormatting(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Encode.Array.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Encode.Array.csproj index 89e282add3d..81f82ee16c3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Encode.Array.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Encode.Array.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Property.cs index cca72b3496d..9c6fc5fd2ca 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Property.cs @@ -15,7 +15,7 @@ public partial class Property { protected Property() => throw null; - internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Property(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/boolean/src/Encode.Boolean.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/boolean/src/Encode.Boolean.csproj index cc2ae94984d..644ba483c37 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/boolean/src/Encode.Boolean.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/boolean/src/Encode.Boolean.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/boolean/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/boolean/src/Generated/Property.cs index 6c997cd998b..0adc8af41ff 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/boolean/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/boolean/src/Generated/Property.cs @@ -14,7 +14,7 @@ public partial class Property { protected Property() => throw null; - internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Property(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Encode.Bytes.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Encode.Bytes.csproj index f556843e051..5ba1f0f0c54 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Encode.Bytes.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Encode.Bytes.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Header.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Header.cs index fd23134b48c..afdb92088b7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Header.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Header.cs @@ -15,7 +15,7 @@ public partial class Header { protected Header() => throw null; - internal Header(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Header(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Property.cs index 98856cd5b6c..3fbfab661fb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Property.cs @@ -15,7 +15,7 @@ public partial class Property { protected Property() => throw null; - internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Property(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Query.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Query.cs index a4bdf915ccf..e9252c03b2e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Query.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Query.cs @@ -15,7 +15,7 @@ public partial class Query { protected Query() => throw null; - internal Query(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Query(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/RequestBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/RequestBody.cs index 11350490a12..c0f610e8552 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/RequestBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/RequestBody.cs @@ -14,7 +14,7 @@ public partial class RequestBody { protected RequestBody() => throw null; - internal RequestBody(ClientPipeline pipeline, Uri endpoint) => throw null; + internal RequestBody(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/ResponseBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/ResponseBody.cs index 2ccbb28aadf..0e4e4dca995 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/ResponseBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/ResponseBody.cs @@ -14,7 +14,7 @@ public partial class ResponseBody { protected ResponseBody() => throw null; - internal ResponseBody(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ResponseBody(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Encode.Datetime.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Encode.Datetime.csproj index 2f46250a6f5..93a1a0f4c9c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Encode.Datetime.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Encode.Datetime.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Header.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Header.cs index 73e83a93a8d..ca0d6b60f32 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Header.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Header.cs @@ -15,7 +15,7 @@ public partial class Header { protected Header() => throw null; - internal Header(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Header(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Property.cs index 178a86cf0b2..94910d48bde 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Property.cs @@ -15,7 +15,7 @@ public partial class Property { protected Property() => throw null; - internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Property(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Query.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Query.cs index 2e39c63316f..25bb8b4c94e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Query.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Query.cs @@ -15,7 +15,7 @@ public partial class Query { protected Query() => throw null; - internal Query(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Query(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/ResponseHeader.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/ResponseHeader.cs index 0f6c15d6f9e..7b31a5c8410 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/ResponseHeader.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/ResponseHeader.cs @@ -14,7 +14,7 @@ public partial class ResponseHeader { protected ResponseHeader() => throw null; - internal ResponseHeader(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ResponseHeader(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Encode.Duration.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Encode.Duration.csproj index 4fbeda285e4..3e4ce1ec55c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Encode.Duration.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Encode.Duration.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Header.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Header.cs index 60aaa9d639d..2c6c0ae747e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Header.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Header.cs @@ -15,7 +15,7 @@ public partial class Header { protected Header() => throw null; - internal Header(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Header(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Lossy.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Lossy.cs index 0fb59d8a519..75d4022f980 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Lossy.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Lossy.cs @@ -14,7 +14,7 @@ public partial class Lossy { protected Lossy() => throw null; - internal Lossy(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Lossy(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Property.cs index 5932c8916b1..c7003d0657d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Property.cs @@ -14,7 +14,7 @@ public partial class Property { protected Property() => throw null; - internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Property(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Query.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Query.cs index 3389d4bc03c..847d39a5d2d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Query.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Query.cs @@ -15,7 +15,7 @@ public partial class Query { protected Query() => throw null; - internal Query(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Query(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Encode.Numeric.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Encode.Numeric.csproj index 3a20fe0a04a..ea1188b0053 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Encode.Numeric.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Encode.Numeric.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Property.cs index a24512ae6df..217bc4cb759 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Property.cs @@ -14,7 +14,7 @@ public partial class Property { protected Property() => throw null; - internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Property(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ExplicitBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ExplicitBody.cs index d9157b03926..0496fec4c96 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ExplicitBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ExplicitBody.cs @@ -14,7 +14,7 @@ public partial class ExplicitBody { protected ExplicitBody() => throw null; - internal ExplicitBody(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ExplicitBody(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ImplicitBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ImplicitBody.cs index 8d46cf80d63..b1cd28e53aa 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ImplicitBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ImplicitBody.cs @@ -14,7 +14,7 @@ public partial class ImplicitBody { protected ImplicitBody() => throw null; - internal ImplicitBody(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ImplicitBody(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Parameters.Basic.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Parameters.Basic.csproj index 0f390d3ce41..7a711ed4491 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Parameters.Basic.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Parameters.Basic.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs index 5d4de240634..f43dd1129ee 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs @@ -15,7 +15,7 @@ public partial class OptionalExplicit { protected OptionalExplicit() => throw null; - internal OptionalExplicit(ClientPipeline pipeline, Uri endpoint) => throw null; + internal OptionalExplicit(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Parameters.BodyOptionality.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Parameters.BodyOptionality.csproj index 051f046bd52..16eb6c201e9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Parameters.BodyOptionality.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Parameters.BodyOptionality.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-root/src/Parameters.BodyRoot.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-root/src/Parameters.BodyRoot.csproj index fdab120d046..4012987b277 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-root/src/Parameters.BodyRoot.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-root/src/Parameters.BodyRoot.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.cs index e29a1876bcd..026eeae2300 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.cs @@ -15,7 +15,7 @@ public partial class Header { protected Header() => throw null; - internal Header(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Header(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.cs index f0d37525882..59941467fce 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.cs @@ -15,7 +15,7 @@ public partial class Query { protected Query() => throw null; - internal Query(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Query(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Parameters.CollectionFormat.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Parameters.CollectionFormat.csproj index c18dea48869..8181b4ff0d0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Parameters.CollectionFormat.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Parameters.CollectionFormat.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Parameters.Path.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Parameters.Path.csproj index e27cc956fe0..728350e1ca8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Parameters.Path.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Parameters.Path.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/Constant.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/Constant.cs index 3545cccf023..a6821ab5ca1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/Constant.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/Constant.cs @@ -14,7 +14,7 @@ public partial class Constant { protected Constant() => throw null; - internal Constant(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Constant(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/SpecialChar.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/SpecialChar.cs index 02f488d8034..11425b9673f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/SpecialChar.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/SpecialChar.cs @@ -14,7 +14,7 @@ public partial class SpecialChar { protected SpecialChar() => throw null; - internal SpecialChar(ClientPipeline pipeline, Uri endpoint) => throw null; + internal SpecialChar(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Parameters.Query.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Parameters.Query.csproj index 42dbbd52673..954cb0c059e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Parameters.Query.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Parameters.Query.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Alias.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Alias.cs index 201900b0bc1..732ccdde5db 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Alias.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Alias.cs @@ -15,7 +15,7 @@ public partial class Alias { protected Alias() => throw null; - internal Alias(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Alias(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Model.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Model.cs index 792e9511624..7b505ace84b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Model.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Model.cs @@ -14,7 +14,7 @@ public partial class Model { protected Model() => throw null; - internal Model(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Model(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Parameters.Spread.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Parameters.Spread.csproj index c74f45c2ceb..745a930a71c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Parameters.Spread.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Parameters.Spread.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/DifferentBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/DifferentBody.cs index 765ef0cc721..312c67bae84 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/DifferentBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/DifferentBody.cs @@ -14,7 +14,7 @@ public partial class DifferentBody { protected DifferentBody() => throw null; - internal DifferentBody(ClientPipeline pipeline, Uri endpoint) => throw null; + internal DifferentBody(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/SameBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/SameBody.cs index 57af2a77ab4..5e4ea4bdfcf 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/SameBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/SameBody.cs @@ -14,7 +14,7 @@ public partial class SameBody { protected SameBody() => throw null; - internal SameBody(ClientPipeline pipeline, Uri endpoint) => throw null; + internal SameBody(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Payload.ContentNegotiation.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Payload.ContentNegotiation.csproj index a51f764b849..d4ac273a048 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Payload.ContentNegotiation.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Payload.ContentNegotiation.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/head/src/Payload.Head.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/head/src/Payload.Head.csproj index be5eae6c928..243e2c031ad 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/head/src/Payload.Head.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/head/src/Payload.Head.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Payload.JsonMergePatch.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Payload.JsonMergePatch.csproj index ff988d62f02..6c232c732d5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Payload.JsonMergePatch.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Payload.JsonMergePatch.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/StringBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/StringBody.cs index 3efbadabb94..2e6eb91efba 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/StringBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/StringBody.cs @@ -14,7 +14,7 @@ public partial class StringBody { protected StringBody() => throw null; - internal StringBody(ClientPipeline pipeline, Uri endpoint) => throw null; + internal StringBody(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Payload.MediaType.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Payload.MediaType.csproj index 6a3f11bf2b8..cd6c6d10ee3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Payload.MediaType.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Payload.MediaType.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormData.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormData.cs index b71a7dc4bac..9d5dcc862de 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormData.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormData.cs @@ -18,7 +18,7 @@ public partial class FormData { protected FormData() => throw null; - internal FormData(ClientPipeline pipeline, Uri endpoint) => throw null; + internal FormData(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataFile.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataFile.cs index f84fa20fb66..4dd88ee4df1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataFile.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataFile.cs @@ -15,7 +15,7 @@ public partial class FormDataFile { protected FormDataFile() => throw null; - internal FormDataFile(ClientPipeline pipeline, Uri endpoint) => throw null; + internal FormDataFile(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpParts.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpParts.cs index d6c43ec3d03..790f1fab911 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpParts.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpParts.cs @@ -18,7 +18,7 @@ public partial class FormDataHttpParts { protected FormDataHttpParts() => throw null; - internal FormDataHttpParts(ClientPipeline pipeline, Uri endpoint) => throw null; + internal FormDataHttpParts(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsContentType.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsContentType.cs index 90e57522b9e..0d4426bba44 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsContentType.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsContentType.cs @@ -16,7 +16,7 @@ public partial class FormDataHttpPartsContentType { protected FormDataHttpPartsContentType() => throw null; - internal FormDataHttpPartsContentType(ClientPipeline pipeline, Uri endpoint) => throw null; + internal FormDataHttpPartsContentType(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsNonString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsNonString.cs index 6bc48d779eb..40d5b0516c3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsNonString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsNonString.cs @@ -15,7 +15,7 @@ public partial class FormDataHttpPartsNonString { protected FormDataHttpPartsNonString() => throw null; - internal FormDataHttpPartsNonString(ClientPipeline pipeline, Uri endpoint) => throw null; + internal FormDataHttpPartsNonString(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Payload.MultiPart.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Payload.MultiPart.csproj index eabedd8c56c..f1314ec890b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Payload.MultiPart.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Payload.MultiPart.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageSize.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageSize.cs index 1ba387d0819..7da523220e8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageSize.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageSize.cs @@ -14,7 +14,7 @@ public partial class PageSize { protected PageSize() => throw null; - internal PageSize(ClientPipeline pipeline, Uri endpoint) => throw null; + internal PageSize(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPagination.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPagination.cs index 3d0c9d66977..1b9ecdcf9df 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPagination.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPagination.cs @@ -16,7 +16,7 @@ public partial class ServerDrivenPagination { protected ServerDrivenPagination() => throw null; - internal ServerDrivenPagination(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ServerDrivenPagination(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPaginationAlternateInitialVerb.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPaginationAlternateInitialVerb.cs index 29706308ee7..3255758088a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPaginationAlternateInitialVerb.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPaginationAlternateInitialVerb.cs @@ -14,7 +14,7 @@ public partial class ServerDrivenPaginationAlternateInitialVerb { protected ServerDrivenPaginationAlternateInitialVerb() => throw null; - internal ServerDrivenPaginationAlternateInitialVerb(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ServerDrivenPaginationAlternateInitialVerb(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPaginationContinuationToken.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPaginationContinuationToken.cs index 928eaab911f..4177548e5ca 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPaginationContinuationToken.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPaginationContinuationToken.cs @@ -14,7 +14,7 @@ public partial class ServerDrivenPaginationContinuationToken { protected ServerDrivenPaginationContinuationToken() => throw null; - internal ServerDrivenPaginationContinuationToken(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ServerDrivenPaginationContinuationToken(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/XmlPagination.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/XmlPagination.cs index edbc61168f7..746d364ca15 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/XmlPagination.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/XmlPagination.cs @@ -14,7 +14,7 @@ public partial class XmlPagination { protected XmlPagination() => throw null; - internal XmlPagination(ClientPipeline pipeline, Uri endpoint) => throw null; + internal XmlPagination(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Payload.Pageable.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Payload.Pageable.csproj index 3c0533a73e5..a25c5d2f7a9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Payload.Pageable.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Payload.Pageable.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithArrayOfModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithArrayOfModelValue.cs index f1cfe2710d1..daa1c5d6b4b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithArrayOfModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithArrayOfModelValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithArrayOfModelValue { protected ModelWithArrayOfModelValue() => throw null; - internal ModelWithArrayOfModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithArrayOfModelValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithAttributesValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithAttributesValue.cs index 283cfb4c443..963eaaa120f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithAttributesValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithAttributesValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithAttributesValue { protected ModelWithAttributesValue() => throw null; - internal ModelWithAttributesValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithAttributesValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDatetimeValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDatetimeValue.cs index f986467c432..804d7f349a2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDatetimeValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDatetimeValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithDatetimeValue { protected ModelWithDatetimeValue() => throw null; - internal ModelWithDatetimeValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithDatetimeValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDictionaryValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDictionaryValue.cs index 0c0df435c8a..7d3b9486fbd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDictionaryValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDictionaryValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithDictionaryValue { protected ModelWithDictionaryValue() => throw null; - internal ModelWithDictionaryValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithDictionaryValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEmptyArrayValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEmptyArrayValue.cs index bad31fbc8cc..aab2f7f32f1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEmptyArrayValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEmptyArrayValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithEmptyArrayValue { protected ModelWithEmptyArrayValue() => throw null; - internal ModelWithEmptyArrayValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithEmptyArrayValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEncodedNamesValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEncodedNamesValue.cs index 6b6a02b751f..26938fb4215 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEncodedNamesValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEncodedNamesValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithEncodedNamesValue { protected ModelWithEncodedNamesValue() => throw null; - internal ModelWithEncodedNamesValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithEncodedNamesValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEnumValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEnumValue.cs index 92f3738b2ec..9005fca6a22 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEnumValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEnumValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithEnumValue { protected ModelWithEnumValue() => throw null; - internal ModelWithEnumValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithEnumValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithNamespaceOnPropertiesValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithNamespaceOnPropertiesValue.cs index 879ead4fe76..5700df3b5d6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithNamespaceOnPropertiesValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithNamespaceOnPropertiesValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithNamespaceOnPropertiesValue { protected ModelWithNamespaceOnPropertiesValue() => throw null; - internal ModelWithNamespaceOnPropertiesValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithNamespaceOnPropertiesValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithNamespaceValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithNamespaceValue.cs index d643648ed49..3afdec71e37 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithNamespaceValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithNamespaceValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithNamespaceValue { protected ModelWithNamespaceValue() => throw null; - internal ModelWithNamespaceValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithNamespaceValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithNestedModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithNestedModelValue.cs index d41a92de547..d9fdf8f524a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithNestedModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithNestedModelValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithNestedModelValue { protected ModelWithNestedModelValue() => throw null; - internal ModelWithNestedModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithNestedModelValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithOptionalFieldValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithOptionalFieldValue.cs index e2bbd2a0fe9..e14af0465f9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithOptionalFieldValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithOptionalFieldValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithOptionalFieldValue { protected ModelWithOptionalFieldValue() => throw null; - internal ModelWithOptionalFieldValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithOptionalFieldValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedArraysValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedArraysValue.cs index f387ba00d47..7b436d2852b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedArraysValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedArraysValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithRenamedArraysValue { protected ModelWithRenamedArraysValue() => throw null; - internal ModelWithRenamedArraysValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithRenamedArraysValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedAttributeValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedAttributeValue.cs index 3b8eb46d813..d0b28aeda46 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedAttributeValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedAttributeValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithRenamedAttributeValue { protected ModelWithRenamedAttributeValue() => throw null; - internal ModelWithRenamedAttributeValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithRenamedAttributeValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedFieldsValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedFieldsValue.cs index 291ca0113d2..9b33b95df26 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedFieldsValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedFieldsValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithRenamedFieldsValue { protected ModelWithRenamedFieldsValue() => throw null; - internal ModelWithRenamedFieldsValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithRenamedFieldsValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedNestedModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedNestedModelValue.cs index 664f8f440cf..34e1be434d5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedNestedModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedNestedModelValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithRenamedNestedModelValue { protected ModelWithRenamedNestedModelValue() => throw null; - internal ModelWithRenamedNestedModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithRenamedNestedModelValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedPropertyValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedPropertyValue.cs index 365d16e26d8..45bebd45d9e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedPropertyValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedPropertyValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithRenamedPropertyValue { protected ModelWithRenamedPropertyValue() => throw null; - internal ModelWithRenamedPropertyValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithRenamedPropertyValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedUnwrappedModelArrayValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedUnwrappedModelArrayValue.cs index 28d556f7ca6..017c4d8807b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedUnwrappedModelArrayValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedUnwrappedModelArrayValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithRenamedUnwrappedModelArrayValue { protected ModelWithRenamedUnwrappedModelArrayValue() => throw null; - internal ModelWithRenamedUnwrappedModelArrayValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithRenamedUnwrappedModelArrayValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedWrappedAndItemModelArrayValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedWrappedAndItemModelArrayValue.cs index 5115f8cdb99..fd23984df14 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedWrappedAndItemModelArrayValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedWrappedAndItemModelArrayValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithRenamedWrappedAndItemModelArrayValue { protected ModelWithRenamedWrappedAndItemModelArrayValue() => throw null; - internal ModelWithRenamedWrappedAndItemModelArrayValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithRenamedWrappedAndItemModelArrayValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedWrappedModelArrayValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedWrappedModelArrayValue.cs index 63eeecf6fc5..dfd5f637e53 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedWrappedModelArrayValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedWrappedModelArrayValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithRenamedWrappedModelArrayValue { protected ModelWithRenamedWrappedModelArrayValue() => throw null; - internal ModelWithRenamedWrappedModelArrayValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithRenamedWrappedModelArrayValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithSimpleArraysValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithSimpleArraysValue.cs index ef168252ce1..7c5e72da7b9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithSimpleArraysValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithSimpleArraysValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithSimpleArraysValue { protected ModelWithSimpleArraysValue() => throw null; - internal ModelWithSimpleArraysValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithSimpleArraysValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithTextValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithTextValue.cs index 273515d228e..7b593a43601 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithTextValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithTextValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithTextValue { protected ModelWithTextValue() => throw null; - internal ModelWithTextValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithTextValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithUnwrappedArrayValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithUnwrappedArrayValue.cs index 319bba5194c..65ff3928291 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithUnwrappedArrayValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithUnwrappedArrayValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithUnwrappedArrayValue { protected ModelWithUnwrappedArrayValue() => throw null; - internal ModelWithUnwrappedArrayValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithUnwrappedArrayValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithUnwrappedModelArrayValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithUnwrappedModelArrayValue.cs index 6de34a4cfd2..9b048f4f48f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithUnwrappedModelArrayValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithUnwrappedModelArrayValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithUnwrappedModelArrayValue { protected ModelWithUnwrappedModelArrayValue() => throw null; - internal ModelWithUnwrappedModelArrayValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithUnwrappedModelArrayValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithWrappedPrimitiveCustomItemNamesValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithWrappedPrimitiveCustomItemNamesValue.cs index 324e75cf8ef..e52f8e4a2a1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithWrappedPrimitiveCustomItemNamesValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithWrappedPrimitiveCustomItemNamesValue.cs @@ -14,7 +14,7 @@ public partial class ModelWithWrappedPrimitiveCustomItemNamesValue { protected ModelWithWrappedPrimitiveCustomItemNamesValue() => throw null; - internal ModelWithWrappedPrimitiveCustomItemNamesValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelWithWrappedPrimitiveCustomItemNamesValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/SimpleModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/SimpleModelValue.cs index 0ca41673678..6d9c48463b0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/SimpleModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/SimpleModelValue.cs @@ -14,7 +14,7 @@ public partial class SimpleModelValue { protected SimpleModelValue() => throw null; - internal SimpleModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal SimpleModelValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlErrorValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlErrorValue.cs index cf37b300967..3cdd912dd03 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlErrorValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlErrorValue.cs @@ -14,7 +14,7 @@ public partial class XmlErrorValue { protected XmlErrorValue() => throw null; - internal XmlErrorValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal XmlErrorValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Payload.Xml.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Payload.Xml.csproj index 0a23625d1a7..2fb350e009b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Payload.Xml.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Payload.Xml.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Resiliency.SrvDriven.V1.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Resiliency.SrvDriven.V1.csproj index 3c17f45e389..85cbd910c9c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Resiliency.SrvDriven.V1.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Resiliency.SrvDriven.V1.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Resiliency.SrvDriven.V2.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Resiliency.SrvDriven.V2.csproj index 099d808e435..8ea007e6961 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Resiliency.SrvDriven.V2.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Resiliency.SrvDriven.V2.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/body-or-no-content/src/Response.BodyOrNoContent.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/body-or-no-content/src/Response.BodyOrNoContent.csproj index da285aa6732..71b6f50bd9d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/body-or-no-content/src/Response.BodyOrNoContent.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/body-or-no-content/src/Response.BodyOrNoContent.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Response.StatusCodeRange.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Response.StatusCodeRange.csproj index 9f4db4b0446..7ec2c51a158 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Response.StatusCodeRange.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Response.StatusCodeRange.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/InInterface.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/InInterface.cs index 934018fdcc3..3bfa4313659 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/InInterface.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/InInterface.cs @@ -14,7 +14,7 @@ public partial class InInterface { protected InInterface() => throw null; - internal InInterface(ClientPipeline pipeline, Uri endpoint) => throw null; + internal InInterface(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParameters.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParameters.cs index 305a607546a..c846d04cc7c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParameters.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParameters.cs @@ -19,7 +19,7 @@ public partial class PathParameters { protected PathParameters() => throw null; - internal PathParameters(ClientPipeline pipeline, Uri endpoint) => throw null; + internal PathParameters(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansion.cs index a3daa8878cb..158ce22f11d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansion.cs @@ -13,7 +13,7 @@ public partial class PathParametersLabelExpansion { protected PathParametersLabelExpansion() => throw null; - internal PathParametersLabelExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; + internal PathParametersLabelExpansion(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionExplode.cs index d032c33fc38..4f3b48916e0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionExplode.cs @@ -15,7 +15,7 @@ public partial class PathParametersLabelExpansionExplode { protected PathParametersLabelExpansionExplode() => throw null; - internal PathParametersLabelExpansionExplode(ClientPipeline pipeline, Uri endpoint) => throw null; + internal PathParametersLabelExpansionExplode(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionStandard.cs index f18f1e516cc..4a4d8e064e8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionStandard.cs @@ -15,7 +15,7 @@ public partial class PathParametersLabelExpansionStandard { protected PathParametersLabelExpansionStandard() => throw null; - internal PathParametersLabelExpansionStandard(ClientPipeline pipeline, Uri endpoint) => throw null; + internal PathParametersLabelExpansionStandard(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansion.cs index 5c60d18f7bb..9c8cdf3072b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansion.cs @@ -13,7 +13,7 @@ public partial class PathParametersMatrixExpansion { protected PathParametersMatrixExpansion() => throw null; - internal PathParametersMatrixExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; + internal PathParametersMatrixExpansion(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionExplode.cs index bf3f3e88d58..c041d51ea0d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionExplode.cs @@ -15,7 +15,7 @@ public partial class PathParametersMatrixExpansionExplode { protected PathParametersMatrixExpansionExplode() => throw null; - internal PathParametersMatrixExpansionExplode(ClientPipeline pipeline, Uri endpoint) => throw null; + internal PathParametersMatrixExpansionExplode(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionStandard.cs index 165a76d190f..4ed1f7686b0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionStandard.cs @@ -15,7 +15,7 @@ public partial class PathParametersMatrixExpansionStandard { protected PathParametersMatrixExpansionStandard() => throw null; - internal PathParametersMatrixExpansionStandard(ClientPipeline pipeline, Uri endpoint) => throw null; + internal PathParametersMatrixExpansionStandard(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansion.cs index 11bd31de479..b4d769cde22 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansion.cs @@ -13,7 +13,7 @@ public partial class PathParametersPathExpansion { protected PathParametersPathExpansion() => throw null; - internal PathParametersPathExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; + internal PathParametersPathExpansion(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionExplode.cs index e2368337641..69a6759af41 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionExplode.cs @@ -15,7 +15,7 @@ public partial class PathParametersPathExpansionExplode { protected PathParametersPathExpansionExplode() => throw null; - internal PathParametersPathExpansionExplode(ClientPipeline pipeline, Uri endpoint) => throw null; + internal PathParametersPathExpansionExplode(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionStandard.cs index 8c63b0829fb..1f1e57faffb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionStandard.cs @@ -15,7 +15,7 @@ public partial class PathParametersPathExpansionStandard { protected PathParametersPathExpansionStandard() => throw null; - internal PathParametersPathExpansionStandard(ClientPipeline pipeline, Uri endpoint) => throw null; + internal PathParametersPathExpansionStandard(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersReservedExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersReservedExpansion.cs index 60f78bfde07..d4d3d225187 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersReservedExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersReservedExpansion.cs @@ -14,7 +14,7 @@ public partial class PathParametersReservedExpansion { protected PathParametersReservedExpansion() => throw null; - internal PathParametersReservedExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; + internal PathParametersReservedExpansion(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansion.cs index 87724df6d6d..c16e799468e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansion.cs @@ -13,7 +13,7 @@ public partial class PathParametersSimpleExpansion { protected PathParametersSimpleExpansion() => throw null; - internal PathParametersSimpleExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; + internal PathParametersSimpleExpansion(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionExplode.cs index 2abcc233d4b..c6d9303b066 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionExplode.cs @@ -15,7 +15,7 @@ public partial class PathParametersSimpleExpansionExplode { protected PathParametersSimpleExpansionExplode() => throw null; - internal PathParametersSimpleExpansionExplode(ClientPipeline pipeline, Uri endpoint) => throw null; + internal PathParametersSimpleExpansionExplode(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionStandard.cs index 21f896bcdb3..411f942f5be 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionStandard.cs @@ -15,7 +15,7 @@ public partial class PathParametersSimpleExpansionStandard { protected PathParametersSimpleExpansionStandard() => throw null; - internal PathParametersSimpleExpansionStandard(ClientPipeline pipeline, Uri endpoint) => throw null; + internal PathParametersSimpleExpansionStandard(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParameters.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParameters.cs index 50f707d2cf0..c83b68001ba 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParameters.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParameters.cs @@ -16,7 +16,7 @@ public partial class QueryParameters { protected QueryParameters() => throw null; - internal QueryParameters(ClientPipeline pipeline, Uri endpoint) => throw null; + internal QueryParameters(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuation.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuation.cs index 3aa640a00e5..93eddaee2e8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuation.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuation.cs @@ -13,7 +13,7 @@ public partial class QueryParametersQueryContinuation { protected QueryParametersQueryContinuation() => throw null; - internal QueryParametersQueryContinuation(ClientPipeline pipeline, Uri endpoint) => throw null; + internal QueryParametersQueryContinuation(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationExplode.cs index ec4ef6df4dd..9b0c8ad0730 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationExplode.cs @@ -16,7 +16,7 @@ public partial class QueryParametersQueryContinuationExplode { protected QueryParametersQueryContinuationExplode() => throw null; - internal QueryParametersQueryContinuationExplode(ClientPipeline pipeline, Uri endpoint) => throw null; + internal QueryParametersQueryContinuationExplode(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationStandard.cs index 5d7db689b50..6270b51b515 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationStandard.cs @@ -16,7 +16,7 @@ public partial class QueryParametersQueryContinuationStandard { protected QueryParametersQueryContinuationStandard() => throw null; - internal QueryParametersQueryContinuationStandard(ClientPipeline pipeline, Uri endpoint) => throw null; + internal QueryParametersQueryContinuationStandard(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansion.cs index 4d2b16565c0..646d56c8ab8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansion.cs @@ -13,7 +13,7 @@ public partial class QueryParametersQueryExpansion { protected QueryParametersQueryExpansion() => throw null; - internal QueryParametersQueryExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; + internal QueryParametersQueryExpansion(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionExplode.cs index 4fcbfdf9f58..9a8d4fe97ec 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionExplode.cs @@ -16,7 +16,7 @@ public partial class QueryParametersQueryExpansionExplode { protected QueryParametersQueryExpansionExplode() => throw null; - internal QueryParametersQueryExpansionExplode(ClientPipeline pipeline, Uri endpoint) => throw null; + internal QueryParametersQueryExpansionExplode(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionStandard.cs index 94a758a0020..a7317662c1d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionStandard.cs @@ -16,7 +16,7 @@ public partial class QueryParametersQueryExpansionStandard { protected QueryParametersQueryExpansionStandard() => throw null; - internal QueryParametersQueryExpansionStandard(ClientPipeline pipeline, Uri endpoint) => throw null; + internal QueryParametersQueryExpansionStandard(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Routes.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Routes.csproj index 68470455f61..e88aa642dbe 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Routes.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Routes.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/Property.cs index 67558d68030..7759084149e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/Property.cs @@ -14,7 +14,7 @@ public partial class Property { protected Property() => throw null; - internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Property(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Serialization.EncodedName.Json.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Serialization.EncodedName.Json.csproj index 43deed8db6a..bb42614421f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Serialization.EncodedName.Json.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Serialization.EncodedName.Json.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Server.Endpoint.NotDefined.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Server.Endpoint.NotDefined.csproj index 5d2734a9ba7..47987f325bb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Server.Endpoint.NotDefined.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Server.Endpoint.NotDefined.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Server.Path.Multiple.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Server.Path.Multiple.csproj index 4826ef70ea6..5174ea2dc3b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Server.Path.Multiple.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Server.Path.Multiple.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Server.Path.Single.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Server.Path.Single.csproj index 233ef58ad65..c3accce0327 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Server.Path.Single.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Server.Path.Single.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Server.Versions.NotVersioned.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Server.Versions.NotVersioned.csproj index 52a7800234f..a0397a84a63 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Server.Versions.NotVersioned.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Server.Versions.NotVersioned.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Server.Versions.Versioned.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Server.Versions.Versioned.csproj index 6faf3e78a72..baf1dc2df3f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Server.Versions.Versioned.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Server.Versions.Versioned.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/service/multiple-services/src/Generated/AOperations.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/service/multiple-services/src/Generated/AOperations.cs index 360678a1915..cfbb026d6d2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/service/multiple-services/src/Generated/AOperations.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/service/multiple-services/src/Generated/AOperations.cs @@ -14,7 +14,7 @@ public partial class AOperations { protected AOperations() => throw null; - internal AOperations(ClientPipeline pipeline, Uri endpoint, string apiVersion) => throw null; + internal AOperations(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, string apiVersion) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/service/multiple-services/src/Generated/ASubNamespace.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/service/multiple-services/src/Generated/ASubNamespace.cs index bca19b71505..99d0702448d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/service/multiple-services/src/Generated/ASubNamespace.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/service/multiple-services/src/Generated/ASubNamespace.cs @@ -14,7 +14,7 @@ public partial class ASubNamespace { protected ASubNamespace() => throw null; - internal ASubNamespace(ClientPipeline pipeline, Uri endpoint, string apiVersion) => throw null; + internal ASubNamespace(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, string apiVersion) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/service/multiple-services/src/Generated/BOperations.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/service/multiple-services/src/Generated/BOperations.cs index e087db0efda..c65ceb8d775 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/service/multiple-services/src/Generated/BOperations.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/service/multiple-services/src/Generated/BOperations.cs @@ -14,7 +14,7 @@ public partial class BOperations { protected BOperations() => throw null; - internal BOperations(ClientPipeline pipeline, Uri endpoint, string apiVersion) => throw null; + internal BOperations(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, string apiVersion) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/service/multiple-services/src/Generated/BSubNamespace.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/service/multiple-services/src/Generated/BSubNamespace.cs index 24d968a4f48..6fceb6d0343 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/service/multiple-services/src/Generated/BSubNamespace.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/service/multiple-services/src/Generated/BSubNamespace.cs @@ -14,7 +14,7 @@ public partial class BSubNamespace { protected BSubNamespace() => throw null; - internal BSubNamespace(ClientPipeline pipeline, Uri endpoint, string apiVersion) => throw null; + internal BSubNamespace(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, string apiVersion) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/service/multiple-services/src/Service.MultipleServices.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/service/multiple-services/src/Service.MultipleServices.csproj index 6e9552bbe81..d508e3721cb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/service/multiple-services/src/Service.MultipleServices.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/service/multiple-services/src/Service.MultipleServices.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/SpecialHeaders.ConditionalRequest.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/SpecialHeaders.ConditionalRequest.csproj index 717cb7e9813..58edb0affc2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/SpecialHeaders.ConditionalRequest.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/SpecialHeaders.ConditionalRequest.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/SpecialHeaders.Repeatability.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/SpecialHeaders.Repeatability.csproj index 213d2fa239a..09f635e3f62 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/SpecialHeaders.Repeatability.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/SpecialHeaders.Repeatability.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ExtensibleStrings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ExtensibleStrings.cs index e3eccdf112f..f0db940ded2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ExtensibleStrings.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ExtensibleStrings.cs @@ -14,7 +14,7 @@ public partial class ExtensibleStrings { protected ExtensibleStrings() => throw null; - internal ExtensibleStrings(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ExtensibleStrings(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ModelProperties.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ModelProperties.cs index 145be0ededd..15550618361 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ModelProperties.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ModelProperties.cs @@ -14,7 +14,7 @@ public partial class ModelProperties { protected ModelProperties() => throw null; - internal ModelProperties(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelProperties(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models.cs index ec89fe4d3f7..eca4be2c027 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models.cs @@ -14,7 +14,7 @@ public partial class Models { protected Models() => throw null; - internal Models(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Models(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Operations.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Operations.cs index 1dfa7cdcfbe..98457a73a18 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Operations.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Operations.cs @@ -14,7 +14,7 @@ public partial class Operations { protected Operations() => throw null; - internal Operations(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Operations(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Parameters.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Parameters.cs index fb1b60d7ad1..95cc38f20f8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Parameters.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Parameters.cs @@ -14,7 +14,7 @@ public partial class Parameters { protected Parameters() => throw null; - internal Parameters(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Parameters(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ReservedOperationBodyParams.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ReservedOperationBodyParams.cs index fe2765a0f7e..75bc8b41404 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ReservedOperationBodyParams.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ReservedOperationBodyParams.cs @@ -15,7 +15,7 @@ public partial class ReservedOperationBodyParams { protected ReservedOperationBodyParams() => throw null; - internal ReservedOperationBodyParams(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ReservedOperationBodyParams(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/SpecialWords.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/SpecialWords.csproj index 42bccff6ae2..4a6fdbc0ab4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/SpecialWords.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/SpecialWords.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/Basic.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/Basic.cs index 6864baba20c..f02009929d9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/Basic.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/Basic.cs @@ -15,7 +15,7 @@ public partial class Basic { protected Basic() => throw null; - internal Basic(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Basic(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Streaming.Jsonl.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Streaming.Jsonl.csproj index 386ce9e5bf0..75c958d51fa 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Streaming.Jsonl.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Streaming.Jsonl.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/Named.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/Named.cs index dcd42a02d7d..a87b40ef06b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/Named.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/Named.cs @@ -15,7 +15,7 @@ public partial class Named { protected Named() => throw null; - internal Named(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Named(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/Protocol.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/Protocol.cs index 6e6993579c0..f91a6639ef5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/Protocol.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/Protocol.cs @@ -16,7 +16,7 @@ public partial class Protocol { protected Protocol() => throw null; - internal Protocol(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Protocol(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/ProtocolData.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/ProtocolData.cs index d69c2a81e78..a194480ccde 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/ProtocolData.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/ProtocolData.cs @@ -15,7 +15,7 @@ public partial class ProtocolData { protected ProtocolData() => throw null; - internal ProtocolData(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ProtocolData(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/Retrieve.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/Retrieve.cs index c3a3454024b..20849b9c15e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/Retrieve.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/Retrieve.cs @@ -15,7 +15,7 @@ public partial class Retrieve { protected Retrieve() => throw null; - internal Retrieve(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Retrieve(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/Unnamed.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/Unnamed.cs index 78819a96162..1d92a2c4b49 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/Unnamed.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/Unnamed.cs @@ -15,7 +15,7 @@ public partial class Unnamed { protected Unnamed() => throw null; - internal Unnamed(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Unnamed(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Streaming.Sse.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Streaming.Sse.csproj index 8aa31b7d7b8..64b7c04028c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Streaming.Sse.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Streaming.Sse.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/BooleanValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/BooleanValue.cs index d290fed4d03..4b879ce7784 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/BooleanValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/BooleanValue.cs @@ -15,7 +15,7 @@ public partial class BooleanValue { protected BooleanValue() => throw null; - internal BooleanValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal BooleanValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DatetimeValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DatetimeValue.cs index c7cd4718045..49d8a8e2585 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DatetimeValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DatetimeValue.cs @@ -15,7 +15,7 @@ public partial class DatetimeValue { protected DatetimeValue() => throw null; - internal DatetimeValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal DatetimeValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DurationValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DurationValue.cs index d41e7956ded..ea8b39fa587 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DurationValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DurationValue.cs @@ -15,7 +15,7 @@ public partial class DurationValue { protected DurationValue() => throw null; - internal DurationValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal DurationValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Float32Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Float32Value.cs index 139091b980e..92ffd9dce81 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Float32Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Float32Value.cs @@ -15,7 +15,7 @@ public partial class Float32Value { protected Float32Value() => throw null; - internal Float32Value(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Float32Value(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int32Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int32Value.cs index b38525f6496..220afb32817 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int32Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int32Value.cs @@ -15,7 +15,7 @@ public partial class Int32Value { protected Int32Value() => throw null; - internal Int32Value(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Int32Value(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int64Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int64Value.cs index 952fb96e4cc..239fcdbfb9e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int64Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int64Value.cs @@ -15,7 +15,7 @@ public partial class Int64Value { protected Int64Value() => throw null; - internal Int64Value(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Int64Value(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ModelValue.cs index 333dfabdcff..6c4d17c6afa 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ModelValue.cs @@ -15,7 +15,7 @@ public partial class ModelValue { protected ModelValue() => throw null; - internal ModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableBooleanValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableBooleanValue.cs index eb0177c832a..0acef378880 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableBooleanValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableBooleanValue.cs @@ -15,7 +15,7 @@ public partial class NullableBooleanValue { protected NullableBooleanValue() => throw null; - internal NullableBooleanValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal NullableBooleanValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableFloatValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableFloatValue.cs index ab401bf7739..fc2a2325977 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableFloatValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableFloatValue.cs @@ -15,7 +15,7 @@ public partial class NullableFloatValue { protected NullableFloatValue() => throw null; - internal NullableFloatValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal NullableFloatValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableInt32Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableInt32Value.cs index df168f64ea3..3f395c81287 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableInt32Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableInt32Value.cs @@ -15,7 +15,7 @@ public partial class NullableInt32Value { protected NullableInt32Value() => throw null; - internal NullableInt32Value(ClientPipeline pipeline, Uri endpoint) => throw null; + internal NullableInt32Value(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableModelValue.cs index 336d4186bd1..4110323f5ed 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableModelValue.cs @@ -15,7 +15,7 @@ public partial class NullableModelValue { protected NullableModelValue() => throw null; - internal NullableModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal NullableModelValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableStringValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableStringValue.cs index f22d0fb8493..36e7904c2f6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableStringValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableStringValue.cs @@ -15,7 +15,7 @@ public partial class NullableStringValue { protected NullableStringValue() => throw null; - internal NullableStringValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal NullableStringValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/StringValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/StringValue.cs index e330fa6ffa4..3970942a7f1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/StringValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/StringValue.cs @@ -15,7 +15,7 @@ public partial class StringValue { protected StringValue() => throw null; - internal StringValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal StringValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/UnknownValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/UnknownValue.cs index a049ca8e8b3..6f74d2e21b6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/UnknownValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/UnknownValue.cs @@ -15,7 +15,7 @@ public partial class UnknownValue { protected UnknownValue() => throw null; - internal UnknownValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal UnknownValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Type.Array.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Type.Array.csproj index 77dc363cea8..ac47b1d3719 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Type.Array.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Type.Array.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/BooleanValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/BooleanValue.cs index f4727e78b82..fd78c5d53f9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/BooleanValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/BooleanValue.cs @@ -15,7 +15,7 @@ public partial class BooleanValue { protected BooleanValue() => throw null; - internal BooleanValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal BooleanValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DatetimeValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DatetimeValue.cs index 03241999bc4..8376ca226c9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DatetimeValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DatetimeValue.cs @@ -15,7 +15,7 @@ public partial class DatetimeValue { protected DatetimeValue() => throw null; - internal DatetimeValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal DatetimeValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DurationValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DurationValue.cs index 025fb9260d0..8f1adadd9e8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DurationValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DurationValue.cs @@ -15,7 +15,7 @@ public partial class DurationValue { protected DurationValue() => throw null; - internal DurationValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal DurationValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Float32Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Float32Value.cs index bb5152ac021..ba0923dbab2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Float32Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Float32Value.cs @@ -15,7 +15,7 @@ public partial class Float32Value { protected Float32Value() => throw null; - internal Float32Value(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Float32Value(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int32Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int32Value.cs index 943b687f046..53961df6489 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int32Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int32Value.cs @@ -15,7 +15,7 @@ public partial class Int32Value { protected Int32Value() => throw null; - internal Int32Value(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Int32Value(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int64Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int64Value.cs index 7963141ea14..c583dbeb3b6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int64Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int64Value.cs @@ -15,7 +15,7 @@ public partial class Int64Value { protected Int64Value() => throw null; - internal Int64Value(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Int64Value(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/ModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/ModelValue.cs index 58bd7395fb9..de16cb62848 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/ModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/ModelValue.cs @@ -15,7 +15,7 @@ public partial class ModelValue { protected ModelValue() => throw null; - internal ModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/NullableFloatValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/NullableFloatValue.cs index b1b16591b20..95295ad0e64 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/NullableFloatValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/NullableFloatValue.cs @@ -15,7 +15,7 @@ public partial class NullableFloatValue { protected NullableFloatValue() => throw null; - internal NullableFloatValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal NullableFloatValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/RecursiveModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/RecursiveModelValue.cs index eb4eac17013..b9fe05868aa 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/RecursiveModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/RecursiveModelValue.cs @@ -15,7 +15,7 @@ public partial class RecursiveModelValue { protected RecursiveModelValue() => throw null; - internal RecursiveModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal RecursiveModelValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/StringValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/StringValue.cs index 7fe039c683c..465c7d3880f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/StringValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/StringValue.cs @@ -15,7 +15,7 @@ public partial class StringValue { protected StringValue() => throw null; - internal StringValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal StringValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/UnknownValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/UnknownValue.cs index f91e8911853..135dba3a995 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/UnknownValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/UnknownValue.cs @@ -15,7 +15,7 @@ public partial class UnknownValue { protected UnknownValue() => throw null; - internal UnknownValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal UnknownValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Type.Dictionary.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Type.Dictionary.csproj index b9349e3e09f..dcbf6766df7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Type.Dictionary.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Type.Dictionary.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/String.cs index 30632b37530..bf3d4c52b95 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/String.cs @@ -14,7 +14,7 @@ public partial class String { protected String() => throw null; - internal String(ClientPipeline pipeline, Uri endpoint) => throw null; + internal String(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Type.Enum.Extensible.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Type.Enum.Extensible.csproj index 23bca11e63c..8cca7eb9ec3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Type.Enum.Extensible.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Type.Enum.Extensible.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/String.cs index 056c892aa72..da4f03c69f4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/String.cs @@ -14,7 +14,7 @@ public partial class String { protected String() => throw null; - internal String(ClientPipeline pipeline, Uri endpoint) => throw null; + internal String(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Type.Enum.Fixed.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Type.Enum.Fixed.csproj index f78989a3dcb..01bbbe8890c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Type.Enum.Fixed.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Type.Enum.Fixed.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Type.Model.Empty.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Type.Model.Empty.csproj index 38489965704..e94282b23fb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Type.Model.Empty.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Type.Model.Empty.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Type.Model.Inheritance.EnumDiscriminator.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Type.Model.Inheritance.EnumDiscriminator.csproj index a98d5249cb6..784ab6b3480 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Type.Model.Inheritance.EnumDiscriminator.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Type.Model.Inheritance.EnumDiscriminator.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Type.Model.Inheritance.NestedDiscriminator.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Type.Model.Inheritance.NestedDiscriminator.csproj index 135fea440d0..9997cad7bc9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Type.Model.Inheritance.NestedDiscriminator.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Type.Model.Inheritance.NestedDiscriminator.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Type.Model.Inheritance.NotDiscriminated.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Type.Model.Inheritance.NotDiscriminated.csproj index 38e4fe07a13..18000914486 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Type.Model.Inheritance.NotDiscriminated.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Type.Model.Inheritance.NotDiscriminated.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Type.Model.Inheritance.Recursive.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Type.Model.Inheritance.Recursive.csproj index 2a98bea847c..1688a556c64 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Type.Model.Inheritance.Recursive.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Type.Model.Inheritance.Recursive.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Type.Model.Inheritance.SingleDiscriminator.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Type.Model.Inheritance.SingleDiscriminator.csproj index b579ae9f805..86e5c88a87c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Type.Model.Inheritance.SingleDiscriminator.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Type.Model.Inheritance.SingleDiscriminator.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Type.Model.Usage.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Type.Model.Usage.csproj index 5f798130e2f..01962276d1a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Type.Model.Usage.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Type.Model.Usage.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Type.Model.Visibility.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Type.Model.Visibility.csproj index 022336babf4..e7d6030c12f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Type.Model.Visibility.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Type.Model.Visibility.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadFloat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadFloat.cs index aa298158cb9..cb4cb946b70 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadFloat.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadFloat.cs @@ -14,7 +14,7 @@ public partial class ExtendsDifferentSpreadFloat { protected ExtendsDifferentSpreadFloat() => throw null; - internal ExtendsDifferentSpreadFloat(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ExtendsDifferentSpreadFloat(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModel.cs index eaf913f4276..647c6a83c12 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModel.cs @@ -14,7 +14,7 @@ public partial class ExtendsDifferentSpreadModel { protected ExtendsDifferentSpreadModel() => throw null; - internal ExtendsDifferentSpreadModel(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ExtendsDifferentSpreadModel(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModelArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModelArray.cs index 2aacfeb2d02..7fb21353d7b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModelArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModelArray.cs @@ -14,7 +14,7 @@ public partial class ExtendsDifferentSpreadModelArray { protected ExtendsDifferentSpreadModelArray() => throw null; - internal ExtendsDifferentSpreadModelArray(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ExtendsDifferentSpreadModelArray(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadString.cs index 3ee0ddc45c5..1c0dfe8c3ef 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadString.cs @@ -14,7 +14,7 @@ public partial class ExtendsDifferentSpreadString { protected ExtendsDifferentSpreadString() => throw null; - internal ExtendsDifferentSpreadString(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ExtendsDifferentSpreadString(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsFloat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsFloat.cs index 6f55bee1976..5ff6ed0c167 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsFloat.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsFloat.cs @@ -14,7 +14,7 @@ public partial class ExtendsFloat { protected ExtendsFloat() => throw null; - internal ExtendsFloat(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ExtendsFloat(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModel.cs index a3e6a49c40f..8711249dcd3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModel.cs @@ -14,7 +14,7 @@ public partial class ExtendsModel { protected ExtendsModel() => throw null; - internal ExtendsModel(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ExtendsModel(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModelArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModelArray.cs index 1da8aae31d1..b5a49c4c4bc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModelArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModelArray.cs @@ -14,7 +14,7 @@ public partial class ExtendsModelArray { protected ExtendsModelArray() => throw null; - internal ExtendsModelArray(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ExtendsModelArray(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsString.cs index 13a5fbf8c13..84ea33e9c76 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsString.cs @@ -14,7 +14,7 @@ public partial class ExtendsString { protected ExtendsString() => throw null; - internal ExtendsString(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ExtendsString(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknown.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknown.cs index 6e539221d9b..96c3d1cb956 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknown.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknown.cs @@ -14,7 +14,7 @@ public partial class ExtendsUnknown { protected ExtendsUnknown() => throw null; - internal ExtendsUnknown(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ExtendsUnknown(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDerived.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDerived.cs index f1636a68905..b344aab38de 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDerived.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDerived.cs @@ -14,7 +14,7 @@ public partial class ExtendsUnknownDerived { protected ExtendsUnknownDerived() => throw null; - internal ExtendsUnknownDerived(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ExtendsUnknownDerived(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDiscriminated.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDiscriminated.cs index 261d9de0a04..ddd339f988b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDiscriminated.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDiscriminated.cs @@ -14,7 +14,7 @@ public partial class ExtendsUnknownDiscriminated { protected ExtendsUnknownDiscriminated() => throw null; - internal ExtendsUnknownDiscriminated(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ExtendsUnknownDiscriminated(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsFloat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsFloat.cs index 8be79e2ef26..56c61de0ba9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsFloat.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsFloat.cs @@ -14,7 +14,7 @@ public partial class IsFloat { protected IsFloat() => throw null; - internal IsFloat(ClientPipeline pipeline, Uri endpoint) => throw null; + internal IsFloat(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModel.cs index 65a3fa72022..e372b0ca9c6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModel.cs @@ -14,7 +14,7 @@ public partial class IsModel { protected IsModel() => throw null; - internal IsModel(ClientPipeline pipeline, Uri endpoint) => throw null; + internal IsModel(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModelArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModelArray.cs index a4a639ee799..8894af17c45 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModelArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModelArray.cs @@ -14,7 +14,7 @@ public partial class IsModelArray { protected IsModelArray() => throw null; - internal IsModelArray(ClientPipeline pipeline, Uri endpoint) => throw null; + internal IsModelArray(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsString.cs index 10718fca333..678d3b82506 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsString.cs @@ -14,7 +14,7 @@ public partial class IsString { protected IsString() => throw null; - internal IsString(ClientPipeline pipeline, Uri endpoint) => throw null; + internal IsString(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknown.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknown.cs index 19c46424094..602a5a50607 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknown.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknown.cs @@ -14,7 +14,7 @@ public partial class IsUnknown { protected IsUnknown() => throw null; - internal IsUnknown(ClientPipeline pipeline, Uri endpoint) => throw null; + internal IsUnknown(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDerived.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDerived.cs index 50e217613ef..6de4a91f0c0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDerived.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDerived.cs @@ -14,7 +14,7 @@ public partial class IsUnknownDerived { protected IsUnknownDerived() => throw null; - internal IsUnknownDerived(ClientPipeline pipeline, Uri endpoint) => throw null; + internal IsUnknownDerived(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDiscriminated.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDiscriminated.cs index f6470550016..0fca23355e8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDiscriminated.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDiscriminated.cs @@ -14,7 +14,7 @@ public partial class IsUnknownDiscriminated { protected IsUnknownDiscriminated() => throw null; - internal IsUnknownDiscriminated(ClientPipeline pipeline, Uri endpoint) => throw null; + internal IsUnknownDiscriminated(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/MultipleSpread.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/MultipleSpread.cs index 47355266fd2..39a48e4093c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/MultipleSpread.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/MultipleSpread.cs @@ -14,7 +14,7 @@ public partial class MultipleSpread { protected MultipleSpread() => throw null; - internal MultipleSpread(ClientPipeline pipeline, Uri endpoint) => throw null; + internal MultipleSpread(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentFloat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentFloat.cs index 33d2e052e33..717f9978cfd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentFloat.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentFloat.cs @@ -14,7 +14,7 @@ public partial class SpreadDifferentFloat { protected SpreadDifferentFloat() => throw null; - internal SpreadDifferentFloat(ClientPipeline pipeline, Uri endpoint) => throw null; + internal SpreadDifferentFloat(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModel.cs index a69132c7526..9afca0a2af3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModel.cs @@ -14,7 +14,7 @@ public partial class SpreadDifferentModel { protected SpreadDifferentModel() => throw null; - internal SpreadDifferentModel(ClientPipeline pipeline, Uri endpoint) => throw null; + internal SpreadDifferentModel(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModelArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModelArray.cs index 5c6d809aa7c..654387b4070 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModelArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModelArray.cs @@ -14,7 +14,7 @@ public partial class SpreadDifferentModelArray { protected SpreadDifferentModelArray() => throw null; - internal SpreadDifferentModelArray(ClientPipeline pipeline, Uri endpoint) => throw null; + internal SpreadDifferentModelArray(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentString.cs index 4123898a1ec..0009372244a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentString.cs @@ -14,7 +14,7 @@ public partial class SpreadDifferentString { protected SpreadDifferentString() => throw null; - internal SpreadDifferentString(ClientPipeline pipeline, Uri endpoint) => throw null; + internal SpreadDifferentString(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadFloat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadFloat.cs index a529e2b406f..77be01a9b6b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadFloat.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadFloat.cs @@ -14,7 +14,7 @@ public partial class SpreadFloat { protected SpreadFloat() => throw null; - internal SpreadFloat(ClientPipeline pipeline, Uri endpoint) => throw null; + internal SpreadFloat(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModel.cs index 002a15917bc..aa1f3ee55cc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModel.cs @@ -14,7 +14,7 @@ public partial class SpreadModel { protected SpreadModel() => throw null; - internal SpreadModel(ClientPipeline pipeline, Uri endpoint) => throw null; + internal SpreadModel(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModelArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModelArray.cs index bdc347b9941..f9321506f9d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModelArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModelArray.cs @@ -14,7 +14,7 @@ public partial class SpreadModelArray { protected SpreadModelArray() => throw null; - internal SpreadModelArray(ClientPipeline pipeline, Uri endpoint) => throw null; + internal SpreadModelArray(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion.cs index dfd6786a0ab..10484d7e035 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion.cs @@ -14,7 +14,7 @@ public partial class SpreadRecordNonDiscriminatedUnion { protected SpreadRecordNonDiscriminatedUnion() => throw null; - internal SpreadRecordNonDiscriminatedUnion(ClientPipeline pipeline, Uri endpoint) => throw null; + internal SpreadRecordNonDiscriminatedUnion(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion2.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion2.cs index d33e1a547dc..7eb3905ae59 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion2.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion2.cs @@ -14,7 +14,7 @@ public partial class SpreadRecordNonDiscriminatedUnion2 { protected SpreadRecordNonDiscriminatedUnion2() => throw null; - internal SpreadRecordNonDiscriminatedUnion2(ClientPipeline pipeline, Uri endpoint) => throw null; + internal SpreadRecordNonDiscriminatedUnion2(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion3.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion3.cs index 76b3cf8b1fe..7608aa8135c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion3.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion3.cs @@ -14,7 +14,7 @@ public partial class SpreadRecordNonDiscriminatedUnion3 { protected SpreadRecordNonDiscriminatedUnion3() => throw null; - internal SpreadRecordNonDiscriminatedUnion3(ClientPipeline pipeline, Uri endpoint) => throw null; + internal SpreadRecordNonDiscriminatedUnion3(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordUnion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordUnion.cs index 97de92c85f4..d541ada17c4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordUnion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordUnion.cs @@ -14,7 +14,7 @@ public partial class SpreadRecordUnion { protected SpreadRecordUnion() => throw null; - internal SpreadRecordUnion(ClientPipeline pipeline, Uri endpoint) => throw null; + internal SpreadRecordUnion(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadString.cs index 4864d532e5a..a10227fc00f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadString.cs @@ -14,7 +14,7 @@ public partial class SpreadString { protected SpreadString() => throw null; - internal SpreadString(ClientPipeline pipeline, Uri endpoint) => throw null; + internal SpreadString(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Type.Property.AdditionalProperties.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Type.Property.AdditionalProperties.csproj index 34571a06526..59329d2fd98 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Type.Property.AdditionalProperties.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Type.Property.AdditionalProperties.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Bytes.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Bytes.cs index 4e6ff0b6f10..bbfc937a4f3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Bytes.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Bytes.cs @@ -14,7 +14,7 @@ public partial class Bytes { protected Bytes() => throw null; - internal Bytes(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Bytes(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsByte.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsByte.cs index 147ed22adef..708d4d0363a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsByte.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsByte.cs @@ -14,7 +14,7 @@ public partial class CollectionsByte { protected CollectionsByte() => throw null; - internal CollectionsByte(ClientPipeline pipeline, Uri endpoint) => throw null; + internal CollectionsByte(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsModel.cs index a2cb3752dd3..e0bf037204f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsModel.cs @@ -14,7 +14,7 @@ public partial class CollectionsModel { protected CollectionsModel() => throw null; - internal CollectionsModel(ClientPipeline pipeline, Uri endpoint) => throw null; + internal CollectionsModel(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsString.cs index 9ebdb4ed447..b8e3edc5686 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsString.cs @@ -14,7 +14,7 @@ public partial class CollectionsString { protected CollectionsString() => throw null; - internal CollectionsString(ClientPipeline pipeline, Uri endpoint) => throw null; + internal CollectionsString(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Datetime.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Datetime.cs index 65fd66ab449..f621e6d79ea 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Datetime.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Datetime.cs @@ -14,7 +14,7 @@ public partial class Datetime { protected Datetime() => throw null; - internal Datetime(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Datetime(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Duration.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Duration.cs index d1091acfe3d..2f51e177918 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Duration.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Duration.cs @@ -14,7 +14,7 @@ public partial class Duration { protected Duration() => throw null; - internal Duration(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Duration(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/String.cs index 786c381fb0b..90c6b280ad2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/String.cs @@ -14,7 +14,7 @@ public partial class String { protected String() => throw null; - internal String(ClientPipeline pipeline, Uri endpoint) => throw null; + internal String(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Type.Property.Nullable.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Type.Property.Nullable.csproj index 7ebe5c775ca..d18eab3fc86 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Type.Property.Nullable.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Type.Property.Nullable.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/BooleanLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/BooleanLiteral.cs index 6dca0711f46..7d177aa2ae7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/BooleanLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/BooleanLiteral.cs @@ -14,7 +14,7 @@ public partial class BooleanLiteral { protected BooleanLiteral() => throw null; - internal BooleanLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + internal BooleanLiteral(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Bytes.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Bytes.cs index 44c535cc253..15055740fe3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Bytes.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Bytes.cs @@ -14,7 +14,7 @@ public partial class Bytes { protected Bytes() => throw null; - internal Bytes(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Bytes(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsByte.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsByte.cs index 808a6ca8b49..f5d10fbdd0a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsByte.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsByte.cs @@ -14,7 +14,7 @@ public partial class CollectionsByte { protected CollectionsByte() => throw null; - internal CollectionsByte(ClientPipeline pipeline, Uri endpoint) => throw null; + internal CollectionsByte(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsModel.cs index 00be1dcec43..f37987f500e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsModel.cs @@ -14,7 +14,7 @@ public partial class CollectionsModel { protected CollectionsModel() => throw null; - internal CollectionsModel(ClientPipeline pipeline, Uri endpoint) => throw null; + internal CollectionsModel(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Datetime.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Datetime.cs index 3b2e4f0017b..2a7a3c232c3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Datetime.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Datetime.cs @@ -14,7 +14,7 @@ public partial class Datetime { protected Datetime() => throw null; - internal Datetime(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Datetime(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Duration.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Duration.cs index 9a9c63ae762..24d60ca25f1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Duration.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Duration.cs @@ -14,7 +14,7 @@ public partial class Duration { protected Duration() => throw null; - internal Duration(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Duration(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/FloatLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/FloatLiteral.cs index f7504a61cf2..1602cbb113a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/FloatLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/FloatLiteral.cs @@ -14,7 +14,7 @@ public partial class FloatLiteral { protected FloatLiteral() => throw null; - internal FloatLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + internal FloatLiteral(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/IntLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/IntLiteral.cs index 3309e35bfe2..5776473d281 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/IntLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/IntLiteral.cs @@ -14,7 +14,7 @@ public partial class IntLiteral { protected IntLiteral() => throw null; - internal IntLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + internal IntLiteral(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainDate.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainDate.cs index f95ec369404..4707037d2dc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainDate.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainDate.cs @@ -14,7 +14,7 @@ public partial class PlainDate { protected PlainDate() => throw null; - internal PlainDate(ClientPipeline pipeline, Uri endpoint) => throw null; + internal PlainDate(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainTime.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainTime.cs index 91c30419caf..eb2419c7c13 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainTime.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainTime.cs @@ -14,7 +14,7 @@ public partial class PlainTime { protected PlainTime() => throw null; - internal PlainTime(ClientPipeline pipeline, Uri endpoint) => throw null; + internal PlainTime(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/RequiredAndOptional.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/RequiredAndOptional.cs index 3253e5b109d..53ecc14244d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/RequiredAndOptional.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/RequiredAndOptional.cs @@ -14,7 +14,7 @@ public partial class RequiredAndOptional { protected RequiredAndOptional() => throw null; - internal RequiredAndOptional(ClientPipeline pipeline, Uri endpoint) => throw null; + internal RequiredAndOptional(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/String.cs index def30985883..f15a3d484b6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/String.cs @@ -14,7 +14,7 @@ public partial class String { protected String() => throw null; - internal String(ClientPipeline pipeline, Uri endpoint) => throw null; + internal String(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/StringLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/StringLiteral.cs index a60ba46a07e..71719bcb379 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/StringLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/StringLiteral.cs @@ -14,7 +14,7 @@ public partial class StringLiteral { protected StringLiteral() => throw null; - internal StringLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + internal StringLiteral(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionFloatLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionFloatLiteral.cs index 9471446beff..abc3cacd508 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionFloatLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionFloatLiteral.cs @@ -14,7 +14,7 @@ public partial class UnionFloatLiteral { protected UnionFloatLiteral() => throw null; - internal UnionFloatLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + internal UnionFloatLiteral(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionIntLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionIntLiteral.cs index 45324fc4c4d..a96d1c2b442 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionIntLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionIntLiteral.cs @@ -14,7 +14,7 @@ public partial class UnionIntLiteral { protected UnionIntLiteral() => throw null; - internal UnionIntLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + internal UnionIntLiteral(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionStringLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionStringLiteral.cs index 4a44db8c460..aac451971f2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionStringLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionStringLiteral.cs @@ -14,7 +14,7 @@ public partial class UnionStringLiteral { protected UnionStringLiteral() => throw null; - internal UnionStringLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + internal UnionStringLiteral(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Type.Property.Optional.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Type.Property.Optional.csproj index c23f32ee47e..650f27ab9a4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Type.Property.Optional.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Type.Property.Optional.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Boolean.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Boolean.cs index f4e93d97aa5..5d427642dcd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Boolean.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Boolean.cs @@ -14,7 +14,7 @@ public partial class Boolean { protected Boolean() => throw null; - internal Boolean(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Boolean(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/BooleanLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/BooleanLiteral.cs index e2bdc72c983..16f7ce99fb1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/BooleanLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/BooleanLiteral.cs @@ -14,7 +14,7 @@ public partial class BooleanLiteral { protected BooleanLiteral() => throw null; - internal BooleanLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + internal BooleanLiteral(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Bytes.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Bytes.cs index 428e3397974..c625dfd9990 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Bytes.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Bytes.cs @@ -14,7 +14,7 @@ public partial class Bytes { protected Bytes() => throw null; - internal Bytes(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Bytes(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsInt.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsInt.cs index f49bb79df44..cc3066f3c6a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsInt.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsInt.cs @@ -14,7 +14,7 @@ public partial class CollectionsInt { protected CollectionsInt() => throw null; - internal CollectionsInt(ClientPipeline pipeline, Uri endpoint) => throw null; + internal CollectionsInt(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsModel.cs index e40359c230c..c72880a1bed 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsModel.cs @@ -14,7 +14,7 @@ public partial class CollectionsModel { protected CollectionsModel() => throw null; - internal CollectionsModel(ClientPipeline pipeline, Uri endpoint) => throw null; + internal CollectionsModel(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsString.cs index 18a7083e450..9c03164e798 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsString.cs @@ -14,7 +14,7 @@ public partial class CollectionsString { protected CollectionsString() => throw null; - internal CollectionsString(ClientPipeline pipeline, Uri endpoint) => throw null; + internal CollectionsString(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Datetime.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Datetime.cs index 9b6385a11da..07ddfb05c8e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Datetime.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Datetime.cs @@ -14,7 +14,7 @@ public partial class Datetime { protected Datetime() => throw null; - internal Datetime(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Datetime(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal.cs index 90ac68ab77b..02a6192473d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal.cs @@ -14,7 +14,7 @@ public partial class Decimal { protected Decimal() => throw null; - internal Decimal(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Decimal(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal128.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal128.cs index 06b87e33722..bee286f499f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal128.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal128.cs @@ -14,7 +14,7 @@ public partial class Decimal128 { protected Decimal128() => throw null; - internal Decimal128(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Decimal128(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/DictionaryString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/DictionaryString.cs index d1d5dc8e06e..967227b0f7b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/DictionaryString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/DictionaryString.cs @@ -14,7 +14,7 @@ public partial class DictionaryString { protected DictionaryString() => throw null; - internal DictionaryString(ClientPipeline pipeline, Uri endpoint) => throw null; + internal DictionaryString(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Duration.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Duration.cs index 304ea7ce05e..a8785ce1d92 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Duration.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Duration.cs @@ -14,7 +14,7 @@ public partial class Duration { protected Duration() => throw null; - internal Duration(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Duration(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Enum.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Enum.cs index 6ee002b6a38..10ece0439c9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Enum.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Enum.cs @@ -14,7 +14,7 @@ public partial class Enum { protected Enum() => throw null; - internal Enum(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Enum(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ExtensibleEnum.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ExtensibleEnum.cs index 05e0b19b4c5..65f621b6f41 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ExtensibleEnum.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ExtensibleEnum.cs @@ -14,7 +14,7 @@ public partial class ExtensibleEnum { protected ExtensibleEnum() => throw null; - internal ExtensibleEnum(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ExtensibleEnum(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Float.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Float.cs index 31ca39d2378..df386654b0d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Float.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Float.cs @@ -14,7 +14,7 @@ public partial class Float { protected Float() => throw null; - internal Float(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Float(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/FloatLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/FloatLiteral.cs index 272147c3f79..7c0153c456e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/FloatLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/FloatLiteral.cs @@ -14,7 +14,7 @@ public partial class FloatLiteral { protected FloatLiteral() => throw null; - internal FloatLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + internal FloatLiteral(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Int.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Int.cs index 42d5cab9109..1615f19c127 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Int.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Int.cs @@ -14,7 +14,7 @@ public partial class Int { protected Int() => throw null; - internal Int(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Int(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/IntLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/IntLiteral.cs index 1504957189f..ac34278c5f1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/IntLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/IntLiteral.cs @@ -14,7 +14,7 @@ public partial class IntLiteral { protected IntLiteral() => throw null; - internal IntLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + internal IntLiteral(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Model.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Model.cs index 1c306e46d07..410a6c472b1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Model.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Model.cs @@ -14,7 +14,7 @@ public partial class Model { protected Model() => throw null; - internal Model(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Model(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Never.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Never.cs index 8e08e0fa31e..6e6cb8c4534 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Never.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Never.cs @@ -14,7 +14,7 @@ public partial class Never { protected Never() => throw null; - internal Never(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Never(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/String.cs index c49f8856b95..7da9bcfb9d4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/String.cs @@ -14,7 +14,7 @@ public partial class String { protected String() => throw null; - internal String(ClientPipeline pipeline, Uri endpoint) => throw null; + internal String(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/StringLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/StringLiteral.cs index 4e4108e032f..37d416927c4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/StringLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/StringLiteral.cs @@ -14,7 +14,7 @@ public partial class StringLiteral { protected StringLiteral() => throw null; - internal StringLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + internal StringLiteral(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionEnumValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionEnumValue.cs index bc5592782ce..3501ac27a4d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionEnumValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionEnumValue.cs @@ -14,7 +14,7 @@ public partial class UnionEnumValue { protected UnionEnumValue() => throw null; - internal UnionEnumValue(ClientPipeline pipeline, Uri endpoint) => throw null; + internal UnionEnumValue(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionFloatLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionFloatLiteral.cs index b722ec14e86..ad193b09543 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionFloatLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionFloatLiteral.cs @@ -14,7 +14,7 @@ public partial class UnionFloatLiteral { protected UnionFloatLiteral() => throw null; - internal UnionFloatLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + internal UnionFloatLiteral(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionIntLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionIntLiteral.cs index 32e42a85f40..720f1d73903 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionIntLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionIntLiteral.cs @@ -14,7 +14,7 @@ public partial class UnionIntLiteral { protected UnionIntLiteral() => throw null; - internal UnionIntLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + internal UnionIntLiteral(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionStringLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionStringLiteral.cs index fde1c748c4d..b7b3dd95115 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionStringLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionStringLiteral.cs @@ -14,7 +14,7 @@ public partial class UnionStringLiteral { protected UnionStringLiteral() => throw null; - internal UnionStringLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + internal UnionStringLiteral(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownArray.cs index f40c76b820a..4026f1e9d1a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownArray.cs @@ -14,7 +14,7 @@ public partial class UnknownArray { protected UnknownArray() => throw null; - internal UnknownArray(ClientPipeline pipeline, Uri endpoint) => throw null; + internal UnknownArray(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownDict.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownDict.cs index 81fdff22645..b07506da1be 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownDict.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownDict.cs @@ -14,7 +14,7 @@ public partial class UnknownDict { protected UnknownDict() => throw null; - internal UnknownDict(ClientPipeline pipeline, Uri endpoint) => throw null; + internal UnknownDict(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownInt.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownInt.cs index fb2f59c1cc5..539342425de 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownInt.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownInt.cs @@ -14,7 +14,7 @@ public partial class UnknownInt { protected UnknownInt() => throw null; - internal UnknownInt(ClientPipeline pipeline, Uri endpoint) => throw null; + internal UnknownInt(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownString.cs index bb587ae7036..7fc80da863b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownString.cs @@ -14,7 +14,7 @@ public partial class UnknownString { protected UnknownString() => throw null; - internal UnknownString(ClientPipeline pipeline, Uri endpoint) => throw null; + internal UnknownString(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Type.Property.ValueTypes.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Type.Property.ValueTypes.csproj index 673d7d885d3..301653f6119 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Type.Property.ValueTypes.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Type.Property.ValueTypes.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Boolean.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Boolean.cs index f3a074a4c57..96d77c0c440 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Boolean.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Boolean.cs @@ -14,7 +14,7 @@ public partial class Boolean { protected Boolean() => throw null; - internal Boolean(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Boolean(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Type.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Type.cs index 6e3566ea66a..7988e1d9ab6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Type.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Type.cs @@ -14,7 +14,7 @@ public partial class Decimal128Type { protected Decimal128Type() => throw null; - internal Decimal128Type(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Decimal128Type(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Verify.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Verify.cs index 11e138c5ac3..70882364cc3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Verify.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Verify.cs @@ -15,7 +15,7 @@ public partial class Decimal128Verify { protected Decimal128Verify() => throw null; - internal Decimal128Verify(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Decimal128Verify(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalType.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalType.cs index c225451e654..5608dcbbf9f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalType.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalType.cs @@ -14,7 +14,7 @@ public partial class DecimalType { protected DecimalType() => throw null; - internal DecimalType(ClientPipeline pipeline, Uri endpoint) => throw null; + internal DecimalType(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalVerify.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalVerify.cs index 6b00b6964ac..105cb30ac2e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalVerify.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalVerify.cs @@ -15,7 +15,7 @@ public partial class DecimalVerify { protected DecimalVerify() => throw null; - internal DecimalVerify(ClientPipeline pipeline, Uri endpoint) => throw null; + internal DecimalVerify(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/String.cs index e58e6a99949..2bd7941052f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/String.cs @@ -14,7 +14,7 @@ public partial class String { protected String() => throw null; - internal String(ClientPipeline pipeline, Uri endpoint) => throw null; + internal String(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Unknown.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Unknown.cs index ad255b77e27..b5523784a9c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Unknown.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Unknown.cs @@ -14,7 +14,7 @@ public partial class Unknown { protected Unknown() => throw null; - internal Unknown(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Unknown(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Type.Scalar.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Type.Scalar.csproj index 9628e297261..59b35b16f55 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Type.Scalar.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Type.Scalar.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/CustomDiscriminator.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/CustomDiscriminator.cs index 04834a9f6e2..85cd22751cb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/CustomDiscriminator.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/CustomDiscriminator.cs @@ -11,7 +11,7 @@ public partial class CustomDiscriminator { protected CustomDiscriminator() => throw null; - internal CustomDiscriminator(ClientPipeline pipeline, Uri endpoint) => throw null; + internal CustomDiscriminator(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/CustomDiscriminatorOperations.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/CustomDiscriminatorOperations.cs index 886f9a0b28f..b662d0e1a9f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/CustomDiscriminatorOperations.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/CustomDiscriminatorOperations.cs @@ -14,7 +14,7 @@ public partial class CustomDiscriminatorOperations { protected CustomDiscriminatorOperations() => throw null; - internal CustomDiscriminatorOperations(ClientPipeline pipeline, Uri endpoint) => throw null; + internal CustomDiscriminatorOperations(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/EnumDiscriminator.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/EnumDiscriminator.cs index aa0efc63a4a..7da2f6fce19 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/EnumDiscriminator.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/EnumDiscriminator.cs @@ -11,7 +11,7 @@ public partial class EnumDiscriminator { protected EnumDiscriminator() => throw null; - internal EnumDiscriminator(ClientPipeline pipeline, Uri endpoint) => throw null; + internal EnumDiscriminator(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/EnumDiscriminatorOperations.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/EnumDiscriminatorOperations.cs index 7d1691a0a57..bca8ae31f84 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/EnumDiscriminatorOperations.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/EnumDiscriminatorOperations.cs @@ -14,7 +14,7 @@ public partial class EnumDiscriminatorOperations { protected EnumDiscriminatorOperations() => throw null; - internal EnumDiscriminatorOperations(ClientPipeline pipeline, Uri endpoint) => throw null; + internal EnumDiscriminatorOperations(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/ExplicitDiscriminator.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/ExplicitDiscriminator.cs index 1360bf4bfd5..031d7523f02 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/ExplicitDiscriminator.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/ExplicitDiscriminator.cs @@ -11,7 +11,7 @@ public partial class ExplicitDiscriminator { protected ExplicitDiscriminator() => throw null; - internal ExplicitDiscriminator(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ExplicitDiscriminator(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/ExplicitDiscriminatorOperations.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/ExplicitDiscriminatorOperations.cs index b3d5ea205d3..0d46c0ee767 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/ExplicitDiscriminatorOperations.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/ExplicitDiscriminatorOperations.cs @@ -14,7 +14,7 @@ public partial class ExplicitDiscriminatorOperations { protected ExplicitDiscriminatorOperations() => throw null; - internal ExplicitDiscriminatorOperations(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ExplicitDiscriminatorOperations(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/InjectedDiscriminator.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/InjectedDiscriminator.cs index 163e7ef0fbe..2358b7130ef 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/InjectedDiscriminator.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/InjectedDiscriminator.cs @@ -11,7 +11,7 @@ public partial class InjectedDiscriminator { protected InjectedDiscriminator() => throw null; - internal InjectedDiscriminator(ClientPipeline pipeline, Uri endpoint) => throw null; + internal InjectedDiscriminator(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/InjectedDiscriminatorOperations.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/InjectedDiscriminatorOperations.cs index 58e306c9167..cbfdf2b85ba 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/InjectedDiscriminatorOperations.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/InjectedDiscriminatorOperations.cs @@ -14,7 +14,7 @@ public partial class InjectedDiscriminatorOperations { protected InjectedDiscriminatorOperations() => throw null; - internal InjectedDiscriminatorOperations(ClientPipeline pipeline, Uri endpoint) => throw null; + internal InjectedDiscriminatorOperations(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/Recursive.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/Recursive.cs index c0a1c77ff64..0df62ba2f7f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/Recursive.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Generated/Recursive.cs @@ -14,7 +14,7 @@ public partial class Recursive { protected Recursive() => throw null; - internal Recursive(ClientPipeline pipeline, Uri endpoint) => throw null; + internal Recursive(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Type.Union.Discriminated.Extends.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Type.Union.Discriminated.Extends.csproj index 79af0087b10..3dc7e9196a4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Type.Union.Discriminated.Extends.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/extends/src/Type.Union.Discriminated.Extends.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/EnumsOnly.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/EnumsOnly.cs index 326e87184ee..742a27f1434 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/EnumsOnly.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/EnumsOnly.cs @@ -14,7 +14,7 @@ public partial class EnumsOnly { protected EnumsOnly() => throw null; - internal EnumsOnly(ClientPipeline pipeline, Uri endpoint) => throw null; + internal EnumsOnly(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/FloatsOnly.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/FloatsOnly.cs index 687ca26b9d4..0807d1e03e4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/FloatsOnly.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/FloatsOnly.cs @@ -14,7 +14,7 @@ public partial class FloatsOnly { protected FloatsOnly() => throw null; - internal FloatsOnly(ClientPipeline pipeline, Uri endpoint) => throw null; + internal FloatsOnly(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/IntsOnly.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/IntsOnly.cs index d9e64843d11..ec5ff761c92 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/IntsOnly.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/IntsOnly.cs @@ -14,7 +14,7 @@ public partial class IntsOnly { protected IntsOnly() => throw null; - internal IntsOnly(ClientPipeline pipeline, Uri endpoint) => throw null; + internal IntsOnly(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedLiterals.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedLiterals.cs index 7ee7a6ee49c..3133b298f36 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedLiterals.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedLiterals.cs @@ -14,7 +14,7 @@ public partial class MixedLiterals { protected MixedLiterals() => throw null; - internal MixedLiterals(ClientPipeline pipeline, Uri endpoint) => throw null; + internal MixedLiterals(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedTypes.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedTypes.cs index b7ae1cff2e4..d56283b1f65 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedTypes.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedTypes.cs @@ -14,7 +14,7 @@ public partial class MixedTypes { protected MixedTypes() => throw null; - internal MixedTypes(ClientPipeline pipeline, Uri endpoint) => throw null; + internal MixedTypes(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/ModelsOnly.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/ModelsOnly.cs index ebb37812dc0..6f440496575 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/ModelsOnly.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/ModelsOnly.cs @@ -14,7 +14,7 @@ public partial class ModelsOnly { protected ModelsOnly() => throw null; - internal ModelsOnly(ClientPipeline pipeline, Uri endpoint) => throw null; + internal ModelsOnly(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringAndArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringAndArray.cs index 0a470dd358d..9a513978f95 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringAndArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringAndArray.cs @@ -14,7 +14,7 @@ public partial class StringAndArray { protected StringAndArray() => throw null; - internal StringAndArray(ClientPipeline pipeline, Uri endpoint) => throw null; + internal StringAndArray(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensible.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensible.cs index c6d886ad068..cbd5b04b002 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensible.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensible.cs @@ -14,7 +14,7 @@ public partial class StringExtensible { protected StringExtensible() => throw null; - internal StringExtensible(ClientPipeline pipeline, Uri endpoint) => throw null; + internal StringExtensible(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensibleNamed.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensibleNamed.cs index 85a4d399263..a7b44f55a63 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensibleNamed.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensibleNamed.cs @@ -14,7 +14,7 @@ public partial class StringExtensibleNamed { protected StringExtensibleNamed() => throw null; - internal StringExtensibleNamed(ClientPipeline pipeline, Uri endpoint) => throw null; + internal StringExtensibleNamed(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringsOnly.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringsOnly.cs index 317c4c7ca07..f402864ff30 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringsOnly.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringsOnly.cs @@ -14,7 +14,7 @@ public partial class StringsOnly { protected StringsOnly() => throw null; - internal StringsOnly(ClientPipeline pipeline, Uri endpoint) => throw null; + internal StringsOnly(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Type.Union.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Type.Union.csproj index d9c574f174f..8ecff4fa1d2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Type.Union.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Type.Union.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Versioning.Added.V1.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Versioning.Added.V1.csproj index 933ebbd8633..aaaa6ede97b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Versioning.Added.V1.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Versioning.Added.V1.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/InterfaceV2.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/InterfaceV2.cs index 09e38898e24..34deea4e020 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/InterfaceV2.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/InterfaceV2.cs @@ -14,7 +14,7 @@ public partial class InterfaceV2 { protected InterfaceV2() => throw null; - internal InterfaceV2(ClientPipeline pipeline, Uri endpoint, string version) => throw null; + internal InterfaceV2(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, string version) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Versioning.Added.V2.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Versioning.Added.V2.csproj index 1f17f3f5c7a..e3590fdbc1f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Versioning.Added.V2.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Versioning.Added.V2.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Versioning.MadeOptional.V1.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Versioning.MadeOptional.V1.csproj index 8a11d530c9e..21f0bb6fc54 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Versioning.MadeOptional.V1.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Versioning.MadeOptional.V1.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Versioning.MadeOptional.V2.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Versioning.MadeOptional.V2.csproj index 60d8478016e..f881257b6c6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Versioning.MadeOptional.V2.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Versioning.MadeOptional.V2.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/InterfaceV1.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/InterfaceV1.cs index 65f7690e6d9..805d99d720e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/InterfaceV1.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/InterfaceV1.cs @@ -14,7 +14,7 @@ public partial class InterfaceV1 { protected InterfaceV1() => throw null; - internal InterfaceV1(ClientPipeline pipeline, Uri endpoint, string version) => throw null; + internal InterfaceV1(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, string version) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Versioning.Removed.V1.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Versioning.Removed.V1.csproj index feedd2ecd8f..f8adf357411 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Versioning.Removed.V1.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Versioning.Removed.V1.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Versioning.Removed.V2.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Versioning.Removed.V2.csproj index e926e07f865..430da6164ad 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Versioning.Removed.V2.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Versioning.Removed.V2.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/InterfaceV1.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/InterfaceV1.cs index 65f7690e6d9..805d99d720e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/InterfaceV1.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/InterfaceV1.cs @@ -14,7 +14,7 @@ public partial class InterfaceV1 { protected InterfaceV1() => throw null; - internal InterfaceV1(ClientPipeline pipeline, Uri endpoint, string version) => throw null; + internal InterfaceV1(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, string version) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Versioning.Removed.V2Preview.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Versioning.Removed.V2Preview.csproj index cae8b76e6da..94f89d443c6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Versioning.Removed.V2Preview.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Versioning.Removed.V2Preview.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/OldInterface.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/OldInterface.cs index 165af44a376..24ec92848a0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/OldInterface.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/OldInterface.cs @@ -14,7 +14,7 @@ public partial class OldInterface { protected OldInterface() => throw null; - internal OldInterface(ClientPipeline pipeline, Uri endpoint, string version) => throw null; + internal OldInterface(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, string version) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Versioning.RenamedFrom.V1.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Versioning.RenamedFrom.V1.csproj index 2f98456a217..cab36b1b69c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Versioning.RenamedFrom.V1.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Versioning.RenamedFrom.V1.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/NewInterface.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/NewInterface.cs index 5a2e1c3333e..c1a43454a4d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/NewInterface.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/NewInterface.cs @@ -14,7 +14,7 @@ public partial class NewInterface { protected NewInterface() => throw null; - internal NewInterface(ClientPipeline pipeline, Uri endpoint, string version) => throw null; + internal NewInterface(ClientPipeline pipeline, ModelReaderWriterOptions modelReaderWriterOptions, Uri endpoint, string version) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Versioning.RenamedFrom.V2.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Versioning.RenamedFrom.V2.csproj index 445934f5bb0..c809bca2f68 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Versioning.RenamedFrom.V2.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Versioning.RenamedFrom.V2.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Versioning.ReturnTypeChangedFrom.V1.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Versioning.ReturnTypeChangedFrom.V1.csproj index df736caf62c..ece163bae50 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Versioning.ReturnTypeChangedFrom.V1.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Versioning.ReturnTypeChangedFrom.V1.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Versioning.ReturnTypeChangedFrom.V2.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Versioning.ReturnTypeChangedFrom.V2.csproj index 6f018604824..ea79c0f304f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Versioning.ReturnTypeChangedFrom.V2.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Versioning.ReturnTypeChangedFrom.V2.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Versioning.TypeChangedFrom.V1.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Versioning.TypeChangedFrom.V1.csproj index 6ec90566fb1..72a26eba795 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Versioning.TypeChangedFrom.V1.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Versioning.TypeChangedFrom.V1.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Versioning.TypeChangedFrom.V2.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Versioning.TypeChangedFrom.V2.csproj index a4e27099c19..c07fde0914a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Versioning.TypeChangedFrom.V2.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Versioning.TypeChangedFrom.V2.csproj @@ -10,7 +10,7 @@ - +