From 154579fe1725e18d277fb9ebc1dab5265f2a1576 Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Mon, 15 Apr 2024 10:00:49 +0800 Subject: [PATCH 01/19] fix utf8jsonbinarycontent in non-azure packages --- Packages.Data.props | 4 +- .../Models/Types/ExpressionTypeProvider.cs | 7 +- .../RequestContentHelperProvider.cs | 19 +-- .../Utf8JsonRequestContentProvider.cs | 5 +- .../Unbranded-TypeSpec/Unbranded-TypeSpec.tsp | 6 + .../Generated/Internal/BinaryContentHelper.cs | 120 ++++++++++++++++++ .../Internal/Utf8JsonBinaryContent.cs | 52 ++++++++ .../src/Generated/UnbrandedTypeSpecClient.cs | 105 +++++++++++++++ .../src/Generated/tspCodeModel.json | 118 ++++++++++++++++- 9 files changed, 409 insertions(+), 27 deletions(-) create mode 100644 test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/BinaryContentHelper.cs create mode 100644 test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/Utf8JsonBinaryContent.cs diff --git a/Packages.Data.props b/Packages.Data.props index 63650a55e45..cb01c57965f 100644 --- a/Packages.Data.props +++ b/Packages.Data.props @@ -15,7 +15,7 @@ - + @@ -33,7 +33,7 @@ - + diff --git a/src/AutoRest.CSharp/Common/Output/Models/Types/ExpressionTypeProvider.cs b/src/AutoRest.CSharp/Common/Output/Models/Types/ExpressionTypeProvider.cs index 5061f632264..d108d5fc6a0 100644 --- a/src/AutoRest.CSharp/Common/Output/Models/Types/ExpressionTypeProvider.cs +++ b/src/AutoRest.CSharp/Common/Output/Models/Types/ExpressionTypeProvider.cs @@ -30,11 +30,8 @@ internal static IEnumerable GetHelperProviders() yield return ClientPipelineExtensionsProvider.Instance; yield return ClientUriBuilderProvider.Instance; } - if (Configuration.IsBranded) - { - yield return RequestContentHelperProvider.Instance; - yield return Utf8JsonRequestContentProvider.Instance; - } + yield return RequestContentHelperProvider.Instance; + yield return Utf8JsonRequestContentProvider.Instance; if (Configuration.EnableBicepSerialization) { yield return BicepSerializationTypeProvider.Instance; diff --git a/src/AutoRest.CSharp/Common/Output/Models/Types/HelperTypeProviders/RequestContentHelperProvider.cs b/src/AutoRest.CSharp/Common/Output/Models/Types/HelperTypeProviders/RequestContentHelperProvider.cs index b7bbcd81a2b..7aded5304f7 100644 --- a/src/AutoRest.CSharp/Common/Output/Models/Types/HelperTypeProviders/RequestContentHelperProvider.cs +++ b/src/AutoRest.CSharp/Common/Output/Models/Types/HelperTypeProviders/RequestContentHelperProvider.cs @@ -26,15 +26,13 @@ internal class RequestContentHelperProvider : ExpressionTypeProvider private readonly MethodSignatureModifiers _methodModifiers = MethodSignatureModifiers.Public | MethodSignatureModifiers.Static; private RequestContentHelperProvider() : base(Configuration.HelperNamespace, null) { - // non-azure libraries do not need this type - Debug.Assert(Configuration.IsBranded); - + DefaultName = $"{Configuration.ApiTypes.RequestContentType.Name}Helper"; DeclarationModifiers = TypeSignatureModifiers.Internal | TypeSignatureModifiers.Static; _requestBodyType = Configuration.ApiTypes.RequestContentType; _utf8JsonRequestBodyType = Utf8JsonRequestContentProvider.Instance.Type; } - protected override string DefaultName => "RequestContentHelper"; + protected override string DefaultName { get; } protected override IEnumerable BuildMethods() { @@ -219,17 +217,12 @@ private Method BuildFromObjectMethod() ReturnType: _requestBodyType, Summary: null, Description: null, ReturnDescription: null); - var body = new List + var body = new MethodBodyStatement[] { - Declare(_utf8JsonRequestBodyType, "content", New.Instance(_utf8JsonRequestBodyType), out var content) - }; - var writer = Utf8JsonRequestContentProvider.Instance.JsonWriterProperty(content); - var value = (TypedValueExpression)valueParameter; - body.Add(new MethodBodyStatement[] - { - writer.WriteObjectValue(value, ModelReaderWriterOptionsExpression.Wire), + Declare(_utf8JsonRequestBodyType, "content", New.Instance(_utf8JsonRequestBodyType), out var content), + Utf8JsonRequestContentProvider.Instance.JsonWriterProperty(content).WriteObjectValue(valueParameter, ModelReaderWriterOptionsExpression.Wire), Return(content) - }); + }; return new Method(signature, body); } diff --git a/src/AutoRest.CSharp/Common/Output/Models/Types/HelperTypeProviders/Utf8JsonRequestContentProvider.cs b/src/AutoRest.CSharp/Common/Output/Models/Types/HelperTypeProviders/Utf8JsonRequestContentProvider.cs index 59471dc7c25..3267086d6c9 100644 --- a/src/AutoRest.CSharp/Common/Output/Models/Types/HelperTypeProviders/Utf8JsonRequestContentProvider.cs +++ b/src/AutoRest.CSharp/Common/Output/Models/Types/HelperTypeProviders/Utf8JsonRequestContentProvider.cs @@ -28,11 +28,8 @@ internal class Utf8JsonRequestContentProvider : ExpressionTypeProvider private Utf8JsonRequestContentProvider() : base(Configuration.HelperNamespace, null) { - // non-azure libraries do not need this type - Debug.Assert(Configuration.IsBranded); - DeclarationModifiers = TypeSignatureModifiers.Internal; - DefaultName = Configuration.IsBranded ? "Utf8JsonRequestContent" : "Utf8JsonRequestBody"; + DefaultName = $"Utf8Json{Configuration.ApiTypes.RequestContentType.Name}"; Inherits = Configuration.ApiTypes.RequestContentType; _streamField = new FieldDeclaration( diff --git a/test/UnbrandedProjects/Unbranded-TypeSpec/Unbranded-TypeSpec.tsp b/test/UnbrandedProjects/Unbranded-TypeSpec/Unbranded-TypeSpec.tsp index 9202ca1d995..3f70445421b 100644 --- a/test/UnbrandedProjects/Unbranded-TypeSpec/Unbranded-TypeSpec.tsp +++ b/test/UnbrandedProjects/Unbranded-TypeSpec/Unbranded-TypeSpec.tsp @@ -352,3 +352,9 @@ op stillConvenient(): void; @head @convenientAPI(true) op headAsBoolean(@path id: string): void; + +@route("/putArray") +@doc("put array.") +@put +@convenientAPI(true) +op putArray(@body body: string[]): void; diff --git a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/BinaryContentHelper.cs b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/BinaryContentHelper.cs new file mode 100644 index 00000000000..c39f0a947e1 --- /dev/null +++ b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/BinaryContentHelper.cs @@ -0,0 +1,120 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; + +namespace UnbrandedTypeSpec +{ + internal static class BinaryContentHelper + { + public static BinaryContent FromEnumerable(IEnumerable enumerable) + where T : notnull + { + Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); + content.JsonWriter.WriteStartArray(); + foreach (var item in enumerable) + { + content.JsonWriter.WriteObjectValue(item, new ModelReaderWriterOptions("W")); + } + content.JsonWriter.WriteEndArray(); + + return content; + } + + public static BinaryContent FromEnumerable(IEnumerable enumerable) + { + Utf8JsonBinaryContent content = new 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 (JsonDocument document = JsonDocument.Parse(item)) + { + JsonSerializer.Serialize(content.JsonWriter, document.RootElement); + } +#endif + } + } + content.JsonWriter.WriteEndArray(); + + return content; + } + + public static BinaryContent FromDictionary(IDictionary dictionary) + where TValue : notnull + { + Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); + content.JsonWriter.WriteStartObject(); + foreach (var item in dictionary) + { + content.JsonWriter.WritePropertyName(item.Key); + content.JsonWriter.WriteObjectValue(item.Value, new ModelReaderWriterOptions("W")); + } + content.JsonWriter.WriteEndObject(); + + return content; + } + + public static BinaryContent FromDictionary(IDictionary dictionary) + { + Utf8JsonBinaryContent content = new 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 (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(content.JsonWriter, document.RootElement); + } +#endif + } + } + content.JsonWriter.WriteEndObject(); + + return content; + } + + public static BinaryContent FromObject(object value) + { + Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); + content.JsonWriter.WriteObjectValue(value, new ModelReaderWriterOptions("W")); + return content; + } + + public static BinaryContent FromObject(BinaryData value) + { + Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); +#if NET6_0_OR_GREATER + content.JsonWriter.WriteRawValue(value); +#else + using (JsonDocument document = JsonDocument.Parse(value)) + { + JsonSerializer.Serialize(content.JsonWriter, document.RootElement); + } +#endif + return content; + } + } +} diff --git a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/Utf8JsonBinaryContent.cs b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/Utf8JsonBinaryContent.cs new file mode 100644 index 00000000000..ea26d5655b9 --- /dev/null +++ b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/Utf8JsonBinaryContent.cs @@ -0,0 +1,52 @@ +// + +#nullable disable + +using System.ClientModel; +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; + +namespace UnbrandedTypeSpec +{ + internal class Utf8JsonBinaryContent : BinaryContent + { + private readonly MemoryStream _stream; + private readonly BinaryContent _content; + + public Utf8JsonBinaryContent() + { + _stream = new MemoryStream(); + _content = Create(_stream); + JsonWriter = new Utf8JsonWriter(_stream); + } + + public Utf8JsonWriter JsonWriter { get; } + + public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) + { + await JsonWriter.FlushAsync().ConfigureAwait(false); + await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); + } + + public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) + { + JsonWriter.Flush(); + _content.WriteTo(stream, cancellationToken); + } + + public override bool TryComputeLength(out long length) + { + length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; + return true; + } + + public override void Dispose() + { + JsonWriter.Dispose(); + _content.Dispose(); + _stream.Dispose(); + } + } +} diff --git a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/UnbrandedTypeSpecClient.cs b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/UnbrandedTypeSpecClient.cs index d4836c2c78d..81963500cb9 100644 --- a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/UnbrandedTypeSpecClient.cs +++ b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/UnbrandedTypeSpecClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using UnbrandedTypeSpec.Models; @@ -1306,6 +1307,90 @@ public virtual ClientResult HeadAsBoolean(string id, RequestOptions option return ClientResult.FromValue(result.Value, result.GetRawResponse()); } + /// put array. + /// The where T is of type to use. + /// The cancellation token to use. + /// is null. + public virtual async Task PutArrayAsync(IEnumerable body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + RequestOptions options = FromCancellationToken(cancellationToken); + ClientResult result = await PutArrayAsync(content, options).ConfigureAwait(false); + return result; + } + + /// put array. + /// The where T is of type to use. + /// The cancellation token to use. + /// is null. + public virtual ClientResult PutArray(IEnumerable body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + RequestOptions options = FromCancellationToken(cancellationToken); + ClientResult result = PutArray(content, options); + return result; + } + + /// + /// [Protocol Method] put array. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutArrayAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutArrayRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] put array. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult PutArray(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutArrayRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + internal PipelineMessage CreateSayHiRequest(string headParameter, string queryParameter, string optionalQuery, RequestOptions options) { var message = _pipeline.CreateMessage(); @@ -1685,6 +1770,26 @@ internal PipelineMessage CreateHeadAsBooleanRequest(string id, RequestOptions op return message; } + internal PipelineMessage CreatePutArrayRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/putArray", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + private static RequestOptions DefaultRequestContext = new RequestOptions(); internal static RequestOptions FromCancellationToken(CancellationToken cancellationToken = default) { diff --git a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/tspCodeModel.json b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/tspCodeModel.json index 97127595a7e..4e634df26b9 100644 --- a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/tspCodeModel.json +++ b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/tspCodeModel.json @@ -3076,18 +3076,130 @@ "BufferResponse": true, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": true + }, + { + "$id": "316", + "Name": "putArray", + "ResourceName": "UnbrandedTypeSpec", + "Description": "put array.", + "Parameters": [ + { + "$ref": "145" + }, + { + "$id": "317", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "318", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$id": "319", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "320", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "321", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "322", + "Type": { + "$ref": "321" + }, + "Value": "application/json" + } + }, + { + "$id": "323", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "324", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "325", + "Type": { + "$ref": "324" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "326", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{unbrandedTypeSpecUrl}", + "Path": "/putArray", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true } ], "Protocol": { - "$id": "316" + "$id": "327" }, "Creatable": true } ], "Auth": { - "$id": "317", + "$id": "328", "ApiKey": { - "$id": "318", + "$id": "329", "Name": "my-api-key" } } From 935e3980ea038a2cbfc4e5419e0eb0f385726ed0 Mon Sep 17 00:00:00 2001 From: ArcturusZhang Date: Mon, 15 Apr 2024 11:10:11 +0800 Subject: [PATCH 02/19] update the version --- .../Common/AutoRest/Plugins/NewProjectScaffolding.cs | 2 +- .../http/custom/src/Scm.Authentication.Http.Custom.csproj | 2 +- .../Customized-TypeSpec/src/CustomizedTypeSpec.csproj | 2 +- .../UnbrandedProjects/NoTest-TypeSpec/src/NoTestTypeSpec.csproj | 2 +- .../Platform-OpenAI-TypeSpec/src/OpenAI.csproj | 2 +- .../Unbranded-TypeSpec/src/UnbrandedTypeSpec.csproj | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/AutoRest.CSharp/Common/AutoRest/Plugins/NewProjectScaffolding.cs b/src/AutoRest.CSharp/Common/AutoRest/Plugins/NewProjectScaffolding.cs index 41a113b5289..1289b5f8764 100644 --- a/src/AutoRest.CSharp/Common/AutoRest/Plugins/NewProjectScaffolding.cs +++ b/src/AutoRest.CSharp/Common/AutoRest/Plugins/NewProjectScaffolding.cs @@ -343,7 +343,7 @@ private string GetUnbrandedSrcCSProj() }; private static readonly IReadOnlyList _unbrandedDependencyPackages = new CSProjWriter.CSProjDependencyPackage[] { - new("System.ClientModel", "1.1.0-beta.2"), + new("System.ClientModel", "1.1.0-beta.3"), new("System.Text.Json", "4.7.2") }; diff --git a/test/CadlRanchProjectsNonAzure/authentication/http/custom/src/Scm.Authentication.Http.Custom.csproj b/test/CadlRanchProjectsNonAzure/authentication/http/custom/src/Scm.Authentication.Http.Custom.csproj index 1b22b0edeed..fca07fc3eac 100644 --- a/test/CadlRanchProjectsNonAzure/authentication/http/custom/src/Scm.Authentication.Http.Custom.csproj +++ b/test/CadlRanchProjectsNonAzure/authentication/http/custom/src/Scm.Authentication.Http.Custom.csproj @@ -10,7 +10,7 @@ - + diff --git a/test/UnbrandedProjects/Customized-TypeSpec/src/CustomizedTypeSpec.csproj b/test/UnbrandedProjects/Customized-TypeSpec/src/CustomizedTypeSpec.csproj index b90350c0337..7e7d2cb1f1b 100644 --- a/test/UnbrandedProjects/Customized-TypeSpec/src/CustomizedTypeSpec.csproj +++ b/test/UnbrandedProjects/Customized-TypeSpec/src/CustomizedTypeSpec.csproj @@ -10,7 +10,7 @@ - + diff --git a/test/UnbrandedProjects/NoTest-TypeSpec/src/NoTestTypeSpec.csproj b/test/UnbrandedProjects/NoTest-TypeSpec/src/NoTestTypeSpec.csproj index ff07340c596..bdee88d04af 100644 --- a/test/UnbrandedProjects/NoTest-TypeSpec/src/NoTestTypeSpec.csproj +++ b/test/UnbrandedProjects/NoTest-TypeSpec/src/NoTestTypeSpec.csproj @@ -10,7 +10,7 @@ - + diff --git a/test/UnbrandedProjects/Platform-OpenAI-TypeSpec/src/OpenAI.csproj b/test/UnbrandedProjects/Platform-OpenAI-TypeSpec/src/OpenAI.csproj index 95e032e4eac..efa70082fe8 100644 --- a/test/UnbrandedProjects/Platform-OpenAI-TypeSpec/src/OpenAI.csproj +++ b/test/UnbrandedProjects/Platform-OpenAI-TypeSpec/src/OpenAI.csproj @@ -10,7 +10,7 @@ - + diff --git a/test/UnbrandedProjects/Unbranded-TypeSpec/src/UnbrandedTypeSpec.csproj b/test/UnbrandedProjects/Unbranded-TypeSpec/src/UnbrandedTypeSpec.csproj index 7a6faf4006f..691b74aad05 100644 --- a/test/UnbrandedProjects/Unbranded-TypeSpec/src/UnbrandedTypeSpec.csproj +++ b/test/UnbrandedProjects/Unbranded-TypeSpec/src/UnbrandedTypeSpec.csproj @@ -10,7 +10,7 @@ - + From 467032f6030a01d5756b3a47eb8af604122d38f7 Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Tue, 16 Apr 2024 13:30:19 +0800 Subject: [PATCH 03/19] regen --- .../src/Generated/Internal/BinaryContentHelper.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/BinaryContentHelper.cs b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/BinaryContentHelper.cs index c39f0a947e1..e698542535d 100644 --- a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/BinaryContentHelper.cs +++ b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/BinaryContentHelper.cs @@ -4,7 +4,6 @@ using System; using System.ClientModel; -using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; @@ -19,7 +18,7 @@ public static BinaryContent FromEnumerable(IEnumerable enumerable) content.JsonWriter.WriteStartArray(); foreach (var item in enumerable) { - content.JsonWriter.WriteObjectValue(item, new ModelReaderWriterOptions("W")); + content.JsonWriter.WriteObjectValue(item, ModelSerializationExtensions.WireOptions); } content.JsonWriter.WriteEndArray(); @@ -61,7 +60,7 @@ public static BinaryContent FromDictionary(IDictionary d foreach (var item in dictionary) { content.JsonWriter.WritePropertyName(item.Key); - content.JsonWriter.WriteObjectValue(item.Value, new ModelReaderWriterOptions("W")); + content.JsonWriter.WriteObjectValue(item.Value, ModelSerializationExtensions.WireOptions); } content.JsonWriter.WriteEndObject(); @@ -99,7 +98,7 @@ public static BinaryContent FromDictionary(IDictionary dicti public static BinaryContent FromObject(object value) { Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); - content.JsonWriter.WriteObjectValue(value, new ModelReaderWriterOptions("W")); + content.JsonWriter.WriteObjectValue(value, ModelSerializationExtensions.WireOptions); return content; } From 254f58ef483215df56171a7080ba0913e1d70aaa Mon Sep 17 00:00:00 2001 From: ArcturusZhang Date: Wed, 17 Apr 2024 08:59:13 +0800 Subject: [PATCH 04/19] revert the changes in test project and add cadl-ranch cases --- eng/testProjects.json | 1 + .../Properties/launchSettings.json | 4 + .../type/array/Type.Array.sln | 50 + .../type/array/src/Generated/ArrayClient.cs | 110 + .../array/src/Generated/ArrayClientOptions.cs | 13 + .../type/array/src/Generated/BooleanValue.cs | 235 ++ .../array/src/Generated/Configuration.json | 10 + .../type/array/src/Generated/DatetimeValue.cs | 235 ++ .../type/array/src/Generated/DurationValue.cs | 235 ++ .../type/array/src/Generated/Float32Value.cs | 235 ++ .../type/array/src/Generated/Int32Value.cs | 235 ++ .../type/array/src/Generated/Int64Value.cs | 235 ++ .../array/src/Generated/Internal/Argument.cs | 126 ++ .../Generated/Internal/BinaryContentHelper.cs | 2 +- .../Internal/ChangeTrackingDictionary.cs | 164 ++ .../Generated/Internal/ChangeTrackingList.cs | 150 ++ .../Internal/ClientPipelineExtensions.cs | 65 + .../Generated/Internal/ClientUriBuilder.cs | 210 ++ .../src/Generated/Internal/ErrorResult.cs | 23 + .../Internal/ModelSerializationExtensions.cs | 391 ++++ .../array/src/Generated/Internal/Optional.cs | 48 + .../Internal/Utf8JsonBinaryContent.cs | 2 +- .../type/array/src/Generated/ModelValue.cs | 236 ++ .../Models/InnerModel.Serialization.cs | 153 ++ .../array/src/Generated/Models/InnerModel.cs | 77 + .../array/src/Generated/NullableFloatValue.cs | 249 ++ .../type/array/src/Generated/StringValue.cs | 235 ++ .../type/array/src/Generated/UnknownValue.cs | 249 ++ .../array/src/Generated/tspCodeModel.json | 2015 +++++++++++++++++ .../type/array/src/Properties/AssemblyInfo.cs | 6 + .../type/array/src/Type.Array.csproj | 16 + .../type/array/tests/Type.Array.Tests.csproj | 18 + .../Unbranded-TypeSpec/Unbranded-TypeSpec.tsp | 6 - .../src/Generated/UnbrandedTypeSpecClient.cs | 101 - .../src/Generated/tspCodeModel.json | 118 +- 35 files changed, 6034 insertions(+), 224 deletions(-) create mode 100644 test/CadlRanchProjectsNonAzure/type/array/Type.Array.sln create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClient.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClientOptions.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/Configuration.json create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Argument.cs rename test/{UnbrandedProjects/Unbranded-TypeSpec => CadlRanchProjectsNonAzure/type/array}/src/Generated/Internal/BinaryContentHelper.cs (99%) create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientPipelineExtensions.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientUriBuilder.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ErrorResult.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Optional.cs rename test/{UnbrandedProjects/Unbranded-TypeSpec => CadlRanchProjectsNonAzure/type/array}/src/Generated/Internal/Utf8JsonBinaryContent.cs (98%) create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.Serialization.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Generated/tspCodeModel.json create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Properties/AssemblyInfo.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/array/src/Type.Array.csproj create mode 100644 test/CadlRanchProjectsNonAzure/type/array/tests/Type.Array.Tests.csproj diff --git a/eng/testProjects.json b/eng/testProjects.json index 5f27649944e..032e89aa23f 100644 --- a/eng/testProjects.json +++ b/eng/testProjects.json @@ -52,6 +52,7 @@ "client/structure/two-operation-group" ], "CadlRanchProjectsNonAzure":[ + "type/array", "authentication/http/custom" ], "TestServerProjects": [ diff --git a/src/AutoRest.CSharp/Properties/launchSettings.json b/src/AutoRest.CSharp/Properties/launchSettings.json index a5164b38551..1746a416015 100644 --- a/src/AutoRest.CSharp/Properties/launchSettings.json +++ b/src/AutoRest.CSharp/Properties/launchSettings.json @@ -688,6 +688,10 @@ "commandName": "Project", "commandLineArgs": "--standalone $(SolutionDir)\\test\\CadlRanchProjectsNonAzure\\authentication\\http\\custom\\src\\Generated -n" }, + "typespec-nonAzure-type/array": { + "commandName": "Project", + "commandLineArgs": "--standalone $(SolutionDir)\\test\\CadlRanchProjectsNonAzure\\type\\array\\src\\Generated -n" + }, "typespec-parameters/body-optionality": { "commandName": "Project", "commandLineArgs": "--standalone $(SolutionDir)\\test\\CadlRanchProjects\\parameters\\body-optionality\\src\\Generated -n" diff --git a/test/CadlRanchProjectsNonAzure/type/array/Type.Array.sln b/test/CadlRanchProjectsNonAzure/type/array/Type.Array.sln new file mode 100644 index 00000000000..b59246fa4f9 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/Type.Array.sln @@ -0,0 +1,50 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Type.Array", "src\Type.Array.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Type.Array.Tests", "tests\Type.Array.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClient.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClient.cs new file mode 100644 index 00000000000..1c88ba01d3f --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClient.cs @@ -0,0 +1,110 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Threading; + +namespace Type.Array +{ + // Data plane generated client. + /// The Array service client. + public partial class ArrayClient + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of ArrayClient. + public ArrayClient() : this(new Uri("http://localhost:3000"), new ArrayClientOptions()) + { + } + + /// Initializes a new instance of ArrayClient. + /// TestServer endpoint. + /// The options for configuring the client. + /// is null. + public ArrayClient(Uri endpoint, ArrayClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new ArrayClientOptions(); + + _pipeline = ClientPipeline.Create(options, System.Array.Empty(), System.Array.Empty(), System.Array.Empty()); + _endpoint = endpoint; + } + + private Int32Value _cachedInt32Value; + private Int64Value _cachedInt64Value; + private BooleanValue _cachedBooleanValue; + private StringValue _cachedStringValue; + private Float32Value _cachedFloat32Value; + private DatetimeValue _cachedDatetimeValue; + private DurationValue _cachedDurationValue; + private UnknownValue _cachedUnknownValue; + private ModelValue _cachedModelValue; + private NullableFloatValue _cachedNullableFloatValue; + + /// Initializes a new instance of Int32Value. + public virtual Int32Value GetInt32ValueClient() + { + return Volatile.Read(ref _cachedInt32Value) ?? Interlocked.CompareExchange(ref _cachedInt32Value, new Int32Value(_pipeline, _endpoint), null) ?? _cachedInt32Value; + } + + /// Initializes a new instance of Int64Value. + public virtual Int64Value GetInt64ValueClient() + { + return Volatile.Read(ref _cachedInt64Value) ?? Interlocked.CompareExchange(ref _cachedInt64Value, new Int64Value(_pipeline, _endpoint), null) ?? _cachedInt64Value; + } + + /// Initializes a new instance of BooleanValue. + public virtual BooleanValue GetBooleanValueClient() + { + return Volatile.Read(ref _cachedBooleanValue) ?? Interlocked.CompareExchange(ref _cachedBooleanValue, new BooleanValue(_pipeline, _endpoint), null) ?? _cachedBooleanValue; + } + + /// Initializes a new instance of StringValue. + public virtual StringValue GetStringValueClient() + { + return Volatile.Read(ref _cachedStringValue) ?? Interlocked.CompareExchange(ref _cachedStringValue, new StringValue(_pipeline, _endpoint), null) ?? _cachedStringValue; + } + + /// Initializes a new instance of Float32Value. + public virtual Float32Value GetFloat32ValueClient() + { + return Volatile.Read(ref _cachedFloat32Value) ?? Interlocked.CompareExchange(ref _cachedFloat32Value, new Float32Value(_pipeline, _endpoint), null) ?? _cachedFloat32Value; + } + + /// Initializes a new instance of DatetimeValue. + public virtual DatetimeValue GetDatetimeValueClient() + { + return Volatile.Read(ref _cachedDatetimeValue) ?? Interlocked.CompareExchange(ref _cachedDatetimeValue, new DatetimeValue(_pipeline, _endpoint), null) ?? _cachedDatetimeValue; + } + + /// Initializes a new instance of DurationValue. + public virtual DurationValue GetDurationValueClient() + { + return Volatile.Read(ref _cachedDurationValue) ?? Interlocked.CompareExchange(ref _cachedDurationValue, new DurationValue(_pipeline, _endpoint), null) ?? _cachedDurationValue; + } + + /// Initializes a new instance of UnknownValue. + public virtual UnknownValue GetUnknownValueClient() + { + return Volatile.Read(ref _cachedUnknownValue) ?? Interlocked.CompareExchange(ref _cachedUnknownValue, new UnknownValue(_pipeline, _endpoint), null) ?? _cachedUnknownValue; + } + + /// Initializes a new instance of ModelValue. + public virtual ModelValue GetModelValueClient() + { + return Volatile.Read(ref _cachedModelValue) ?? Interlocked.CompareExchange(ref _cachedModelValue, new ModelValue(_pipeline, _endpoint), null) ?? _cachedModelValue; + } + + /// Initializes a new instance of NullableFloatValue. + public virtual NullableFloatValue GetNullableFloatValueClient() + { + return Volatile.Read(ref _cachedNullableFloatValue) ?? Interlocked.CompareExchange(ref _cachedNullableFloatValue, new NullableFloatValue(_pipeline, _endpoint), null) ?? _cachedNullableFloatValue; + } + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClientOptions.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClientOptions.cs new file mode 100644 index 00000000000..11312b0c5ab --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClientOptions.cs @@ -0,0 +1,13 @@ +// + +#nullable disable + +using System.ClientModel.Primitives; + +namespace Type.Array +{ + /// Client options for ArrayClient. + public partial class ArrayClientOptions : ClientPipelineOptions + { + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs new file mode 100644 index 00000000000..633e6023957 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs @@ -0,0 +1,235 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; + +namespace Type.Array +{ + // Data plane generated sub-client. + /// Array of boolean values. + public partial class BooleanValue + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of BooleanValue for mocking. + protected BooleanValue() + { + } + + /// Initializes a new instance of BooleanValue. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// TestServer endpoint. + internal BooleanValue(ClientPipeline pipeline, Uri endpoint) + { + _pipeline = pipeline; + _endpoint = endpoint; + } + + public virtual async Task>> GetBooleanValueAsync() + { + ClientResult result = await GetBooleanValueAsync(null).ConfigureAwait(false); + IReadOnlyList value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, cancellationToken).ConfigureAwait(false); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(item.GetBoolean()); + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + public virtual ClientResult> GetBooleanValue() + { + ClientResult result = GetBooleanValue(null); + IReadOnlyList value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(item.GetBoolean()); + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetBooleanValueAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetBooleanValueRequest(options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetBooleanValue(RequestOptions options) + { + using PipelineMessage message = CreateGetBooleanValueRequest(options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + /// The where T is of type to use. + /// is null. + public virtual async Task PutAsync(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = await PutAsync(content, null).ConfigureAwait(false); + return result; + } + + /// The where T is of type to use. + /// is null. + public virtual ClientResult Put(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = Put(content, null); + return result; + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + internal PipelineMessage CreateGetBooleanValueRequest(RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "GET"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/array/boolean", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + if (options != null) + { + message.Apply(options); + } + return message; + } + + internal PipelineMessage CreatePutRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/array/boolean", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier _pipelineMessageClassifier204; + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Configuration.json b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Configuration.json new file mode 100644 index 00000000000..d6d1f32eba1 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Configuration.json @@ -0,0 +1,10 @@ +{ + "output-folder": ".", + "namespace": "Type.Array", + "library-name": "Type.Array", + "shared-source-folders": [ + "../../../../../../artifacts/bin/AutoRest.CSharp/Debug/net7.0/Generator.Shared", + "../../../../../../artifacts/bin/AutoRest.CSharp/Debug/net7.0/Azure.Core.Shared" + ], + "use-model-reader-writer": true +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs new file mode 100644 index 00000000000..ec501a1e742 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs @@ -0,0 +1,235 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; + +namespace Type.Array +{ + // Data plane generated sub-client. + /// Array of datetime values. + public partial class DatetimeValue + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of DatetimeValue for mocking. + protected DatetimeValue() + { + } + + /// Initializes a new instance of DatetimeValue. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// TestServer endpoint. + internal DatetimeValue(ClientPipeline pipeline, Uri endpoint) + { + _pipeline = pipeline; + _endpoint = endpoint; + } + + public virtual async Task>> GetDatetimeValueAsync() + { + ClientResult result = await GetDatetimeValueAsync(null).ConfigureAwait(false); + IReadOnlyList value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, cancellationToken).ConfigureAwait(false); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(item.GetDateTimeOffset("O")); + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + public virtual ClientResult> GetDatetimeValue() + { + ClientResult result = GetDatetimeValue(null); + IReadOnlyList value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(item.GetDateTimeOffset("O")); + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetDatetimeValueAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetDatetimeValueRequest(options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetDatetimeValue(RequestOptions options) + { + using PipelineMessage message = CreateGetDatetimeValueRequest(options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + /// The where T is of type to use. + /// is null. + public virtual async Task PutAsync(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = await PutAsync(content, null).ConfigureAwait(false); + return result; + } + + /// The where T is of type to use. + /// is null. + public virtual ClientResult Put(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = Put(content, null); + return result; + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + internal PipelineMessage CreateGetDatetimeValueRequest(RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "GET"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/array/datetime", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + if (options != null) + { + message.Apply(options); + } + return message; + } + + internal PipelineMessage CreatePutRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/array/datetime", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier _pipelineMessageClassifier204; + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs new file mode 100644 index 00000000000..22114c6507f --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs @@ -0,0 +1,235 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; + +namespace Type.Array +{ + // Data plane generated sub-client. + /// Array of duration values. + public partial class DurationValue + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of DurationValue for mocking. + protected DurationValue() + { + } + + /// Initializes a new instance of DurationValue. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// TestServer endpoint. + internal DurationValue(ClientPipeline pipeline, Uri endpoint) + { + _pipeline = pipeline; + _endpoint = endpoint; + } + + public virtual async Task>> GetDurationValueAsync() + { + ClientResult result = await GetDurationValueAsync(null).ConfigureAwait(false); + IReadOnlyList value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, cancellationToken).ConfigureAwait(false); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(item.GetTimeSpan("P")); + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + public virtual ClientResult> GetDurationValue() + { + ClientResult result = GetDurationValue(null); + IReadOnlyList value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(item.GetTimeSpan("P")); + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetDurationValueAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetDurationValueRequest(options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetDurationValue(RequestOptions options) + { + using PipelineMessage message = CreateGetDurationValueRequest(options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + /// The where T is of type to use. + /// is null. + public virtual async Task PutAsync(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = await PutAsync(content, null).ConfigureAwait(false); + return result; + } + + /// The where T is of type to use. + /// is null. + public virtual ClientResult Put(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = Put(content, null); + return result; + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + internal PipelineMessage CreateGetDurationValueRequest(RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "GET"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/array/duration", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + if (options != null) + { + message.Apply(options); + } + return message; + } + + internal PipelineMessage CreatePutRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/array/duration", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier _pipelineMessageClassifier204; + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs new file mode 100644 index 00000000000..7df1f44a855 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs @@ -0,0 +1,235 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; + +namespace Type.Array +{ + // Data plane generated sub-client. + /// Array of float values. + public partial class Float32Value + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of Float32Value for mocking. + protected Float32Value() + { + } + + /// Initializes a new instance of Float32Value. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// TestServer endpoint. + internal Float32Value(ClientPipeline pipeline, Uri endpoint) + { + _pipeline = pipeline; + _endpoint = endpoint; + } + + public virtual async Task>> GetFloat32ValueAsync() + { + ClientResult result = await GetFloat32ValueAsync(null).ConfigureAwait(false); + IReadOnlyList value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, cancellationToken).ConfigureAwait(false); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(item.GetSingle()); + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + public virtual ClientResult> GetFloat32Value() + { + ClientResult result = GetFloat32Value(null); + IReadOnlyList value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(item.GetSingle()); + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetFloat32ValueAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetFloat32ValueRequest(options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetFloat32Value(RequestOptions options) + { + using PipelineMessage message = CreateGetFloat32ValueRequest(options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + /// The where T is of type to use. + /// is null. + public virtual async Task PutAsync(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = await PutAsync(content, null).ConfigureAwait(false); + return result; + } + + /// The where T is of type to use. + /// is null. + public virtual ClientResult Put(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = Put(content, null); + return result; + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + internal PipelineMessage CreateGetFloat32ValueRequest(RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "GET"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/array/float32", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + if (options != null) + { + message.Apply(options); + } + return message; + } + + internal PipelineMessage CreatePutRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/array/float32", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier _pipelineMessageClassifier204; + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs new file mode 100644 index 00000000000..d4feb0b39a2 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs @@ -0,0 +1,235 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; + +namespace Type.Array +{ + // Data plane generated sub-client. + /// Array of int32 values. + public partial class Int32Value + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of Int32Value for mocking. + protected Int32Value() + { + } + + /// Initializes a new instance of Int32Value. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// TestServer endpoint. + internal Int32Value(ClientPipeline pipeline, Uri endpoint) + { + _pipeline = pipeline; + _endpoint = endpoint; + } + + public virtual async Task>> GetInt32ValueAsync() + { + ClientResult result = await GetInt32ValueAsync(null).ConfigureAwait(false); + IReadOnlyList value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, cancellationToken).ConfigureAwait(false); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(item.GetInt32()); + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + public virtual ClientResult> GetInt32Value() + { + ClientResult result = GetInt32Value(null); + IReadOnlyList value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(item.GetInt32()); + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetInt32ValueAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetInt32ValueRequest(options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetInt32Value(RequestOptions options) + { + using PipelineMessage message = CreateGetInt32ValueRequest(options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + /// The where T is of type to use. + /// is null. + public virtual async Task PutAsync(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = await PutAsync(content, null).ConfigureAwait(false); + return result; + } + + /// The where T is of type to use. + /// is null. + public virtual ClientResult Put(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = Put(content, null); + return result; + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + internal PipelineMessage CreateGetInt32ValueRequest(RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "GET"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/array/int32", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + if (options != null) + { + message.Apply(options); + } + return message; + } + + internal PipelineMessage CreatePutRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/array/int32", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier _pipelineMessageClassifier204; + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs new file mode 100644 index 00000000000..c5e7054c933 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs @@ -0,0 +1,235 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; + +namespace Type.Array +{ + // Data plane generated sub-client. + /// Array of int64 values. + public partial class Int64Value + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of Int64Value for mocking. + protected Int64Value() + { + } + + /// Initializes a new instance of Int64Value. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// TestServer endpoint. + internal Int64Value(ClientPipeline pipeline, Uri endpoint) + { + _pipeline = pipeline; + _endpoint = endpoint; + } + + public virtual async Task>> GetInt64ValueAsync() + { + ClientResult result = await GetInt64ValueAsync(null).ConfigureAwait(false); + IReadOnlyList value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, cancellationToken).ConfigureAwait(false); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(item.GetInt64()); + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + public virtual ClientResult> GetInt64Value() + { + ClientResult result = GetInt64Value(null); + IReadOnlyList value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(item.GetInt64()); + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetInt64ValueAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetInt64ValueRequest(options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetInt64Value(RequestOptions options) + { + using PipelineMessage message = CreateGetInt64ValueRequest(options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + /// The where T is of type to use. + /// is null. + public virtual async Task PutAsync(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = await PutAsync(content, null).ConfigureAwait(false); + return result; + } + + /// The where T is of type to use. + /// is null. + public virtual ClientResult Put(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = Put(content, null); + return result; + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + internal PipelineMessage CreateGetInt64ValueRequest(RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "GET"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/array/int64", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + if (options != null) + { + message.Apply(options); + } + return message; + } + + internal PipelineMessage CreatePutRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/array/int64", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier _pipelineMessageClassifier204; + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Argument.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Argument.cs new file mode 100644 index 00000000000..ccba4adeabf --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Argument.cs @@ -0,0 +1,126 @@ +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Type.Array +{ + internal static class Argument + { + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNullOrEmpty(IEnumerable value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value is ICollection collectionOfT && collectionOfT.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + if (value is ICollection collection && collection.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + using IEnumerator e = value.GetEnumerator(); + if (!e.MoveNext()) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + } + + public static void AssertNotNullOrEmpty(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value.Length == 0) + { + throw new ArgumentException("Value cannot be an empty string.", name); + } + } + + public static void AssertNotNullOrWhiteSpace(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); + } + } + + public static void AssertNotDefault(ref T value, string name) + where T : struct, IEquatable + { + if (value.Equals(default)) + { + throw new ArgumentException("Value cannot be empty.", name); + } + } + + public static void AssertInRange(T value, T minimum, T maximum, string name) + where T : notnull, IComparable + { + if (minimum.CompareTo(value) > 0) + { + throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); + } + if (maximum.CompareTo(value) < 0) + { + throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); + } + } + + public static void AssertEnumDefined(System.Type enumType, object value, string name) + { + if (!Enum.IsDefined(enumType, value)) + { + throw new ArgumentException($"Value not defined for {enumType.FullName}.", name); + } + } + + public static T CheckNotNull(T value, string name) + where T : class + { + AssertNotNull(value, name); + return value; + } + + public static string CheckNotNullOrEmpty(string value, string name) + { + AssertNotNullOrEmpty(value, name); + return value; + } + + public static void AssertNull(T value, string name, string message = null) + { + if (value != null) + { + throw new ArgumentException(message ?? "Value must be null.", name); + } + } + } +} diff --git a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/BinaryContentHelper.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/BinaryContentHelper.cs similarity index 99% rename from test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/BinaryContentHelper.cs rename to test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/BinaryContentHelper.cs index e698542535d..bf57eac5fad 100644 --- a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/BinaryContentHelper.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/BinaryContentHelper.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; using System.Text.Json; -namespace UnbrandedTypeSpec +namespace Type.Array { internal static class BinaryContentHelper { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingDictionary.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 00000000000..7c003bc7e4d --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -0,0 +1,164 @@ +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Type.Array +{ + internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + { + private IDictionary _innerDictionary; + + public ChangeTrackingDictionary() + { + } + + public ChangeTrackingDictionary(IDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(dictionary); + } + + public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(); + foreach (var pair in dictionary) + { + _innerDictionary.Add(pair); + } + } + + public bool IsUndefined => _innerDictionary == null; + + public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + + public ICollection Keys => IsUndefined ? System.Array.Empty() : EnsureDictionary().Keys; + + public ICollection Values => IsUndefined ? System.Array.Empty() : EnsureDictionary().Values; + + public TValue this[TKey key] + { + get + { + if (IsUndefined) + { + throw new KeyNotFoundException(nameof(key)); + } + return EnsureDictionary()[key]; + } + set + { + EnsureDictionary()[key] = value; + } + } + + IEnumerable IReadOnlyDictionary.Keys => Keys; + + IEnumerable IReadOnlyDictionary.Values => Values; + + public IEnumerator> GetEnumerator() + { + if (IsUndefined) + { + IEnumerator> enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureDictionary().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(KeyValuePair item) + { + EnsureDictionary().Add(item); + } + + public void Clear() + { + EnsureDictionary().Clear(); + } + + public bool Contains(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int index) + { + if (IsUndefined) + { + return; + } + EnsureDictionary().CopyTo(array, index); + } + + public bool Remove(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(item); + } + + public void Add(TKey key, TValue value) + { + EnsureDictionary().Add(key, value); + } + + public bool ContainsKey(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().ContainsKey(key); + } + + public bool Remove(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(key); + } + + public bool TryGetValue(TKey key, out TValue value) + { + if (IsUndefined) + { + value = default; + return false; + } + return EnsureDictionary().TryGetValue(key, out value); + } + + public IDictionary EnsureDictionary() + { + return _innerDictionary ??= new Dictionary(); + } + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingList.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 00000000000..2045e8f9f17 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingList.cs @@ -0,0 +1,150 @@ +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Type.Array +{ + internal class ChangeTrackingList : IList, IReadOnlyList + { + private IList _innerList; + + public ChangeTrackingList() + { + } + + public ChangeTrackingList(IList innerList) + { + if (innerList != null) + { + _innerList = innerList; + } + } + + public ChangeTrackingList(IReadOnlyList innerList) + { + if (innerList != null) + { + _innerList = innerList.ToList(); + } + } + + public bool IsUndefined => _innerList == null; + + public int Count => IsUndefined ? 0 : EnsureList().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + + public T this[int index] + { + get + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + return EnsureList()[index]; + } + set + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList()[index] = value; + } + } + + public void Reset() + { + _innerList = null; + } + + public IEnumerator GetEnumerator() + { + if (IsUndefined) + { + IEnumerator enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureList().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(T item) + { + EnsureList().Add(item); + } + + public void Clear() + { + EnsureList().Clear(); + } + + public bool Contains(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + if (IsUndefined) + { + return; + } + EnsureList().CopyTo(array, arrayIndex); + } + + public bool Remove(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Remove(item); + } + + public int IndexOf(T item) + { + if (IsUndefined) + { + return -1; + } + return EnsureList().IndexOf(item); + } + + public void Insert(int index, T item) + { + EnsureList().Insert(index, item); + } + + public void RemoveAt(int index) + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList().RemoveAt(index); + } + + public IList EnsureList() + { + return _innerList ??= new List(); + } + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientPipelineExtensions.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientPipelineExtensions.cs new file mode 100644 index 00000000000..42cfbaf9a5b --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientPipelineExtensions.cs @@ -0,0 +1,65 @@ +// + +#nullable disable + +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Threading.Tasks; + +namespace Type.Array +{ + internal static class ClientPipelineExtensions + { + public static async ValueTask ProcessMessageAsync(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) + { + await pipeline.SendAsync(message).ConfigureAwait(false); + + if (message.Response.IsError && (options?.ErrorOptions & ClientErrorBehaviors.NoThrow) != ClientErrorBehaviors.NoThrow) + { + throw await ClientResultException.CreateAsync(message.Response).ConfigureAwait(false); + } + + return message.Response; + } + + public static PipelineResponse ProcessMessage(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) + { + pipeline.Send(message); + + if (message.Response.IsError && (options?.ErrorOptions & ClientErrorBehaviors.NoThrow) != ClientErrorBehaviors.NoThrow) + { + throw new ClientResultException(message.Response); + } + + return message.Response; + } + + public static async ValueTask> ProcessHeadAsBoolMessageAsync(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) + { + PipelineResponse response = await pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false); + switch (response.Status) + { + case >= 200 and < 300: + return ClientResult.FromValue(true, response); + case >= 400 and < 500: + return ClientResult.FromValue(false, response); + default: + return new ErrorResult(response, new ClientResultException(response)); + } + } + + public static ClientResult ProcessHeadAsBoolMessage(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) + { + PipelineResponse response = pipeline.ProcessMessage(message, options); + switch (response.Status) + { + case >= 200 and < 300: + return ClientResult.FromValue(true, response); + case >= 400 and < 500: + return ClientResult.FromValue(false, response); + default: + return new ErrorResult(response, new ClientResultException(response)); + } + } + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientUriBuilder.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientUriBuilder.cs new file mode 100644 index 00000000000..9c12a8b3352 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientUriBuilder.cs @@ -0,0 +1,210 @@ +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Type.Array +{ + internal class ClientUriBuilder + { + private UriBuilder _uriBuilder; + private StringBuilder _pathBuilder; + private StringBuilder _queryBuilder; + private const char PathSeparator = '/'; + + public ClientUriBuilder() + { + } + + private UriBuilder UriBuilder => _uriBuilder ??= new UriBuilder(); + + private StringBuilder PathBuilder => _pathBuilder ??= new StringBuilder(UriBuilder.Path); + + private StringBuilder QueryBuilder => _queryBuilder ??= new StringBuilder(UriBuilder.Query); + + public void Reset(Uri uri) + { + _uriBuilder = new UriBuilder(uri); + _pathBuilder = new StringBuilder(UriBuilder.Path); + _queryBuilder = new StringBuilder(UriBuilder.Query); + } + + public void AppendPath(string value, bool escape) + { + Argument.AssertNotNullOrWhiteSpace(value, nameof(value)); + + if (escape) + { + value = Uri.EscapeDataString(value); + } + + if (value[0] == PathSeparator) + { + value = value.Substring(1); + } + + PathBuilder.Append(value); + UriBuilder.Path = PathBuilder.ToString(); + } + + public void AppendPath(bool value, bool escape = false) + { + AppendPath(ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendPath(float value, bool escape = true) + { + AppendPath(ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendPath(double value, bool escape = true) + { + AppendPath(ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendPath(int value, bool escape = true) + { + AppendPath(ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendPath(byte[] value, string format, bool escape = true) + { + AppendPath(ModelSerializationExtensions.TypeFormatters.ConvertToString(value, format), escape); + } + + public void AppendPath(IEnumerable value, bool escape = true) + { + AppendPath(ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendPath(DateTimeOffset value, string format, bool escape = true) + { + AppendPath(ModelSerializationExtensions.TypeFormatters.ConvertToString(value, format), escape); + } + + public void AppendPath(TimeSpan value, string format, bool escape = true) + { + AppendPath(ModelSerializationExtensions.TypeFormatters.ConvertToString(value, format), escape); + } + + public void AppendPath(Guid value, bool escape = true) + { + AppendPath(ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendPath(long value, bool escape = true) + { + AppendPath(ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendQuery(string name, string value, bool escape) + { + Argument.AssertNotNullOrWhiteSpace(name, nameof(name)); + Argument.AssertNotNullOrWhiteSpace(value, nameof(value)); + + if (QueryBuilder.Length == 0) + { + QueryBuilder.Append('?'); + } + else + { + QueryBuilder.Append('&'); + } + + if (escape) + { + value = Uri.EscapeDataString(value); + } + + QueryBuilder.Append(name); + QueryBuilder.Append('='); + QueryBuilder.Append(value); + } + + public void AppendQuery(string name, bool value, bool escape = false) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendQuery(string name, float value, bool escape = true) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendQuery(string name, DateTimeOffset value, string format, bool escape = true) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value, format), escape); + } + + public void AppendQuery(string name, TimeSpan value, string format, bool escape = true) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value, format), escape); + } + + public void AppendQuery(string name, double value, bool escape = true) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendQuery(string name, decimal value, bool escape = true) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendQuery(string name, int value, bool escape = true) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendQuery(string name, long value, bool escape = true) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendQuery(string name, TimeSpan value, bool escape = true) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendQuery(string name, byte[] value, string format, bool escape = true) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value, format), escape); + } + + public void AppendQuery(string name, Guid value, bool escape = true) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendQueryDelimited(string name, IEnumerable value, string delimiter, bool escape = true) + { + var stringValues = value.Select(v => ModelSerializationExtensions.TypeFormatters.ConvertToString(v)); + AppendQuery(name, string.Join(delimiter, stringValues), escape); + } + + public void AppendQueryDelimited(string name, IEnumerable value, string delimiter, string format, bool escape = true) + { + var stringValues = value.Select(v => ModelSerializationExtensions.TypeFormatters.ConvertToString(v, format)); + AppendQuery(name, string.Join(delimiter, stringValues), escape); + } + + public Uri ToUri() + { + if (_pathBuilder != null) + { + UriBuilder.Path = _pathBuilder.ToString(); + } + + if (_queryBuilder != null) + { + UriBuilder.Query = _queryBuilder.ToString(); + } + + return UriBuilder.Uri; + } + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ErrorResult.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ErrorResult.cs new file mode 100644 index 00000000000..453aaea6241 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ErrorResult.cs @@ -0,0 +1,23 @@ +// + +#nullable disable + +using System.ClientModel; +using System.ClientModel.Primitives; + +namespace Type.Array +{ + internal class ErrorResult : ClientResult + { + private readonly PipelineResponse _response; + private readonly ClientResultException _exception; + + public ErrorResult(PipelineResponse response, ClientResultException exception) : base(default, response) + { + _response = response; + _exception = exception; + } + + public override T Value => throw _exception; + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ModelSerializationExtensions.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 00000000000..6a5bd7876b2 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,391 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Text.Json; +using System.Xml; + +namespace Type.Array +{ + internal static class ModelSerializationExtensions + { + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + + public static object GetObject(this JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.String: + return element.GetString(); + case JsonValueKind.Number: + if (element.TryGetInt32(out int intValue)) + { + return intValue; + } + if (element.TryGetInt64(out long longValue)) + { + return longValue; + } + return element.GetDouble(); + case JsonValueKind.True: + return true; + case JsonValueKind.False: + return false; + case JsonValueKind.Undefined: + case JsonValueKind.Null: + return null; + case JsonValueKind.Object: + var dictionary = new Dictionary(); + foreach (var jsonProperty in element.EnumerateObject()) + { + dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); + } + return dictionary; + case JsonValueKind.Array: + var list = new List(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + var text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + { + throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + } + + public static string GetRequiredString(this JsonElement element) + { + var value = element.GetString(); + if (value == null) + { + throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + 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 Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + + internal static class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Generated clients require it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; + int size = checked(numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ConvertToString(object value, string format = null) => value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when format != null => ToString(b0, format), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when format != null => ToString(dateTime, format), + TimeSpan timeSpan when format != null => ToString(timeSpan, format), + TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Optional.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Optional.cs new file mode 100644 index 00000000000..583e221ce5d --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Optional.cs @@ -0,0 +1,48 @@ +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Type.Array +{ + internal static class Optional + { + public static bool IsCollectionDefined(IEnumerable collection) + { + return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); + } + + public static bool IsCollectionDefined(IDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsCollectionDefined(IReadOnlyDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsDefined(T? value) + where T : struct + { + return value.HasValue; + } + + public static bool IsDefined(object value) + { + return value != null; + } + + public static bool IsDefined(JsonElement value) + { + return value.ValueKind != JsonValueKind.Undefined; + } + + public static bool IsDefined(string value) + { + return value != null; + } + } +} diff --git a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/Utf8JsonBinaryContent.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Utf8JsonBinaryContent.cs similarity index 98% rename from test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/Utf8JsonBinaryContent.cs rename to test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Utf8JsonBinaryContent.cs index ea26d5655b9..fc0fbdb9f2e 100644 --- a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/Utf8JsonBinaryContent.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Utf8JsonBinaryContent.cs @@ -8,7 +8,7 @@ using System.Threading; using System.Threading.Tasks; -namespace UnbrandedTypeSpec +namespace Type.Array { internal class Utf8JsonBinaryContent : BinaryContent { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs new file mode 100644 index 00000000000..63e88af5bdb --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs @@ -0,0 +1,236 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; +using Type.Array.Models; + +namespace Type.Array +{ + // Data plane generated sub-client. + /// Array of model values. + public partial class ModelValue + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of ModelValue for mocking. + protected ModelValue() + { + } + + /// Initializes a new instance of ModelValue. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// TestServer endpoint. + internal ModelValue(ClientPipeline pipeline, Uri endpoint) + { + _pipeline = pipeline; + _endpoint = endpoint; + } + + public virtual async Task>> GetModelValueAsync() + { + ClientResult result = await GetModelValueAsync(null).ConfigureAwait(false); + IReadOnlyList value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, cancellationToken).ConfigureAwait(false); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(InnerModel.DeserializeInnerModel(item)); + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + public virtual ClientResult> GetModelValue() + { + ClientResult result = GetModelValue(null); + IReadOnlyList value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(InnerModel.DeserializeInnerModel(item)); + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetModelValueAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetModelValueRequest(options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetModelValue(RequestOptions options) + { + using PipelineMessage message = CreateGetModelValueRequest(options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + /// The where T is of type to use. + /// is null. + public virtual async Task PutAsync(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = await PutAsync(content, null).ConfigureAwait(false); + return result; + } + + /// The where T is of type to use. + /// is null. + public virtual ClientResult Put(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = Put(content, null); + return result; + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + internal PipelineMessage CreateGetModelValueRequest(RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "GET"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/array/model", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + if (options != null) + { + message.Apply(options); + } + return message; + } + + internal PipelineMessage CreatePutRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/array/model", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier _pipelineMessageClassifier204; + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.Serialization.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.Serialization.cs new file mode 100644 index 00000000000..e65045f5523 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.Serialization.cs @@ -0,0 +1,153 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; + +namespace Type.Array.Models +{ + public partial class InnerModel : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InnerModel)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("property"u8); + writer.WriteStringValue(Property); + if (Optional.IsCollectionDefined(Children)) + { + writer.WritePropertyName("children"u8); + writer.WriteStartArray(); + foreach (var item in Children) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + InnerModel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InnerModel)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInnerModel(document.RootElement, options); + } + + internal static InnerModel DeserializeInnerModel(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string property = default; + IList children = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property0 in element.EnumerateObject()) + { + if (property0.NameEquals("property"u8)) + { + property = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("children"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(DeserializeInnerModel(item, options)); + } + children = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InnerModel(property, children ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InnerModel)} does not support writing '{options.Format}' format."); + } + } + + InnerModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInnerModel(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InnerModel)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The result to deserialize the model from. + internal static InnerModel FromResponse(PipelineResponse response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeInnerModel(document.RootElement); + } + + /// Convert into a . + internal virtual BinaryContent ToBinaryContent() + { + return BinaryContent.Create(this, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.cs new file mode 100644 index 00000000000..7d1a9f822ef --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.cs @@ -0,0 +1,77 @@ +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Type.Array.Models +{ + /// Array inner model. + public partial class InnerModel + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Required string property. + /// is null. + public InnerModel(string property) + { + Argument.AssertNotNull(property, nameof(property)); + + Property = property; + Children = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Required string property. + /// + /// Keeps track of any properties unknown to the library. + internal InnerModel(string property, IList children, IDictionary serializedAdditionalRawData) + { + Property = property; + Children = children; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InnerModel() + { + } + + /// Required string property. + public string Property { get; set; } + /// Gets the children. + public IList Children { get; } + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs new file mode 100644 index 00000000000..002a6eacd95 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs @@ -0,0 +1,249 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; + +namespace Type.Array +{ + // Data plane generated sub-client. + /// Array of nullable float values. + public partial class NullableFloatValue + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of NullableFloatValue for mocking. + protected NullableFloatValue() + { + } + + /// Initializes a new instance of NullableFloatValue. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// TestServer endpoint. + internal NullableFloatValue(ClientPipeline pipeline, Uri endpoint) + { + _pipeline = pipeline; + _endpoint = endpoint; + } + + public virtual async Task>> GetNullableFloatValueAsync() + { + ClientResult result = await GetNullableFloatValueAsync(null).ConfigureAwait(false); + IReadOnlyList value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, cancellationToken).ConfigureAwait(false); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetSingle()); + } + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + public virtual ClientResult> GetNullableFloatValue() + { + ClientResult result = GetNullableFloatValue(null); + IReadOnlyList value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetSingle()); + } + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetNullableFloatValueAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetNullableFloatValueRequest(options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetNullableFloatValue(RequestOptions options) + { + using PipelineMessage message = CreateGetNullableFloatValueRequest(options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + /// The where T is of type ? to use. + /// is null. + public virtual async Task PutAsync(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = await PutAsync(content, null).ConfigureAwait(false); + return result; + } + + /// The where T is of type ? to use. + /// is null. + public virtual ClientResult Put(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = Put(content, null); + return result; + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + internal PipelineMessage CreateGetNullableFloatValueRequest(RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "GET"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/array/nullable-float", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + if (options != null) + { + message.Apply(options); + } + return message; + } + + internal PipelineMessage CreatePutRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/array/nullable-float", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier _pipelineMessageClassifier204; + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs new file mode 100644 index 00000000000..5630aa32658 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs @@ -0,0 +1,235 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; + +namespace Type.Array +{ + // Data plane generated sub-client. + /// Array of string values. + public partial class StringValue + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of StringValue for mocking. + protected StringValue() + { + } + + /// Initializes a new instance of StringValue. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// TestServer endpoint. + internal StringValue(ClientPipeline pipeline, Uri endpoint) + { + _pipeline = pipeline; + _endpoint = endpoint; + } + + public virtual async Task>> GetStringValueAsync() + { + ClientResult result = await GetStringValueAsync(null).ConfigureAwait(false); + IReadOnlyList value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, cancellationToken).ConfigureAwait(false); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(item.GetString()); + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + public virtual ClientResult> GetStringValue() + { + ClientResult result = GetStringValue(null); + IReadOnlyList value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(item.GetString()); + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetStringValueAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetStringValueRequest(options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetStringValue(RequestOptions options) + { + using PipelineMessage message = CreateGetStringValueRequest(options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + /// The where T is of type to use. + /// is null. + public virtual async Task PutAsync(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = await PutAsync(content, null).ConfigureAwait(false); + return result; + } + + /// The where T is of type to use. + /// is null. + public virtual ClientResult Put(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = Put(content, null); + return result; + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + internal PipelineMessage CreateGetStringValueRequest(RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "GET"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/array/string", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + if (options != null) + { + message.Apply(options); + } + return message; + } + + internal PipelineMessage CreatePutRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/array/string", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier _pipelineMessageClassifier204; + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs new file mode 100644 index 00000000000..d7f5845bd3f --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs @@ -0,0 +1,249 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; + +namespace Type.Array +{ + // Data plane generated sub-client. + /// Array of unknown values. + public partial class UnknownValue + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of UnknownValue for mocking. + protected UnknownValue() + { + } + + /// Initializes a new instance of UnknownValue. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// TestServer endpoint. + internal UnknownValue(ClientPipeline pipeline, Uri endpoint) + { + _pipeline = pipeline; + _endpoint = endpoint; + } + + public virtual async Task>> GetUnknownValueAsync() + { + ClientResult result = await GetUnknownValueAsync(null).ConfigureAwait(false); + IReadOnlyList value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, cancellationToken).ConfigureAwait(false); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(BinaryData.FromString(item.GetRawText())); + } + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + public virtual ClientResult> GetUnknownValue() + { + ClientResult result = GetUnknownValue(null); + IReadOnlyList value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(BinaryData.FromString(item.GetRawText())); + } + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetUnknownValueAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetUnknownValueRequest(options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetUnknownValue(RequestOptions options) + { + using PipelineMessage message = CreateGetUnknownValueRequest(options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + /// The where T is of type to use. + /// is null. + public virtual async Task PutAsync(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = await PutAsync(content, null).ConfigureAwait(false); + return result; + } + + /// The where T is of type to use. + /// is null. + public virtual ClientResult Put(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = Put(content, null); + return result; + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + internal PipelineMessage CreateGetUnknownValueRequest(RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "GET"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/array/unknown", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + if (options != null) + { + message.Apply(options); + } + return message; + } + + internal PipelineMessage CreatePutRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/array/unknown", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier _pipelineMessageClassifier204; + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/tspCodeModel.json b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/tspCodeModel.json new file mode 100644 index 00000000000..eb4357e2427 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/tspCodeModel.json @@ -0,0 +1,2015 @@ +{ + "$id": "1", + "Name": "Type.Array", + "Description": "Illustrates various types of arrays.", + "ApiVersions": [], + "Enums": [], + "Models": [ + { + "$id": "2", + "Kind": "Model", + "Name": "InnerModel", + "Namespace": "Type.Array", + "Description": "Array inner model", + "IsNullable": false, + "Usage": "RoundTrip", + "Properties": [ + { + "$id": "3", + "Name": "property", + "SerializedName": "property", + "Description": "Required string property", + "Type": { + "$id": "4", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "5", + "Name": "children", + "SerializedName": "children", + "Description": "", + "Type": { + "$id": "6", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$ref": "2" + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + } + ], + "Clients": [ + { + "$id": "7", + "Name": "ArrayClient", + "Description": "", + "Operations": [], + "Protocol": { + "$id": "8" + }, + "Creatable": true + }, + { + "$id": "9", + "Name": "Int32Value", + "Description": "Array of int32 values", + "Operations": [ + { + "$id": "10", + "Name": "get", + "ResourceName": "Int32Value", + "Parameters": [ + { + "$id": "11", + "Name": "host", + "NameInRequest": "host", + "Description": "TestServer endpoint", + "Type": { + "$id": "12", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Uri", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": true, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Client", + "DefaultValue": { + "$id": "13", + "Type": { + "$id": "14", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Value": "http://localhost:3000" + } + }, + { + "$id": "15", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "16", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "17", + "Type": { + "$ref": "16" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "18", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "19", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$id": "20", + "Kind": "Primitive", + "Name": "Int32", + "IsNullable": false + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/type/array/int32", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "21", + "Name": "put", + "ResourceName": "Int32Value", + "Parameters": [ + { + "$ref": "11" + }, + { + "$id": "22", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "23", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$id": "24", + "Kind": "Primitive", + "Name": "Int32", + "IsNullable": false + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "25", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "26", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "27", + "Type": { + "$ref": "26" + }, + "Value": "application/json" + } + }, + { + "$id": "28", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "29", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "30", + "Type": { + "$ref": "29" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "31", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/type/array/int32", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "32" + }, + "Creatable": false, + "Parent": "ArrayClient" + }, + { + "$id": "33", + "Name": "Int64Value", + "Description": "Array of int64 values", + "Operations": [ + { + "$id": "34", + "Name": "get", + "ResourceName": "Int64Value", + "Parameters": [ + { + "$ref": "11" + }, + { + "$id": "35", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "36", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "37", + "Type": { + "$ref": "36" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "38", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "39", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$id": "40", + "Kind": "Primitive", + "Name": "Int64", + "IsNullable": false + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/type/array/int64", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "41", + "Name": "put", + "ResourceName": "Int64Value", + "Parameters": [ + { + "$ref": "11" + }, + { + "$id": "42", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "43", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$id": "44", + "Kind": "Primitive", + "Name": "Int64", + "IsNullable": false + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "45", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "46", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "47", + "Type": { + "$ref": "46" + }, + "Value": "application/json" + } + }, + { + "$id": "48", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "49", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "50", + "Type": { + "$ref": "49" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "51", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/type/array/int64", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "52" + }, + "Creatable": false, + "Parent": "ArrayClient" + }, + { + "$id": "53", + "Name": "BooleanValue", + "Description": "Array of boolean values", + "Operations": [ + { + "$id": "54", + "Name": "get", + "ResourceName": "BooleanValue", + "Parameters": [ + { + "$ref": "11" + }, + { + "$id": "55", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "56", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "57", + "Type": { + "$ref": "56" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "58", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "59", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$id": "60", + "Kind": "Primitive", + "Name": "Boolean", + "IsNullable": false + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/type/array/boolean", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "61", + "Name": "put", + "ResourceName": "BooleanValue", + "Parameters": [ + { + "$ref": "11" + }, + { + "$id": "62", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "63", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$id": "64", + "Kind": "Primitive", + "Name": "Boolean", + "IsNullable": false + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "65", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "66", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "67", + "Type": { + "$ref": "66" + }, + "Value": "application/json" + } + }, + { + "$id": "68", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "69", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "70", + "Type": { + "$ref": "69" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "71", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/type/array/boolean", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "72" + }, + "Creatable": false, + "Parent": "ArrayClient" + }, + { + "$id": "73", + "Name": "StringValue", + "Description": "Array of string values", + "Operations": [ + { + "$id": "74", + "Name": "get", + "ResourceName": "StringValue", + "Parameters": [ + { + "$ref": "11" + }, + { + "$id": "75", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "76", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "77", + "Type": { + "$ref": "76" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "78", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "79", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$id": "80", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/type/array/string", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "81", + "Name": "put", + "ResourceName": "StringValue", + "Parameters": [ + { + "$ref": "11" + }, + { + "$id": "82", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "83", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$id": "84", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "85", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "86", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "87", + "Type": { + "$ref": "86" + }, + "Value": "application/json" + } + }, + { + "$id": "88", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "89", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "90", + "Type": { + "$ref": "89" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "91", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/type/array/string", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "92" + }, + "Creatable": false, + "Parent": "ArrayClient" + }, + { + "$id": "93", + "Name": "Float32Value", + "Description": "Array of float values", + "Operations": [ + { + "$id": "94", + "Name": "get", + "ResourceName": "Float32Value", + "Parameters": [ + { + "$ref": "11" + }, + { + "$id": "95", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "96", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "97", + "Type": { + "$ref": "96" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "98", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "99", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$id": "100", + "Kind": "Primitive", + "Name": "Float32", + "IsNullable": false + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/type/array/float32", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "101", + "Name": "put", + "ResourceName": "Float32Value", + "Parameters": [ + { + "$ref": "11" + }, + { + "$id": "102", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "103", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$id": "104", + "Kind": "Primitive", + "Name": "Float32", + "IsNullable": false + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "105", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "106", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "107", + "Type": { + "$ref": "106" + }, + "Value": "application/json" + } + }, + { + "$id": "108", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "109", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "110", + "Type": { + "$ref": "109" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "111", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/type/array/float32", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "112" + }, + "Creatable": false, + "Parent": "ArrayClient" + }, + { + "$id": "113", + "Name": "DatetimeValue", + "Description": "Array of datetime values", + "Operations": [ + { + "$id": "114", + "Name": "get", + "ResourceName": "DatetimeValue", + "Parameters": [ + { + "$ref": "11" + }, + { + "$id": "115", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "116", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "117", + "Type": { + "$ref": "116" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "118", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "119", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$id": "120", + "Kind": "Primitive", + "Name": "DateTime", + "IsNullable": false + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/type/array/datetime", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "121", + "Name": "put", + "ResourceName": "DatetimeValue", + "Parameters": [ + { + "$ref": "11" + }, + { + "$id": "122", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "123", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$id": "124", + "Kind": "Primitive", + "Name": "DateTime", + "IsNullable": false + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "125", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "126", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "127", + "Type": { + "$ref": "126" + }, + "Value": "application/json" + } + }, + { + "$id": "128", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "129", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "130", + "Type": { + "$ref": "129" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "131", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/type/array/datetime", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "132" + }, + "Creatable": false, + "Parent": "ArrayClient" + }, + { + "$id": "133", + "Name": "DurationValue", + "Description": "Array of duration values", + "Operations": [ + { + "$id": "134", + "Name": "get", + "ResourceName": "DurationValue", + "Parameters": [ + { + "$ref": "11" + }, + { + "$id": "135", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "136", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "137", + "Type": { + "$ref": "136" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "138", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "139", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$id": "140", + "Kind": "Primitive", + "Name": "DurationISO8601", + "IsNullable": false + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/type/array/duration", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "141", + "Name": "put", + "ResourceName": "DurationValue", + "Parameters": [ + { + "$ref": "11" + }, + { + "$id": "142", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "143", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$id": "144", + "Kind": "Primitive", + "Name": "DurationISO8601", + "IsNullable": false + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "145", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "146", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "147", + "Type": { + "$ref": "146" + }, + "Value": "application/json" + } + }, + { + "$id": "148", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "149", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "150", + "Type": { + "$ref": "149" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "151", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/type/array/duration", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "152" + }, + "Creatable": false, + "Parent": "ArrayClient" + }, + { + "$id": "153", + "Name": "UnknownValue", + "Description": "Array of unknown values", + "Operations": [ + { + "$id": "154", + "Name": "get", + "ResourceName": "UnknownValue", + "Parameters": [ + { + "$ref": "11" + }, + { + "$id": "155", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "156", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "157", + "Type": { + "$ref": "156" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "158", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "159", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$id": "160", + "Kind": "Intrinsic", + "Name": "unknown", + "IsNullable": false + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/type/array/unknown", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "161", + "Name": "put", + "ResourceName": "UnknownValue", + "Parameters": [ + { + "$ref": "11" + }, + { + "$id": "162", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "163", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$id": "164", + "Kind": "Intrinsic", + "Name": "unknown", + "IsNullable": false + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "165", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "166", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "167", + "Type": { + "$ref": "166" + }, + "Value": "application/json" + } + }, + { + "$id": "168", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "169", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "170", + "Type": { + "$ref": "169" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "171", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/type/array/unknown", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "172" + }, + "Creatable": false, + "Parent": "ArrayClient" + }, + { + "$id": "173", + "Name": "ModelValue", + "Description": "Array of model values", + "Operations": [ + { + "$id": "174", + "Name": "get", + "ResourceName": "ModelValue", + "Parameters": [ + { + "$ref": "11" + }, + { + "$id": "175", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "176", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "177", + "Type": { + "$ref": "176" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "178", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "179", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$ref": "2" + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/type/array/model", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "180", + "Name": "put", + "ResourceName": "ModelValue", + "Parameters": [ + { + "$ref": "11" + }, + { + "$id": "181", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "182", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$ref": "2" + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "183", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "184", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "185", + "Type": { + "$ref": "184" + }, + "Value": "application/json" + } + }, + { + "$id": "186", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "187", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "188", + "Type": { + "$ref": "187" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "189", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/type/array/model", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "190" + }, + "Creatable": false, + "Parent": "ArrayClient" + }, + { + "$id": "191", + "Name": "NullableFloatValue", + "Description": "Array of nullable float values", + "Operations": [ + { + "$id": "192", + "Name": "get", + "ResourceName": "NullableFloatValue", + "Parameters": [ + { + "$ref": "11" + }, + { + "$id": "193", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "194", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "195", + "Type": { + "$ref": "194" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "196", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "197", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$id": "198", + "Kind": "Primitive", + "Name": "Float32", + "IsNullable": true + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/type/array/nullable-float", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "199", + "Name": "put", + "ResourceName": "NullableFloatValue", + "Parameters": [ + { + "$ref": "11" + }, + { + "$id": "200", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "201", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$id": "202", + "Kind": "Primitive", + "Name": "Float32", + "IsNullable": true + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "203", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "204", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "205", + "Type": { + "$ref": "204" + }, + "Value": "application/json" + } + }, + { + "$id": "206", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "207", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "208", + "Type": { + "$ref": "207" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "209", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/type/array/nullable-float", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "210" + }, + "Creatable": false, + "Parent": "ArrayClient" + } + ] +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Properties/AssemblyInfo.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..2bbeb1092f6 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Properties/AssemblyInfo.cs @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Type.Array.Tests")] diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Type.Array.csproj b/test/CadlRanchProjectsNonAzure/type/array/src/Type.Array.csproj new file mode 100644 index 00000000000..59d458b48d9 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Type.Array.csproj @@ -0,0 +1,16 @@ + + + This is the Type.Array client library for developing .NET applications with rich experience. + SDK Code Generation Type.Array + 1.0.0-beta.1 + Type.Array + netstandard2.0 + latest + true + + + + + + + diff --git a/test/CadlRanchProjectsNonAzure/type/array/tests/Type.Array.Tests.csproj b/test/CadlRanchProjectsNonAzure/type/array/tests/Type.Array.Tests.csproj new file mode 100644 index 00000000000..86bfcf8c563 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/tests/Type.Array.Tests.csproj @@ -0,0 +1,18 @@ + + + net7.0 + + $(NoWarn);CS1591 + + + + + + + + + + + + + diff --git a/test/UnbrandedProjects/Unbranded-TypeSpec/Unbranded-TypeSpec.tsp b/test/UnbrandedProjects/Unbranded-TypeSpec/Unbranded-TypeSpec.tsp index 3f70445421b..9202ca1d995 100644 --- a/test/UnbrandedProjects/Unbranded-TypeSpec/Unbranded-TypeSpec.tsp +++ b/test/UnbrandedProjects/Unbranded-TypeSpec/Unbranded-TypeSpec.tsp @@ -352,9 +352,3 @@ op stillConvenient(): void; @head @convenientAPI(true) op headAsBoolean(@path id: string): void; - -@route("/putArray") -@doc("put array.") -@put -@convenientAPI(true) -op putArray(@body body: string[]): void; diff --git a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/UnbrandedTypeSpecClient.cs b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/UnbrandedTypeSpecClient.cs index 554e29ad3f8..b969885fd53 100644 --- a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/UnbrandedTypeSpecClient.cs +++ b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/UnbrandedTypeSpecClient.cs @@ -5,7 +5,6 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; -using System.Collections.Generic; using System.Threading.Tasks; using UnbrandedTypeSpec.Models; @@ -1258,86 +1257,6 @@ public virtual ClientResult HeadAsBoolean(string id, RequestOptions option return ClientResult.FromValue(result.Value, result.GetRawResponse()); } - /// put array. - /// The where T is of type to use. - /// is null. - public virtual async Task PutArrayAsync(IEnumerable body) - { - Argument.AssertNotNull(body, nameof(body)); - - using BinaryContent content = BinaryContentHelper.FromEnumerable(body); - ClientResult result = await PutArrayAsync(content, null).ConfigureAwait(false); - return result; - } - - /// put array. - /// The where T is of type to use. - /// is null. - public virtual ClientResult PutArray(IEnumerable body) - { - Argument.AssertNotNull(body, nameof(body)); - - using BinaryContent content = BinaryContentHelper.FromEnumerable(body); - ClientResult result = PutArray(content, null); - return result; - } - - /// - /// [Protocol Method] put array. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task PutArrayAsync(BinaryContent content, RequestOptions options = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using PipelineMessage message = CreatePutArrayRequest(content, options); - return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); - } - - /// - /// [Protocol Method] put array. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual ClientResult PutArray(BinaryContent content, RequestOptions options = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using PipelineMessage message = CreatePutArrayRequest(content, options); - return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); - } - internal PipelineMessage CreateSayHiRequest(string headParameter, string queryParameter, string optionalQuery, RequestOptions options) { var message = _pipeline.CreateMessage(); @@ -1717,26 +1636,6 @@ internal PipelineMessage CreateHeadAsBooleanRequest(string id, RequestOptions op return message; } - internal PipelineMessage CreatePutArrayRequest(BinaryContent content, RequestOptions options) - { - var message = _pipeline.CreateMessage(); - message.ResponseClassifier = PipelineMessageClassifier204; - var request = message.Request; - request.Method = "PUT"; - var uri = new ClientUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/putArray", false); - request.Uri = uri.ToUri(); - request.Headers.Set("Accept", "application/json"); - request.Headers.Set("Content-Type", "application/json"); - request.Content = content; - if (options != null) - { - message.Apply(options); - } - return message; - } - private static PipelineMessageClassifier _pipelineMessageClassifier200; private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); private static PipelineMessageClassifier _pipelineMessageClassifier204; diff --git a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/tspCodeModel.json b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/tspCodeModel.json index 4e634df26b9..97127595a7e 100644 --- a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/tspCodeModel.json +++ b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/tspCodeModel.json @@ -3076,130 +3076,18 @@ "BufferResponse": true, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": true - }, - { - "$id": "316", - "Name": "putArray", - "ResourceName": "UnbrandedTypeSpec", - "Description": "put array.", - "Parameters": [ - { - "$ref": "145" - }, - { - "$id": "317", - "Name": "body", - "NameInRequest": "body", - "Type": { - "$id": "318", - "Kind": "Array", - "Name": "Array", - "ElementType": { - "$id": "319", - "Kind": "Primitive", - "Name": "String", - "IsNullable": false - }, - "IsNullable": false - }, - "Location": "Body", - "IsRequired": true, - "IsApiVersion": false, - "IsResourceParameter": false, - "IsContentType": false, - "IsEndpoint": false, - "SkipUrlEncoding": false, - "Explode": false, - "Kind": "Method" - }, - { - "$id": "320", - "Name": "contentType", - "NameInRequest": "Content-Type", - "Type": { - "$id": "321", - "Kind": "Primitive", - "Name": "String", - "IsNullable": false - }, - "Location": "Header", - "IsApiVersion": false, - "IsResourceParameter": false, - "IsContentType": true, - "IsRequired": true, - "IsEndpoint": false, - "SkipUrlEncoding": false, - "Explode": false, - "Kind": "Constant", - "DefaultValue": { - "$id": "322", - "Type": { - "$ref": "321" - }, - "Value": "application/json" - } - }, - { - "$id": "323", - "Name": "accept", - "NameInRequest": "Accept", - "Type": { - "$id": "324", - "Kind": "Primitive", - "Name": "String", - "IsNullable": false - }, - "Location": "Header", - "IsApiVersion": false, - "IsResourceParameter": false, - "IsContentType": false, - "IsRequired": true, - "IsEndpoint": false, - "SkipUrlEncoding": false, - "Explode": false, - "Kind": "Constant", - "DefaultValue": { - "$id": "325", - "Type": { - "$ref": "324" - }, - "Value": "application/json" - } - } - ], - "Responses": [ - { - "$id": "326", - "StatusCodes": [ - 204 - ], - "BodyMediaType": "Json", - "Headers": [], - "IsErrorResponse": false - } - ], - "HttpMethod": "PUT", - "RequestBodyMediaType": "Json", - "Uri": "{unbrandedTypeSpecUrl}", - "Path": "/putArray", - "RequestMediaTypes": [ - "application/json" - ], - "BufferResponse": true, - "GenerateProtocolMethod": true, - "GenerateConvenienceMethod": true } ], "Protocol": { - "$id": "327" + "$id": "316" }, "Creatable": true } ], "Auth": { - "$id": "328", + "$id": "317", "ApiKey": { - "$id": "329", + "$id": "318", "Name": "my-api-key" } } From b8393803251c2aa9288f0f8d52b2e4de582ce0b0 Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Wed, 17 Apr 2024 11:45:00 +0800 Subject: [PATCH 05/19] fix existing issues --- .../KnownValueExpressions/JsonDocumentExpression.cs | 4 +++- src/AutoRest.CSharp/LowLevel/Output/ConvenienceMethod.cs | 2 +- .../LowLevel/Output/OperationMethodChainBuilder.cs | 2 +- .../type/array/src/Generated/BooleanValue.cs | 4 ++++ .../type/array/src/Generated/DatetimeValue.cs | 4 ++++ .../type/array/src/Generated/DurationValue.cs | 4 ++++ .../type/array/src/Generated/Float32Value.cs | 4 ++++ .../type/array/src/Generated/Int32Value.cs | 4 ++++ .../type/array/src/Generated/Int64Value.cs | 4 ++++ .../type/array/src/Generated/ModelValue.cs | 4 ++++ .../type/array/src/Generated/NullableFloatValue.cs | 4 ++++ .../type/array/src/Generated/StringValue.cs | 4 ++++ .../type/array/src/Generated/UnknownValue.cs | 4 ++++ .../type/array/src/Generated/BooleanValue.cs | 6 +++++- .../type/array/src/Generated/DatetimeValue.cs | 6 +++++- .../type/array/src/Generated/DurationValue.cs | 6 +++++- .../type/array/src/Generated/Float32Value.cs | 6 +++++- .../type/array/src/Generated/Int32Value.cs | 6 +++++- .../type/array/src/Generated/Int64Value.cs | 6 +++++- .../type/array/src/Generated/ModelValue.cs | 6 +++++- .../type/array/src/Generated/NullableFloatValue.cs | 6 +++++- .../type/array/src/Generated/StringValue.cs | 6 +++++- .../type/array/src/Generated/UnknownValue.cs | 6 +++++- 23 files changed, 95 insertions(+), 13 deletions(-) diff --git a/src/AutoRest.CSharp/Common/Output/Expressions/KnownValueExpressions/JsonDocumentExpression.cs b/src/AutoRest.CSharp/Common/Output/Expressions/KnownValueExpressions/JsonDocumentExpression.cs index f8b91b1cb22..77eb1290b33 100644 --- a/src/AutoRest.CSharp/Common/Output/Expressions/KnownValueExpressions/JsonDocumentExpression.cs +++ b/src/AutoRest.CSharp/Common/Output/Expressions/KnownValueExpressions/JsonDocumentExpression.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System.Text.Json; +using AutoRest.CSharp.Common.Input; using AutoRest.CSharp.Common.Output.Expressions.ValueExpressions; using AutoRest.CSharp.Common.Output.Models; using AutoRest.CSharp.Output.Models.Shared; @@ -21,7 +22,8 @@ public static JsonDocumentExpression Parse(StreamExpression stream, bool async) { // Sync and async methods have different set of parameters return async - ? new JsonDocumentExpression(InvokeStatic(nameof(JsonDocument.ParseAsync), new[] { stream, Snippets.Default, KnownParameters.CancellationTokenParameter }, true)) + // non-azure libraries do not have cancellationToken parameter + ? new JsonDocumentExpression(InvokeStatic(nameof(JsonDocument.ParseAsync), new[] { stream, Snippets.Default, Configuration.IsBranded ? KnownParameters.CancellationTokenParameter : Snippets.Default }, true)) : new JsonDocumentExpression(InvokeStatic(nameof(JsonDocument.Parse), stream)); } } diff --git a/src/AutoRest.CSharp/LowLevel/Output/ConvenienceMethod.cs b/src/AutoRest.CSharp/LowLevel/Output/ConvenienceMethod.cs index f5cf85ed4cd..7c3d5993390 100644 --- a/src/AutoRest.CSharp/LowLevel/Output/ConvenienceMethod.cs +++ b/src/AutoRest.CSharp/LowLevel/Output/ConvenienceMethod.cs @@ -146,7 +146,7 @@ public IEnumerable GetConvertStatements(LowLevelClientMetho yield return new[] { - new DeclareVariableStatement(value.Type, value.Declaration, Default), + Declare(value, Default), JsonSerializationMethodsBuilder.BuildDeserializationForMethods(serialization, async, value, Extensible.RestOperations.GetContentStream(response), false, null), Return(Extensible.RestOperations.GetTypedResponseFromValue(value, response)) }; diff --git a/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs b/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs index 681cb8b659b..402b78d056e 100644 --- a/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs +++ b/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs @@ -397,7 +397,7 @@ private ReturnTypeChain BuildReturnTypes() accessibility &= ~Public; // removes public if any accessibility |= Internal; // add internal } - var convenienceSignature = new MethodSignature(name, FormattableStringHelpers.FromString(_restClientMethod.Summary), FormattableStringHelpers.FromString(_restClientMethod.Description), accessibility, _returnType.Convenience, null, parameterList, attributes); + var convenienceSignature = new MethodSignature(name, FormattableStringHelpers.FromString(_restClientMethod.Summary ?? $"The {name} method"), FormattableStringHelpers.FromString(_restClientMethod.Description), accessibility, _returnType.Convenience, null, parameterList, attributes); var diagnostic = Configuration.IsBranded ? name != _restClientMethod.Name ? new Diagnostic($"{_clientName}.{convenienceSignature.Name}") : null : null; diff --git a/test/CadlRanchProjects/type/array/src/Generated/BooleanValue.cs b/test/CadlRanchProjects/type/array/src/Generated/BooleanValue.cs index c79c6d59b01..e0c06ec91b1 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/BooleanValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/BooleanValue.cs @@ -45,6 +45,7 @@ internal BooleanValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline _endpoint = endpoint; } + /// The GetBooleanValue method. /// The cancellation token to use. /// public virtual async Task>> GetBooleanValueAsync(CancellationToken cancellationToken = default) @@ -62,6 +63,7 @@ public virtual async Task>> GetBooleanValueAsync(Ca return Response.FromValue(value, response); } + /// The GetBooleanValue method. /// The cancellation token to use. /// public virtual Response> GetBooleanValue(CancellationToken cancellationToken = default) @@ -149,6 +151,7 @@ public virtual Response GetBooleanValue(RequestContext context) } } + /// The Put method. /// The where T is of type to use. /// The cancellation token to use. /// is null. @@ -163,6 +166,7 @@ public virtual async Task PutAsync(IEnumerable body, Cancellatio return response; } + /// The Put method. /// The where T is of type to use. /// The cancellation token to use. /// is null. diff --git a/test/CadlRanchProjects/type/array/src/Generated/DatetimeValue.cs b/test/CadlRanchProjects/type/array/src/Generated/DatetimeValue.cs index 1e346f40725..9a3003591ca 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/DatetimeValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/DatetimeValue.cs @@ -45,6 +45,7 @@ internal DatetimeValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipelin _endpoint = endpoint; } + /// The GetDatetimeValue method. /// The cancellation token to use. /// public virtual async Task>> GetDatetimeValueAsync(CancellationToken cancellationToken = default) @@ -62,6 +63,7 @@ public virtual async Task>> GetDatetimeVa return Response.FromValue(value, response); } + /// The GetDatetimeValue method. /// The cancellation token to use. /// public virtual Response> GetDatetimeValue(CancellationToken cancellationToken = default) @@ -149,6 +151,7 @@ public virtual Response GetDatetimeValue(RequestContext context) } } + /// The Put method. /// The where T is of type to use. /// The cancellation token to use. /// is null. @@ -163,6 +166,7 @@ public virtual async Task PutAsync(IEnumerable body, C return response; } + /// The Put method. /// The where T is of type to use. /// The cancellation token to use. /// is null. diff --git a/test/CadlRanchProjects/type/array/src/Generated/DurationValue.cs b/test/CadlRanchProjects/type/array/src/Generated/DurationValue.cs index 8163da58214..aec17d473da 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/DurationValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/DurationValue.cs @@ -45,6 +45,7 @@ internal DurationValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipelin _endpoint = endpoint; } + /// The GetDurationValue method. /// The cancellation token to use. /// public virtual async Task>> GetDurationValueAsync(CancellationToken cancellationToken = default) @@ -62,6 +63,7 @@ public virtual async Task>> GetDurationValueAsy return Response.FromValue(value, response); } + /// The GetDurationValue method. /// The cancellation token to use. /// public virtual Response> GetDurationValue(CancellationToken cancellationToken = default) @@ -149,6 +151,7 @@ public virtual Response GetDurationValue(RequestContext context) } } + /// The Put method. /// The where T is of type to use. /// The cancellation token to use. /// is null. @@ -163,6 +166,7 @@ public virtual async Task PutAsync(IEnumerable body, Cancell return response; } + /// The Put method. /// The where T is of type to use. /// The cancellation token to use. /// is null. diff --git a/test/CadlRanchProjects/type/array/src/Generated/Float32Value.cs b/test/CadlRanchProjects/type/array/src/Generated/Float32Value.cs index 2baec61ef55..e2fa019b8ad 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/Float32Value.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/Float32Value.cs @@ -45,6 +45,7 @@ internal Float32Value(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline _endpoint = endpoint; } + /// The GetFloat32Value method. /// The cancellation token to use. /// public virtual async Task>> GetFloat32ValueAsync(CancellationToken cancellationToken = default) @@ -62,6 +63,7 @@ public virtual async Task>> GetFloat32ValueAsync(C return Response.FromValue(value, response); } + /// The GetFloat32Value method. /// The cancellation token to use. /// public virtual Response> GetFloat32Value(CancellationToken cancellationToken = default) @@ -149,6 +151,7 @@ public virtual Response GetFloat32Value(RequestContext context) } } + /// The Put method. /// The where T is of type to use. /// The cancellation token to use. /// is null. @@ -163,6 +166,7 @@ public virtual async Task PutAsync(IEnumerable body, Cancellati return response; } + /// The Put method. /// The where T is of type to use. /// The cancellation token to use. /// is null. diff --git a/test/CadlRanchProjects/type/array/src/Generated/Int32Value.cs b/test/CadlRanchProjects/type/array/src/Generated/Int32Value.cs index 10570063422..c096fb9e6c9 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/Int32Value.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/Int32Value.cs @@ -45,6 +45,7 @@ internal Int32Value(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, _endpoint = endpoint; } + /// The GetInt32Value method. /// The cancellation token to use. /// public virtual async Task>> GetInt32ValueAsync(CancellationToken cancellationToken = default) @@ -62,6 +63,7 @@ public virtual async Task>> GetInt32ValueAsync(Cance return Response.FromValue(value, response); } + /// The GetInt32Value method. /// The cancellation token to use. /// public virtual Response> GetInt32Value(CancellationToken cancellationToken = default) @@ -149,6 +151,7 @@ public virtual Response GetInt32Value(RequestContext context) } } + /// The Put method. /// The where T is of type to use. /// The cancellation token to use. /// is null. @@ -163,6 +166,7 @@ public virtual async Task PutAsync(IEnumerable body, Cancellation return response; } + /// The Put method. /// The where T is of type to use. /// The cancellation token to use. /// is null. diff --git a/test/CadlRanchProjects/type/array/src/Generated/Int64Value.cs b/test/CadlRanchProjects/type/array/src/Generated/Int64Value.cs index b20ffc8948f..b9d82a08a5a 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/Int64Value.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/Int64Value.cs @@ -45,6 +45,7 @@ internal Int64Value(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, _endpoint = endpoint; } + /// The GetInt64Value method. /// The cancellation token to use. /// public virtual async Task>> GetInt64ValueAsync(CancellationToken cancellationToken = default) @@ -62,6 +63,7 @@ public virtual async Task>> GetInt64ValueAsync(Canc return Response.FromValue(value, response); } + /// The GetInt64Value method. /// The cancellation token to use. /// public virtual Response> GetInt64Value(CancellationToken cancellationToken = default) @@ -149,6 +151,7 @@ public virtual Response GetInt64Value(RequestContext context) } } + /// The Put method. /// The where T is of type to use. /// The cancellation token to use. /// is null. @@ -163,6 +166,7 @@ public virtual async Task PutAsync(IEnumerable body, Cancellatio return response; } + /// The Put method. /// The where T is of type to use. /// The cancellation token to use. /// is null. diff --git a/test/CadlRanchProjects/type/array/src/Generated/ModelValue.cs b/test/CadlRanchProjects/type/array/src/Generated/ModelValue.cs index c110fa3e8b5..c67acf39d9c 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/ModelValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/ModelValue.cs @@ -46,6 +46,7 @@ internal ModelValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, _endpoint = endpoint; } + /// The GetModelValue method. /// The cancellation token to use. /// public virtual async Task>> GetModelValueAsync(CancellationToken cancellationToken = default) @@ -63,6 +64,7 @@ public virtual async Task>> GetModelValueAsyn return Response.FromValue(value, response); } + /// The GetModelValue method. /// The cancellation token to use. /// public virtual Response> GetModelValue(CancellationToken cancellationToken = default) @@ -150,6 +152,7 @@ public virtual Response GetModelValue(RequestContext context) } } + /// The Put method. /// The where T is of type to use. /// The cancellation token to use. /// is null. @@ -164,6 +167,7 @@ public virtual async Task PutAsync(IEnumerable body, Cance return response; } + /// The Put method. /// The where T is of type to use. /// The cancellation token to use. /// is null. diff --git a/test/CadlRanchProjects/type/array/src/Generated/NullableFloatValue.cs b/test/CadlRanchProjects/type/array/src/Generated/NullableFloatValue.cs index edd52d2af6a..f8aff4f8119 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/NullableFloatValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/NullableFloatValue.cs @@ -45,6 +45,7 @@ internal NullableFloatValue(ClientDiagnostics clientDiagnostics, HttpPipeline pi _endpoint = endpoint; } + /// The GetNullableFloatValue method. /// The cancellation token to use. /// public virtual async Task>> GetNullableFloatValueAsync(CancellationToken cancellationToken = default) @@ -69,6 +70,7 @@ internal NullableFloatValue(ClientDiagnostics clientDiagnostics, HttpPipeline pi return Response.FromValue(value, response); } + /// The GetNullableFloatValue method. /// The cancellation token to use. /// public virtual Response> GetNullableFloatValue(CancellationToken cancellationToken = default) @@ -163,6 +165,7 @@ public virtual Response GetNullableFloatValue(RequestContext context) } } + /// The Put method. /// The where T is of type ? to use. /// The cancellation token to use. /// is null. @@ -177,6 +180,7 @@ public virtual async Task PutAsync(IEnumerable body, Cancellat return response; } + /// The Put method. /// The where T is of type ? to use. /// The cancellation token to use. /// is null. diff --git a/test/CadlRanchProjects/type/array/src/Generated/StringValue.cs b/test/CadlRanchProjects/type/array/src/Generated/StringValue.cs index 7ca411e1a77..bc7f38d1ed8 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/StringValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/StringValue.cs @@ -45,6 +45,7 @@ internal StringValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, _endpoint = endpoint; } + /// The GetStringValue method. /// The cancellation token to use. /// public virtual async Task>> GetStringValueAsync(CancellationToken cancellationToken = default) @@ -62,6 +63,7 @@ public virtual async Task>> GetStringValueAsync(C return Response.FromValue(value, response); } + /// The GetStringValue method. /// The cancellation token to use. /// public virtual Response> GetStringValue(CancellationToken cancellationToken = default) @@ -149,6 +151,7 @@ public virtual Response GetStringValue(RequestContext context) } } + /// The Put method. /// The where T is of type to use. /// The cancellation token to use. /// is null. @@ -163,6 +166,7 @@ public virtual async Task PutAsync(IEnumerable body, Cancellat return response; } + /// The Put method. /// The where T is of type to use. /// The cancellation token to use. /// is null. diff --git a/test/CadlRanchProjects/type/array/src/Generated/UnknownValue.cs b/test/CadlRanchProjects/type/array/src/Generated/UnknownValue.cs index a272ac7e5f9..d303f1bcfcf 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/UnknownValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/UnknownValue.cs @@ -45,6 +45,7 @@ internal UnknownValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline _endpoint = endpoint; } + /// The GetUnknownValue method. /// The cancellation token to use. /// public virtual async Task>> GetUnknownValueAsync(CancellationToken cancellationToken = default) @@ -69,6 +70,7 @@ public virtual async Task>> GetUnknownValueAs return Response.FromValue(value, response); } + /// The GetUnknownValue method. /// The cancellation token to use. /// public virtual Response> GetUnknownValue(CancellationToken cancellationToken = default) @@ -163,6 +165,7 @@ public virtual Response GetUnknownValue(RequestContext context) } } + /// The Put method. /// The where T is of type to use. /// The cancellation token to use. /// is null. @@ -177,6 +180,7 @@ public virtual async Task PutAsync(IEnumerable body, Cance return response; } + /// The Put method. /// The where T is of type to use. /// The cancellation token to use. /// is null. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs index 633e6023957..88eea867b1a 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs @@ -35,11 +35,12 @@ internal BooleanValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } + /// The GetBooleanValue method. public virtual async Task>> GetBooleanValueAsync() { ClientResult result = await GetBooleanValueAsync(null).ConfigureAwait(false); IReadOnlyList value = default; - using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, cancellationToken).ConfigureAwait(false); + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); List array = new List(); foreach (var item in document.RootElement.EnumerateArray()) { @@ -49,6 +50,7 @@ public virtual async Task>> GetBooleanValueAsyn return ClientResult.FromValue(value, result.GetRawResponse()); } + /// The GetBooleanValue method. public virtual ClientResult> GetBooleanValue() { ClientResult result = GetBooleanValue(null); @@ -111,6 +113,7 @@ public virtual ClientResult GetBooleanValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } + /// The Put method. /// The where T is of type to use. /// is null. public virtual async Task PutAsync(IEnumerable body) @@ -122,6 +125,7 @@ public virtual async Task PutAsync(IEnumerable body) return result; } + /// The Put method. /// The where T is of type to use. /// is null. public virtual ClientResult Put(IEnumerable body) diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs index ec501a1e742..81fb19e9410 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs @@ -35,11 +35,12 @@ internal DatetimeValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } + /// The GetDatetimeValue method. public virtual async Task>> GetDatetimeValueAsync() { ClientResult result = await GetDatetimeValueAsync(null).ConfigureAwait(false); IReadOnlyList value = default; - using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, cancellationToken).ConfigureAwait(false); + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); List array = new List(); foreach (var item in document.RootElement.EnumerateArray()) { @@ -49,6 +50,7 @@ public virtual async Task>> GetDateti return ClientResult.FromValue(value, result.GetRawResponse()); } + /// The GetDatetimeValue method. public virtual ClientResult> GetDatetimeValue() { ClientResult result = GetDatetimeValue(null); @@ -111,6 +113,7 @@ public virtual ClientResult GetDatetimeValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } + /// The Put method. /// The where T is of type to use. /// is null. public virtual async Task PutAsync(IEnumerable body) @@ -122,6 +125,7 @@ public virtual async Task PutAsync(IEnumerable bod return result; } + /// The Put method. /// The where T is of type to use. /// is null. public virtual ClientResult Put(IEnumerable body) diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs index 22114c6507f..0196f9e9e07 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs @@ -35,11 +35,12 @@ internal DurationValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } + /// The GetDurationValue method. public virtual async Task>> GetDurationValueAsync() { ClientResult result = await GetDurationValueAsync(null).ConfigureAwait(false); IReadOnlyList value = default; - using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, cancellationToken).ConfigureAwait(false); + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); List array = new List(); foreach (var item in document.RootElement.EnumerateArray()) { @@ -49,6 +50,7 @@ public virtual async Task>> GetDurationValu return ClientResult.FromValue(value, result.GetRawResponse()); } + /// The GetDurationValue method. public virtual ClientResult> GetDurationValue() { ClientResult result = GetDurationValue(null); @@ -111,6 +113,7 @@ public virtual ClientResult GetDurationValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } + /// The Put method. /// The where T is of type to use. /// is null. public virtual async Task PutAsync(IEnumerable body) @@ -122,6 +125,7 @@ public virtual async Task PutAsync(IEnumerable body) return result; } + /// The Put method. /// The where T is of type to use. /// is null. public virtual ClientResult Put(IEnumerable body) diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs index 7df1f44a855..13b5c810e25 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs @@ -35,11 +35,12 @@ internal Float32Value(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } + /// The GetFloat32Value method. public virtual async Task>> GetFloat32ValueAsync() { ClientResult result = await GetFloat32ValueAsync(null).ConfigureAwait(false); IReadOnlyList value = default; - using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, cancellationToken).ConfigureAwait(false); + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); List array = new List(); foreach (var item in document.RootElement.EnumerateArray()) { @@ -49,6 +50,7 @@ public virtual async Task>> GetFloat32ValueAsy return ClientResult.FromValue(value, result.GetRawResponse()); } + /// The GetFloat32Value method. public virtual ClientResult> GetFloat32Value() { ClientResult result = GetFloat32Value(null); @@ -111,6 +113,7 @@ public virtual ClientResult GetFloat32Value(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } + /// The Put method. /// The where T is of type to use. /// is null. public virtual async Task PutAsync(IEnumerable body) @@ -122,6 +125,7 @@ public virtual async Task PutAsync(IEnumerable body) return result; } + /// The Put method. /// The where T is of type to use. /// is null. public virtual ClientResult Put(IEnumerable body) diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs index d4feb0b39a2..3d5168f7b8c 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs @@ -35,11 +35,12 @@ internal Int32Value(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } + /// The GetInt32Value method. public virtual async Task>> GetInt32ValueAsync() { ClientResult result = await GetInt32ValueAsync(null).ConfigureAwait(false); IReadOnlyList value = default; - using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, cancellationToken).ConfigureAwait(false); + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); List array = new List(); foreach (var item in document.RootElement.EnumerateArray()) { @@ -49,6 +50,7 @@ public virtual async Task>> GetInt32ValueAsync() return ClientResult.FromValue(value, result.GetRawResponse()); } + /// The GetInt32Value method. public virtual ClientResult> GetInt32Value() { ClientResult result = GetInt32Value(null); @@ -111,6 +113,7 @@ public virtual ClientResult GetInt32Value(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } + /// The Put method. /// The where T is of type to use. /// is null. public virtual async Task PutAsync(IEnumerable body) @@ -122,6 +125,7 @@ public virtual async Task PutAsync(IEnumerable body) return result; } + /// The Put method. /// The where T is of type to use. /// is null. public virtual ClientResult Put(IEnumerable body) diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs index c5e7054c933..0e643e5183f 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs @@ -35,11 +35,12 @@ internal Int64Value(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } + /// The GetInt64Value method. public virtual async Task>> GetInt64ValueAsync() { ClientResult result = await GetInt64ValueAsync(null).ConfigureAwait(false); IReadOnlyList value = default; - using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, cancellationToken).ConfigureAwait(false); + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); List array = new List(); foreach (var item in document.RootElement.EnumerateArray()) { @@ -49,6 +50,7 @@ public virtual async Task>> GetInt64ValueAsync( return ClientResult.FromValue(value, result.GetRawResponse()); } + /// The GetInt64Value method. public virtual ClientResult> GetInt64Value() { ClientResult result = GetInt64Value(null); @@ -111,6 +113,7 @@ public virtual ClientResult GetInt64Value(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } + /// The Put method. /// The where T is of type to use. /// is null. public virtual async Task PutAsync(IEnumerable body) @@ -122,6 +125,7 @@ public virtual async Task PutAsync(IEnumerable body) return result; } + /// The Put method. /// The where T is of type to use. /// is null. public virtual ClientResult Put(IEnumerable body) diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs index 63e88af5bdb..0e629938001 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs @@ -36,11 +36,12 @@ internal ModelValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } + /// The GetModelValue method. public virtual async Task>> GetModelValueAsync() { ClientResult result = await GetModelValueAsync(null).ConfigureAwait(false); IReadOnlyList value = default; - using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, cancellationToken).ConfigureAwait(false); + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); List array = new List(); foreach (var item in document.RootElement.EnumerateArray()) { @@ -50,6 +51,7 @@ public virtual async Task>> GetModelValue return ClientResult.FromValue(value, result.GetRawResponse()); } + /// The GetModelValue method. public virtual ClientResult> GetModelValue() { ClientResult result = GetModelValue(null); @@ -112,6 +114,7 @@ public virtual ClientResult GetModelValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } + /// The Put method. /// The where T is of type to use. /// is null. public virtual async Task PutAsync(IEnumerable body) @@ -123,6 +126,7 @@ public virtual async Task PutAsync(IEnumerable body) return result; } + /// The Put method. /// The where T is of type to use. /// is null. public virtual ClientResult Put(IEnumerable body) diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs index 002a6eacd95..dcea7cadf6a 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs @@ -35,11 +35,12 @@ internal NullableFloatValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } + /// The GetNullableFloatValue method. public virtual async Task>> GetNullableFloatValueAsync() { ClientResult result = await GetNullableFloatValueAsync(null).ConfigureAwait(false); IReadOnlyList value = default; - using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, cancellationToken).ConfigureAwait(false); + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); List array = new List(); foreach (var item in document.RootElement.EnumerateArray()) { @@ -56,6 +57,7 @@ internal NullableFloatValue(ClientPipeline pipeline, Uri endpoint) return ClientResult.FromValue(value, result.GetRawResponse()); } + /// The GetNullableFloatValue method. public virtual ClientResult> GetNullableFloatValue() { ClientResult result = GetNullableFloatValue(null); @@ -125,6 +127,7 @@ public virtual ClientResult GetNullableFloatValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } + /// The Put method. /// The where T is of type ? to use. /// is null. public virtual async Task PutAsync(IEnumerable body) @@ -136,6 +139,7 @@ public virtual async Task PutAsync(IEnumerable body) return result; } + /// The Put method. /// The where T is of type ? to use. /// is null. public virtual ClientResult Put(IEnumerable body) diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs index 5630aa32658..650818d1950 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs @@ -35,11 +35,12 @@ internal StringValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } + /// The GetStringValue method. public virtual async Task>> GetStringValueAsync() { ClientResult result = await GetStringValueAsync(null).ConfigureAwait(false); IReadOnlyList value = default; - using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, cancellationToken).ConfigureAwait(false); + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); List array = new List(); foreach (var item in document.RootElement.EnumerateArray()) { @@ -49,6 +50,7 @@ public virtual async Task>> GetStringValueAsy return ClientResult.FromValue(value, result.GetRawResponse()); } + /// The GetStringValue method. public virtual ClientResult> GetStringValue() { ClientResult result = GetStringValue(null); @@ -111,6 +113,7 @@ public virtual ClientResult GetStringValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } + /// The Put method. /// The where T is of type to use. /// is null. public virtual async Task PutAsync(IEnumerable body) @@ -122,6 +125,7 @@ public virtual async Task PutAsync(IEnumerable body) return result; } + /// The Put method. /// The where T is of type to use. /// is null. public virtual ClientResult Put(IEnumerable body) diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs index d7f5845bd3f..5a2eba1724b 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs @@ -35,11 +35,12 @@ internal UnknownValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } + /// The GetUnknownValue method. public virtual async Task>> GetUnknownValueAsync() { ClientResult result = await GetUnknownValueAsync(null).ConfigureAwait(false); IReadOnlyList value = default; - using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, cancellationToken).ConfigureAwait(false); + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); List array = new List(); foreach (var item in document.RootElement.EnumerateArray()) { @@ -56,6 +57,7 @@ public virtual async Task>> GetUnknownVal return ClientResult.FromValue(value, result.GetRawResponse()); } + /// The GetUnknownValue method. public virtual ClientResult> GetUnknownValue() { ClientResult result = GetUnknownValue(null); @@ -125,6 +127,7 @@ public virtual ClientResult GetUnknownValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } + /// The Put method. /// The where T is of type to use. /// is null. public virtual async Task PutAsync(IEnumerable body) @@ -136,6 +139,7 @@ public virtual async Task PutAsync(IEnumerable body) return result; } + /// The Put method. /// The where T is of type to use. /// is null. public virtual ClientResult Put(IEnumerable body) From fa4837f9705b24818dd44ff284ec2a9c78098485 Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Wed, 17 Apr 2024 13:14:48 +0800 Subject: [PATCH 06/19] fix cadl-ranch case --- test/CadlRanchProjects.Tests/type-array.cs | 30 ++-- .../authentication-http-custom.cs | 2 +- .../type-array.cs | 165 ++++++++++++++++++ .../{Type.Array.sln => _Type._Array.sln} | 4 +- .../type/array/src/Generated/ArrayClient.cs | 4 +- .../array/src/Generated/ArrayClientOptions.cs | 2 +- .../type/array/src/Generated/BooleanValue.cs | 2 +- .../array/src/Generated/Configuration.json | 4 +- .../type/array/src/Generated/DatetimeValue.cs | 2 +- .../type/array/src/Generated/DurationValue.cs | 2 +- .../type/array/src/Generated/Float32Value.cs | 2 +- .../type/array/src/Generated/Int32Value.cs | 2 +- .../type/array/src/Generated/Int64Value.cs | 2 +- .../array/src/Generated/Internal/Argument.cs | 4 +- .../Generated/Internal/BinaryContentHelper.cs | 2 +- .../Internal/ChangeTrackingDictionary.cs | 6 +- .../Generated/Internal/ChangeTrackingList.cs | 2 +- .../Internal/ClientPipelineExtensions.cs | 2 +- .../Generated/Internal/ClientUriBuilder.cs | 2 +- .../src/Generated/Internal/ErrorResult.cs | 2 +- .../Internal/ModelSerializationExtensions.cs | 2 +- .../array/src/Generated/Internal/Optional.cs | 2 +- .../Internal/Utf8JsonBinaryContent.cs | 2 +- .../type/array/src/Generated/ModelValue.cs | 4 +- .../Models/InnerModel.Serialization.cs | 2 +- .../array/src/Generated/Models/InnerModel.cs | 2 +- .../array/src/Generated/NullableFloatValue.cs | 2 +- .../type/array/src/Generated/StringValue.cs | 2 +- .../type/array/src/Generated/UnknownValue.cs | 2 +- .../type/array/src/Properties/AssemblyInfo.cs | 2 +- ...{Type.Array.csproj => _Type._Array.csproj} | 6 +- ...Tests.csproj => _Type._Array.Tests.csproj} | 2 +- .../type/array/tspconfig.yaml | 3 + 33 files changed, 220 insertions(+), 56 deletions(-) create mode 100644 test/CadlRanchProjectsNonAzure.Tests/type-array.cs rename test/CadlRanchProjectsNonAzure/type/array/{Type.Array.sln => _Type._Array.sln} (91%) rename test/CadlRanchProjectsNonAzure/type/array/src/{Type.Array.csproj => _Type._Array.csproj} (65%) rename test/CadlRanchProjectsNonAzure/type/array/tests/{Type.Array.Tests.csproj => _Type._Array.Tests.csproj} (89%) create mode 100644 test/CadlRanchProjectsNonAzure/type/array/tspconfig.yaml diff --git a/test/CadlRanchProjects.Tests/type-array.cs b/test/CadlRanchProjects.Tests/type-array.cs index b3ecfbc1255..84d3c3a5659 100644 --- a/test/CadlRanchProjects.Tests/type-array.cs +++ b/test/CadlRanchProjects.Tests/type-array.cs @@ -20,14 +20,13 @@ public class TypeArrayTests : CadlRanchTestBase public Task Type_Array_Int32Value_get() => Test(async (host) => { var response = await new ArrayClient(host, null).GetInt32ValueClient().GetInt32ValueAsync(); - Assert.AreEqual(1, response.Value.First()); - Assert.AreEqual(2, response.Value.Last()); + CollectionAssert.AreEqual(new[] { 1, 2 }, response.Value); }); [Test] public Task Type_Array_Int32Value_put() => Test(async (host) => { - var response = await new ArrayClient(host, null).GetInt32ValueClient().PutAsync(new List { 1, 2}); + var response = await new ArrayClient(host, null).GetInt32ValueClient().PutAsync(new List { 1, 2 }); Assert.AreEqual(204, response.Status); }); @@ -35,8 +34,7 @@ public Task Type_Array_Int32Value_put() => Test(async (host) => public Task Type_Array_Int64Value_get() => Test(async (host) => { var response = await new ArrayClient(host, null).GetInt64ValueClient().GetInt64ValueAsync(); - Assert.AreEqual(9007199254740991, response.Value.First()); - Assert.AreEqual(-9007199254740991, response.Value.Last()); + CollectionAssert.AreEqual(new[] { 9007199254740991, -9007199254740991 }, response.Value); }); [Test] @@ -50,8 +48,7 @@ public Task Type_Array_Int64Value_put() => Test(async (host) => public Task Type_Array_BooleanValue_get() => Test(async (host) => { var response = await new ArrayClient(host, null).GetBooleanValueClient().GetBooleanValueAsync(); - Assert.AreEqual(true, response.Value.First()); - Assert.AreEqual(false, response.Value.Last()); + CollectionAssert.AreEqual(new[] { true, false }, response.Value); }); [Test] @@ -65,8 +62,7 @@ public Task Type_Array_BooleanValue_put() => Test(async (host) => public Task Type_Array_StringValue_get() => Test(async (host) => { var response = await new ArrayClient(host, null).GetStringValueClient().GetStringValueAsync(); - Assert.AreEqual("hello", response.Value.First()); - Assert.AreEqual("", response.Value.Last()); + CollectionAssert.AreEqual(new[] { "hello", "" }, response.Value); }); [Test] @@ -80,7 +76,7 @@ public Task Type_Array_StringValue_put() => Test(async (host) => public Task Type_Array_Float32Value_get() => Test(async (host) => { var response = await new ArrayClient(host, null).GetFloat32ValueClient().GetFloat32ValueAsync(); - Assert.AreEqual(43.125f, response.Value.First()); + CollectionAssert.AreEqual(new[] { 43.125f }, response.Value); }); [Test] @@ -94,7 +90,8 @@ public Task Type_Array_Float32Value_put() => Test(async (host) => public Task Type_Array_DatetimeValue_get() => Test(async (host) => { var response = await new ArrayClient(host, null).GetDatetimeValueClient().GetDatetimeValueAsync(); - Assert.AreEqual(DateTimeOffset.Parse("2022-08-26T18:38:00Z"), response.Value.First()); + Assert.AreEqual(1, response.Value.Count); + Assert.AreEqual(DateTimeOffset.Parse("2022-08-26T18:38:00Z"), response.Value[0]); }); [Test] @@ -108,13 +105,14 @@ public Task Type_Array_DatetimeValue_put() => Test(async (host) => public Task Type_Array_DurationValue_get() => Test(async (host) => { var response = await new ArrayClient(host, null).GetDurationValueClient().GetDurationValueAsync(); - Assert.AreEqual(XmlConvert.ToTimeSpan("P123DT22H14M12.011S"), response.Value.First()); + Assert.AreEqual(1, response.Value.Count); + Assert.AreEqual(XmlConvert.ToTimeSpan("P123DT22H14M12.011S"), response.Value[0]); }); [Test] public Task Type_Array_DurationValue_put() => Test(async (host) => { - var response = await new ArrayClient(host, null).GetDurationValueClient().PutAsync(new List { XmlConvert.ToTimeSpan("P123DT22H14M12.011S")}); + var response = await new ArrayClient(host, null).GetDurationValueClient().PutAsync(new List { XmlConvert.ToTimeSpan("P123DT22H14M12.011S") }); Assert.AreEqual(204, response.Status); }); @@ -138,6 +136,7 @@ public Task Type_Array_UnknownValue_put() => Test(async (host) => public Task Type_Array_ModelValue_get() => Test(async (host) => { var response = await new ArrayClient(host, null).GetModelValueClient().GetModelValueAsync(); + Assert.AreEqual(2, response.Value.Count); Assert.AreEqual("hello", response.Value.First().Property); Assert.AreEqual("world", response.Value.Last().Property); }); @@ -153,10 +152,7 @@ public Task Type_Array_ModelValue_put() => Test(async (host) => public Task Type_Array_NullableFloatValue_get() => Test(async (host) => { var response = await new ArrayClient(host, null).GetNullableFloatValueClient().GetNullableFloatValueAsync(); - var result = response.Value.ToList(); - Assert.AreEqual(1.25f, result[0]); - Assert.AreEqual(null, result[1]); - Assert.AreEqual(3.0f, result[2]); + CollectionAssert.AreEqual(new float?[] { 1.25f, null, 3.0f }, response.Value); }); [Test] diff --git a/test/CadlRanchProjectsNonAzure.Tests/authentication-http-custom.cs b/test/CadlRanchProjectsNonAzure.Tests/authentication-http-custom.cs index 922f2d849cb..90785e1b2ed 100644 --- a/test/CadlRanchProjectsNonAzure.Tests/authentication-http-custom.cs +++ b/test/CadlRanchProjectsNonAzure.Tests/authentication-http-custom.cs @@ -6,7 +6,7 @@ namespace CadlRanchProjectsNonAzure.Tests { - public class AuthenticationHttpCustomTests: CadlRanchNonAzureTestBase + public class AuthenticationHttpCustomTests : CadlRanchNonAzureTestBase { [Test] public Task Authentication_Http_Custom_valid() => Test(async (host) => diff --git a/test/CadlRanchProjectsNonAzure.Tests/type-array.cs b/test/CadlRanchProjectsNonAzure.Tests/type-array.cs new file mode 100644 index 00000000000..32b314dc827 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure.Tests/type-array.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Xml; +using AutoRest.TestServer.Tests.Infrastructure; +using Azure; +using NUnit.Framework; +using _Type._Array; +using _Type._Array.Models; + +namespace CadlRanchProjectsNonAzure.Tests +{ + public class TypeArrayTests : CadlRanchNonAzureTestBase + { + [Test] + public Task Type_Array_Int32Value_get() => Test(async (host) => + { + var response = await new ArrayClient(host, null).GetInt32ValueClient().GetInt32ValueAsync(); + CollectionAssert.AreEqual(new[] { 1, 2 }, response.Value); + }); + + [Test] + public Task Type_Array_Int32Value_put() => Test(async (host) => + { + var response = await new ArrayClient(host, null).GetInt32ValueClient().PutAsync(new List { 1, 2 }); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [Test] + public Task Type_Array_Int64Value_get() => Test(async (host) => + { + var response = await new ArrayClient(host, null).GetInt64ValueClient().GetInt64ValueAsync(); + CollectionAssert.AreEqual(new[] { 9007199254740991, -9007199254740991 }, response.Value); + }); + + [Test] + public Task Type_Array_Int64Value_put() => Test(async (host) => + { + var response = await new ArrayClient(host, null).GetInt64ValueClient().PutAsync(new List { 9007199254740991, -9007199254740991 }); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [Test] + public Task Type_Array_BooleanValue_get() => Test(async (host) => + { + var response = await new ArrayClient(host, null).GetBooleanValueClient().GetBooleanValueAsync(); + CollectionAssert.AreEqual(new[] { true, false }, response.Value); + }); + + [Test] + public Task Type_Array_BooleanValue_put() => Test(async (host) => + { + var response = await new ArrayClient(host, null).GetBooleanValueClient().PutAsync(new List { true, false }); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [Test] + public Task Type_Array_StringValue_get() => Test(async (host) => + { + var response = await new ArrayClient(host, null).GetStringValueClient().GetStringValueAsync(); + CollectionAssert.AreEqual(new[] { "hello", "" }, response.Value); + }); + + [Test] + public Task Type_Array_StringValue_put() => Test(async (host) => + { + var response = await new ArrayClient(host, null).GetStringValueClient().PutAsync(new List { "hello", "" }); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [Test] + public Task Type_Array_Float32Value_get() => Test(async (host) => + { + var response = await new ArrayClient(host, null).GetFloat32ValueClient().GetFloat32ValueAsync(); + CollectionAssert.AreEqual(new[] { 43.125f }, response.Value); + }); + + [Test] + public Task Type_Array_Float32Value_put() => Test(async (host) => + { + var response = await new ArrayClient(host, null).GetFloat32ValueClient().PutAsync(new List { 43.125f }); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [Test] + public Task Type_Array_DatetimeValue_get() => Test(async (host) => + { + var response = await new ArrayClient(host, null).GetDatetimeValueClient().GetDatetimeValueAsync(); + Assert.AreEqual(1, response.Value.Count); + Assert.AreEqual(DateTimeOffset.Parse("2022-08-26T18:38:00Z"), response.Value[0]); + }); + + [Test] + public Task Type_Array_DatetimeValue_put() => Test(async (host) => + { + var response = await new ArrayClient(host, null).GetDatetimeValueClient().PutAsync(new List { DateTimeOffset.Parse("2022-08-26T18:38:00Z") }); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [Test] + public Task Type_Array_DurationValue_get() => Test(async (host) => + { + var response = await new ArrayClient(host, null).GetDurationValueClient().GetDurationValueAsync(); + Assert.AreEqual(1, response.Value.Count); + Assert.AreEqual(XmlConvert.ToTimeSpan("P123DT22H14M12.011S"), response.Value[0]); + }); + + [Test] + public Task Type_Array_DurationValue_put() => Test(async (host) => + { + var response = await new ArrayClient(host, null).GetDurationValueClient().PutAsync(new List { XmlConvert.ToTimeSpan("P123DT22H14M12.011S") }); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [Test] + public Task Type_Array_UnknownValue_get() => Test(async (host) => + { + var response = await new ArrayClient(host, null).GetUnknownValueClient().GetUnknownValueAsync(); + var expected = new List { 1, "hello", null }; + var actual = response.Value.Select(item => item?.ToObjectFromJson()).ToArray(); + CollectionAssert.AreEqual(expected, actual); + }); + + [Test] + public Task Type_Array_UnknownValue_put() => Test(async (host) => + { + var response = await new ArrayClient(host, null).GetUnknownValueClient().PutAsync(new List { new BinaryData(1), new BinaryData("\"hello\""), null }); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [Test] + public Task Type_Array_ModelValue_get() => Test(async (host) => + { + var response = await new ArrayClient(host, null).GetModelValueClient().GetModelValueAsync(); + Assert.AreEqual(2, response.Value.Count); + Assert.AreEqual("hello", response.Value.First().Property); + Assert.AreEqual("world", response.Value.Last().Property); + }); + + [Test] + public Task Type_Array_ModelValue_put() => Test(async (host) => + { + var response = await new ArrayClient(host, null).GetModelValueClient().PutAsync(new List { new InnerModel("hello"), new InnerModel("world") }); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [Test] + public Task Type_Array_NullableFloatValue_get() => Test(async (host) => + { + var response = await new ArrayClient(host, null).GetNullableFloatValueClient().GetNullableFloatValueAsync(); + CollectionAssert.AreEqual(new float?[] { 1.25f, null, 3.0f }, response.Value); + }); + + [Test] + public Task Type_Array_NullableFloatValue_put() => Test(async (host) => + { + var response = await new ArrayClient(host, null).GetNullableFloatValueClient().PutAsync(new List { 1.25f, null, 3.0f }); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/array/Type.Array.sln b/test/CadlRanchProjectsNonAzure/type/array/_Type._Array.sln similarity index 91% rename from test/CadlRanchProjectsNonAzure/type/array/Type.Array.sln rename to test/CadlRanchProjectsNonAzure/type/array/_Type._Array.sln index b59246fa4f9..1fccb1acbb5 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/Type.Array.sln +++ b/test/CadlRanchProjectsNonAzure/type/array/_Type._Array.sln @@ -2,9 +2,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29709.97 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Type.Array", "src\Type.Array.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_Type._Array", "src\_Type._Array.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Type.Array.Tests", "tests\Type.Array.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_Type._Array.Tests", "tests\_Type._Array.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClient.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClient.cs index 1c88ba01d3f..dbefd73ce2a 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClient.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClient.cs @@ -6,7 +6,7 @@ using System.ClientModel.Primitives; using System.Threading; -namespace Type.Array +namespace _Type._Array { // Data plane generated client. /// The Array service client. @@ -32,7 +32,7 @@ public ArrayClient(Uri endpoint, ArrayClientOptions options) Argument.AssertNotNull(endpoint, nameof(endpoint)); options ??= new ArrayClientOptions(); - _pipeline = ClientPipeline.Create(options, System.Array.Empty(), System.Array.Empty(), System.Array.Empty()); + _pipeline = ClientPipeline.Create(options, Array.Empty(), Array.Empty(), Array.Empty()); _endpoint = endpoint; } diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClientOptions.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClientOptions.cs index 11312b0c5ab..ecc184a21ea 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClientOptions.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClientOptions.cs @@ -4,7 +4,7 @@ using System.ClientModel.Primitives; -namespace Type.Array +namespace _Type._Array { /// Client options for ArrayClient. public partial class ArrayClientOptions : ClientPipelineOptions diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs index 88eea867b1a..d1363bc6703 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace Type.Array +namespace _Type._Array { // Data plane generated sub-client. /// Array of boolean values. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Configuration.json b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Configuration.json index d6d1f32eba1..707863e28ea 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Configuration.json +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Configuration.json @@ -1,7 +1,7 @@ { "output-folder": ".", - "namespace": "Type.Array", - "library-name": "Type.Array", + "namespace": "_Type._Array", + "library-name": "_Type._Array", "shared-source-folders": [ "../../../../../../artifacts/bin/AutoRest.CSharp/Debug/net7.0/Generator.Shared", "../../../../../../artifacts/bin/AutoRest.CSharp/Debug/net7.0/Azure.Core.Shared" diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs index 81fb19e9410..816d3c5b53c 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace Type.Array +namespace _Type._Array { // Data plane generated sub-client. /// Array of datetime values. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs index 0196f9e9e07..df981105396 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace Type.Array +namespace _Type._Array { // Data plane generated sub-client. /// Array of duration values. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs index 13b5c810e25..1f45bb54bb1 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace Type.Array +namespace _Type._Array { // Data plane generated sub-client. /// Array of float values. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs index 3d5168f7b8c..0e8458e8134 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace Type.Array +namespace _Type._Array { // Data plane generated sub-client. /// Array of int32 values. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs index 0e643e5183f..dff532acddb 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace Type.Array +namespace _Type._Array { // Data plane generated sub-client. /// Array of int64 values. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Argument.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Argument.cs index ccba4adeabf..9aee3d8c359 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Argument.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Argument.cs @@ -6,7 +6,7 @@ using System.Collections; using System.Collections.Generic; -namespace Type.Array +namespace _Type._Array { internal static class Argument { @@ -94,7 +94,7 @@ public static void AssertInRange(T value, T minimum, T maximum, string name) } } - public static void AssertEnumDefined(System.Type enumType, object value, string name) + public static void AssertEnumDefined(Type enumType, object value, string name) { if (!Enum.IsDefined(enumType, value)) { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/BinaryContentHelper.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/BinaryContentHelper.cs index bf57eac5fad..ea107679ff3 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/BinaryContentHelper.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/BinaryContentHelper.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; using System.Text.Json; -namespace Type.Array +namespace _Type._Array { internal static class BinaryContentHelper { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingDictionary.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingDictionary.cs index 7c003bc7e4d..a3770b84a3f 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingDictionary.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -6,7 +6,7 @@ using System.Collections; using System.Collections.Generic; -namespace Type.Array +namespace _Type._Array { internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull { @@ -44,9 +44,9 @@ public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; - public ICollection Keys => IsUndefined ? System.Array.Empty() : EnsureDictionary().Keys; + public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; - public ICollection Values => IsUndefined ? System.Array.Empty() : EnsureDictionary().Values; + public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; public TValue this[TKey key] { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingList.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingList.cs index 2045e8f9f17..62041e056f4 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingList.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingList.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; using System.Linq; -namespace Type.Array +namespace _Type._Array { internal class ChangeTrackingList : IList, IReadOnlyList { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientPipelineExtensions.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientPipelineExtensions.cs index 42cfbaf9a5b..146c15a816c 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientPipelineExtensions.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientPipelineExtensions.cs @@ -6,7 +6,7 @@ using System.ClientModel.Primitives; using System.Threading.Tasks; -namespace Type.Array +namespace _Type._Array { internal static class ClientPipelineExtensions { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientUriBuilder.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientUriBuilder.cs index 9c12a8b3352..e58c83db2f1 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientUriBuilder.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientUriBuilder.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Text; -namespace Type.Array +namespace _Type._Array { internal class ClientUriBuilder { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ErrorResult.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ErrorResult.cs index 453aaea6241..d6015a77e70 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ErrorResult.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ErrorResult.cs @@ -5,7 +5,7 @@ using System.ClientModel; using System.ClientModel.Primitives; -namespace Type.Array +namespace _Type._Array { internal class ErrorResult : ClientResult { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ModelSerializationExtensions.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ModelSerializationExtensions.cs index 6a5bd7876b2..a3a1decfceb 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ModelSerializationExtensions.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ModelSerializationExtensions.cs @@ -10,7 +10,7 @@ using System.Text.Json; using System.Xml; -namespace Type.Array +namespace _Type._Array { internal static class ModelSerializationExtensions { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Optional.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Optional.cs index 583e221ce5d..f2628e06995 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Optional.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Optional.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Text.Json; -namespace Type.Array +namespace _Type._Array { internal static class Optional { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Utf8JsonBinaryContent.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Utf8JsonBinaryContent.cs index fc0fbdb9f2e..7220afef8fd 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Utf8JsonBinaryContent.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Utf8JsonBinaryContent.cs @@ -8,7 +8,7 @@ using System.Threading; using System.Threading.Tasks; -namespace Type.Array +namespace _Type._Array { internal class Utf8JsonBinaryContent : BinaryContent { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs index 0e629938001..55d85f19855 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs @@ -8,9 +8,9 @@ using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; -using Type.Array.Models; +using _Type._Array.Models; -namespace Type.Array +namespace _Type._Array { // Data plane generated sub-client. /// Array of model values. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.Serialization.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.Serialization.cs index e65045f5523..83b03991e99 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.Serialization.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; -namespace Type.Array.Models +namespace _Type._Array.Models { public partial class InnerModel : IJsonModel { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.cs index 7d1a9f822ef..bcb04e00431 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; -namespace Type.Array.Models +namespace _Type._Array.Models { /// Array inner model. public partial class InnerModel diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs index dcea7cadf6a..a11c550b31a 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace Type.Array +namespace _Type._Array { // Data plane generated sub-client. /// Array of nullable float values. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs index 650818d1950..006cc3c6057 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace Type.Array +namespace _Type._Array { // Data plane generated sub-client. /// Array of string values. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs index 5a2eba1724b..942f84d7951 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace Type.Array +namespace _Type._Array { // Data plane generated sub-client. /// Array of unknown values. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Properties/AssemblyInfo.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Properties/AssemblyInfo.cs index 2bbeb1092f6..3f0a9e70ed1 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Properties/AssemblyInfo.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Properties/AssemblyInfo.cs @@ -3,4 +3,4 @@ using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("Type.Array.Tests")] +[assembly: InternalsVisibleTo("_Type._Array.Tests")] diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Type.Array.csproj b/test/CadlRanchProjectsNonAzure/type/array/src/_Type._Array.csproj similarity index 65% rename from test/CadlRanchProjectsNonAzure/type/array/src/Type.Array.csproj rename to test/CadlRanchProjectsNonAzure/type/array/src/_Type._Array.csproj index 59d458b48d9..cb52795d209 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Type.Array.csproj +++ b/test/CadlRanchProjectsNonAzure/type/array/src/_Type._Array.csproj @@ -1,9 +1,9 @@ - This is the Type.Array client library for developing .NET applications with rich experience. - SDK Code Generation Type.Array + This is the _Type._Array client library for developing .NET applications with rich experience. + SDK Code Generation _Type._Array 1.0.0-beta.1 - Type.Array + _Type._Array netstandard2.0 latest true diff --git a/test/CadlRanchProjectsNonAzure/type/array/tests/Type.Array.Tests.csproj b/test/CadlRanchProjectsNonAzure/type/array/tests/_Type._Array.Tests.csproj similarity index 89% rename from test/CadlRanchProjectsNonAzure/type/array/tests/Type.Array.Tests.csproj rename to test/CadlRanchProjectsNonAzure/type/array/tests/_Type._Array.Tests.csproj index 86bfcf8c563..73514c94a04 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/tests/Type.Array.Tests.csproj +++ b/test/CadlRanchProjectsNonAzure/type/array/tests/_Type._Array.Tests.csproj @@ -6,7 +6,7 @@ - + diff --git a/test/CadlRanchProjectsNonAzure/type/array/tspconfig.yaml b/test/CadlRanchProjectsNonAzure/type/array/tspconfig.yaml new file mode 100644 index 00000000000..9118fe567de --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/array/tspconfig.yaml @@ -0,0 +1,3 @@ +options: + "@azure-tools/typespec-csharp": + namespace: _Type._Array From a3b6e77327ff8b7ab6f94f553517d3a9270e2ee0 Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Wed, 17 Apr 2024 15:09:16 +0800 Subject: [PATCH 07/19] try to fix the xml doc issue --- .../Common/Output/Models/Requests/RestClientMethod.cs | 2 +- .../LowLevel/Output/OperationMethodChainBuilder.cs | 2 +- .../type/array/src/Generated/BooleanValue.cs | 8 ++++---- .../type/array/src/Generated/DatetimeValue.cs | 8 ++++---- .../type/array/src/Generated/DurationValue.cs | 8 ++++---- .../type/array/src/Generated/Float32Value.cs | 8 ++++---- .../type/array/src/Generated/Int32Value.cs | 8 ++++---- .../type/array/src/Generated/Int64Value.cs | 8 ++++---- .../type/array/src/Generated/ModelValue.cs | 8 ++++---- .../type/array/src/Generated/NullableFloatValue.cs | 8 ++++---- .../type/array/src/Generated/StringValue.cs | 8 ++++---- .../type/array/src/Generated/UnknownValue.cs | 8 ++++---- .../type/array/src/Generated/BooleanValue.cs | 8 ++++---- .../type/array/src/Generated/DatetimeValue.cs | 8 ++++---- .../type/array/src/Generated/DurationValue.cs | 8 ++++---- .../type/array/src/Generated/Float32Value.cs | 8 ++++---- .../type/array/src/Generated/Int32Value.cs | 8 ++++---- .../type/array/src/Generated/Int64Value.cs | 8 ++++---- .../type/array/src/Generated/ModelValue.cs | 8 ++++---- .../type/array/src/Generated/NullableFloatValue.cs | 8 ++++---- .../type/array/src/Generated/StringValue.cs | 8 ++++---- .../type/array/src/Generated/UnknownValue.cs | 8 ++++---- 22 files changed, 82 insertions(+), 82 deletions(-) diff --git a/src/AutoRest.CSharp/Common/Output/Models/Requests/RestClientMethod.cs b/src/AutoRest.CSharp/Common/Output/Models/Requests/RestClientMethod.cs index 61ac6d5c7a5..98134576f19 100644 --- a/src/AutoRest.CSharp/Common/Output/Models/Requests/RestClientMethod.cs +++ b/src/AutoRest.CSharp/Common/Output/Models/Requests/RestClientMethod.cs @@ -23,7 +23,7 @@ public RestClientMethod(string name, string? summary, string? description, CShar Parameters = parameters; Responses = responses; Summary = summary; - Description = description; + Description = string.IsNullOrEmpty(description) ? $"The {name} method" : description; ReturnType = returnType; HeaderModel = headerModel; BufferResponse = bufferResponse; diff --git a/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs b/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs index 402b78d056e..681cb8b659b 100644 --- a/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs +++ b/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs @@ -397,7 +397,7 @@ private ReturnTypeChain BuildReturnTypes() accessibility &= ~Public; // removes public if any accessibility |= Internal; // add internal } - var convenienceSignature = new MethodSignature(name, FormattableStringHelpers.FromString(_restClientMethod.Summary ?? $"The {name} method"), FormattableStringHelpers.FromString(_restClientMethod.Description), accessibility, _returnType.Convenience, null, parameterList, attributes); + var convenienceSignature = new MethodSignature(name, FormattableStringHelpers.FromString(_restClientMethod.Summary), FormattableStringHelpers.FromString(_restClientMethod.Description), accessibility, _returnType.Convenience, null, parameterList, attributes); var diagnostic = Configuration.IsBranded ? name != _restClientMethod.Name ? new Diagnostic($"{_clientName}.{convenienceSignature.Name}") : null : null; diff --git a/test/CadlRanchProjects/type/array/src/Generated/BooleanValue.cs b/test/CadlRanchProjects/type/array/src/Generated/BooleanValue.cs index e0c06ec91b1..435bb60fa62 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/BooleanValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/BooleanValue.cs @@ -82,7 +82,7 @@ public virtual Response> GetBooleanValue(CancellationToken c } /// - /// [Protocol Method] + /// [Protocol Method] The GetBooleanValue method /// /// /// @@ -117,7 +117,7 @@ public virtual async Task GetBooleanValueAsync(RequestContext context) } /// - /// [Protocol Method] + /// [Protocol Method] The GetBooleanValue method /// /// /// @@ -182,7 +182,7 @@ public virtual Response Put(IEnumerable body, CancellationToken cancellati } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// @@ -221,7 +221,7 @@ public virtual async Task PutAsync(RequestContent content, RequestCont } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// diff --git a/test/CadlRanchProjects/type/array/src/Generated/DatetimeValue.cs b/test/CadlRanchProjects/type/array/src/Generated/DatetimeValue.cs index 9a3003591ca..9f988774089 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/DatetimeValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/DatetimeValue.cs @@ -82,7 +82,7 @@ public virtual Response> GetDatetimeValue(Cancella } /// - /// [Protocol Method] + /// [Protocol Method] The GetDatetimeValue method /// /// /// @@ -117,7 +117,7 @@ public virtual async Task GetDatetimeValueAsync(RequestContext context } /// - /// [Protocol Method] + /// [Protocol Method] The GetDatetimeValue method /// /// /// @@ -182,7 +182,7 @@ public virtual Response Put(IEnumerable body, CancellationToken } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// @@ -221,7 +221,7 @@ public virtual async Task PutAsync(RequestContent content, RequestCont } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// diff --git a/test/CadlRanchProjects/type/array/src/Generated/DurationValue.cs b/test/CadlRanchProjects/type/array/src/Generated/DurationValue.cs index aec17d473da..898b28a37c2 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/DurationValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/DurationValue.cs @@ -82,7 +82,7 @@ public virtual Response> GetDurationValue(CancellationTo } /// - /// [Protocol Method] + /// [Protocol Method] The GetDurationValue method /// /// /// @@ -117,7 +117,7 @@ public virtual async Task GetDurationValueAsync(RequestContext context } /// - /// [Protocol Method] + /// [Protocol Method] The GetDurationValue method /// /// /// @@ -182,7 +182,7 @@ public virtual Response Put(IEnumerable body, CancellationToken cancel } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// @@ -221,7 +221,7 @@ public virtual async Task PutAsync(RequestContent content, RequestCont } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// diff --git a/test/CadlRanchProjects/type/array/src/Generated/Float32Value.cs b/test/CadlRanchProjects/type/array/src/Generated/Float32Value.cs index e2fa019b8ad..9ec35f3400b 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/Float32Value.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/Float32Value.cs @@ -82,7 +82,7 @@ public virtual Response> GetFloat32Value(CancellationToken } /// - /// [Protocol Method] + /// [Protocol Method] The GetFloat32Value method /// /// /// @@ -117,7 +117,7 @@ public virtual async Task GetFloat32ValueAsync(RequestContext context) } /// - /// [Protocol Method] + /// [Protocol Method] The GetFloat32Value method /// /// /// @@ -182,7 +182,7 @@ public virtual Response Put(IEnumerable body, CancellationToken cancellat } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// @@ -221,7 +221,7 @@ public virtual async Task PutAsync(RequestContent content, RequestCont } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// diff --git a/test/CadlRanchProjects/type/array/src/Generated/Int32Value.cs b/test/CadlRanchProjects/type/array/src/Generated/Int32Value.cs index c096fb9e6c9..4cdd8f3d5d2 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/Int32Value.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/Int32Value.cs @@ -82,7 +82,7 @@ public virtual Response> GetInt32Value(CancellationToken canc } /// - /// [Protocol Method] + /// [Protocol Method] The GetInt32Value method /// /// /// @@ -117,7 +117,7 @@ public virtual async Task GetInt32ValueAsync(RequestContext context) } /// - /// [Protocol Method] + /// [Protocol Method] The GetInt32Value method /// /// /// @@ -182,7 +182,7 @@ public virtual Response Put(IEnumerable body, CancellationToken cancellatio } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// @@ -221,7 +221,7 @@ public virtual async Task PutAsync(RequestContent content, RequestCont } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// diff --git a/test/CadlRanchProjects/type/array/src/Generated/Int64Value.cs b/test/CadlRanchProjects/type/array/src/Generated/Int64Value.cs index b9d82a08a5a..9fbf2b2dff9 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/Int64Value.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/Int64Value.cs @@ -82,7 +82,7 @@ public virtual Response> GetInt64Value(CancellationToken can } /// - /// [Protocol Method] + /// [Protocol Method] The GetInt64Value method /// /// /// @@ -117,7 +117,7 @@ public virtual async Task GetInt64ValueAsync(RequestContext context) } /// - /// [Protocol Method] + /// [Protocol Method] The GetInt64Value method /// /// /// @@ -182,7 +182,7 @@ public virtual Response Put(IEnumerable body, CancellationToken cancellati } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// @@ -221,7 +221,7 @@ public virtual async Task PutAsync(RequestContent content, RequestCont } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// diff --git a/test/CadlRanchProjects/type/array/src/Generated/ModelValue.cs b/test/CadlRanchProjects/type/array/src/Generated/ModelValue.cs index c67acf39d9c..56986d58a65 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/ModelValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/ModelValue.cs @@ -83,7 +83,7 @@ public virtual Response> GetModelValue(CancellationTok } /// - /// [Protocol Method] + /// [Protocol Method] The GetModelValue method /// /// /// @@ -118,7 +118,7 @@ public virtual async Task GetModelValueAsync(RequestContext context) } /// - /// [Protocol Method] + /// [Protocol Method] The GetModelValue method /// /// /// @@ -183,7 +183,7 @@ public virtual Response Put(IEnumerable body, CancellationToken canc } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// @@ -222,7 +222,7 @@ public virtual async Task PutAsync(RequestContent content, RequestCont } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// diff --git a/test/CadlRanchProjects/type/array/src/Generated/NullableFloatValue.cs b/test/CadlRanchProjects/type/array/src/Generated/NullableFloatValue.cs index f8aff4f8119..1666540a962 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/NullableFloatValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/NullableFloatValue.cs @@ -96,7 +96,7 @@ internal NullableFloatValue(ClientDiagnostics clientDiagnostics, HttpPipeline pi } /// - /// [Protocol Method] + /// [Protocol Method] The GetNullableFloatValue method /// /// /// @@ -131,7 +131,7 @@ public virtual async Task GetNullableFloatValueAsync(RequestContext co } /// - /// [Protocol Method] + /// [Protocol Method] The GetNullableFloatValue method /// /// /// @@ -196,7 +196,7 @@ public virtual Response Put(IEnumerable body, CancellationToken cancella } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// @@ -235,7 +235,7 @@ public virtual async Task PutAsync(RequestContent content, RequestCont } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// diff --git a/test/CadlRanchProjects/type/array/src/Generated/StringValue.cs b/test/CadlRanchProjects/type/array/src/Generated/StringValue.cs index bc7f38d1ed8..d6cb510508e 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/StringValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/StringValue.cs @@ -82,7 +82,7 @@ public virtual Response> GetStringValue(CancellationToken } /// - /// [Protocol Method] + /// [Protocol Method] The GetStringValue method /// /// /// @@ -117,7 +117,7 @@ public virtual async Task GetStringValueAsync(RequestContext context) } /// - /// [Protocol Method] + /// [Protocol Method] The GetStringValue method /// /// /// @@ -182,7 +182,7 @@ public virtual Response Put(IEnumerable body, CancellationToken cancella } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// @@ -221,7 +221,7 @@ public virtual async Task PutAsync(RequestContent content, RequestCont } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// diff --git a/test/CadlRanchProjects/type/array/src/Generated/UnknownValue.cs b/test/CadlRanchProjects/type/array/src/Generated/UnknownValue.cs index d303f1bcfcf..7a06eb22f07 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/UnknownValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/UnknownValue.cs @@ -96,7 +96,7 @@ public virtual Response> GetUnknownValue(CancellationT } /// - /// [Protocol Method] + /// [Protocol Method] The GetUnknownValue method /// /// /// @@ -131,7 +131,7 @@ public virtual async Task GetUnknownValueAsync(RequestContext context) } /// - /// [Protocol Method] + /// [Protocol Method] The GetUnknownValue method /// /// /// @@ -196,7 +196,7 @@ public virtual Response Put(IEnumerable body, CancellationToken canc } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// @@ -235,7 +235,7 @@ public virtual async Task PutAsync(RequestContent content, RequestCont } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs index d1363bc6703..6712b995aa1 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs @@ -66,7 +66,7 @@ public virtual ClientResult> GetBooleanValue() } /// - /// [Protocol Method] + /// [Protocol Method] The GetBooleanValue method /// /// /// @@ -90,7 +90,7 @@ public virtual async Task GetBooleanValueAsync(RequestOptions opti } /// - /// [Protocol Method] + /// [Protocol Method] The GetBooleanValue method /// /// /// @@ -138,7 +138,7 @@ public virtual ClientResult Put(IEnumerable body) } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// @@ -166,7 +166,7 @@ public virtual async Task PutAsync(BinaryContent content, RequestO } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs index 816d3c5b53c..5495d04860d 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs @@ -66,7 +66,7 @@ public virtual ClientResult> GetDatetimeValue() } /// - /// [Protocol Method] + /// [Protocol Method] The GetDatetimeValue method /// /// /// @@ -90,7 +90,7 @@ public virtual async Task GetDatetimeValueAsync(RequestOptions opt } /// - /// [Protocol Method] + /// [Protocol Method] The GetDatetimeValue method /// /// /// @@ -138,7 +138,7 @@ public virtual ClientResult Put(IEnumerable body) } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// @@ -166,7 +166,7 @@ public virtual async Task PutAsync(BinaryContent content, RequestO } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs index df981105396..b569cf3ba9d 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs @@ -66,7 +66,7 @@ public virtual ClientResult> GetDurationValue() } /// - /// [Protocol Method] + /// [Protocol Method] The GetDurationValue method /// /// /// @@ -90,7 +90,7 @@ public virtual async Task GetDurationValueAsync(RequestOptions opt } /// - /// [Protocol Method] + /// [Protocol Method] The GetDurationValue method /// /// /// @@ -138,7 +138,7 @@ public virtual ClientResult Put(IEnumerable body) } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// @@ -166,7 +166,7 @@ public virtual async Task PutAsync(BinaryContent content, RequestO } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs index 1f45bb54bb1..3318a860111 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs @@ -66,7 +66,7 @@ public virtual ClientResult> GetFloat32Value() } /// - /// [Protocol Method] + /// [Protocol Method] The GetFloat32Value method /// /// /// @@ -90,7 +90,7 @@ public virtual async Task GetFloat32ValueAsync(RequestOptions opti } /// - /// [Protocol Method] + /// [Protocol Method] The GetFloat32Value method /// /// /// @@ -138,7 +138,7 @@ public virtual ClientResult Put(IEnumerable body) } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// @@ -166,7 +166,7 @@ public virtual async Task PutAsync(BinaryContent content, RequestO } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs index 0e8458e8134..f339f490d4f 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs @@ -66,7 +66,7 @@ public virtual ClientResult> GetInt32Value() } /// - /// [Protocol Method] + /// [Protocol Method] The GetInt32Value method /// /// /// @@ -90,7 +90,7 @@ public virtual async Task GetInt32ValueAsync(RequestOptions option } /// - /// [Protocol Method] + /// [Protocol Method] The GetInt32Value method /// /// /// @@ -138,7 +138,7 @@ public virtual ClientResult Put(IEnumerable body) } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// @@ -166,7 +166,7 @@ public virtual async Task PutAsync(BinaryContent content, RequestO } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs index dff532acddb..2f1ed57f801 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs @@ -66,7 +66,7 @@ public virtual ClientResult> GetInt64Value() } /// - /// [Protocol Method] + /// [Protocol Method] The GetInt64Value method /// /// /// @@ -90,7 +90,7 @@ public virtual async Task GetInt64ValueAsync(RequestOptions option } /// - /// [Protocol Method] + /// [Protocol Method] The GetInt64Value method /// /// /// @@ -138,7 +138,7 @@ public virtual ClientResult Put(IEnumerable body) } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// @@ -166,7 +166,7 @@ public virtual async Task PutAsync(BinaryContent content, RequestO } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs index 55d85f19855..f34ef8eaf02 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs @@ -67,7 +67,7 @@ public virtual ClientResult> GetModelValue() } /// - /// [Protocol Method] + /// [Protocol Method] The GetModelValue method /// /// /// @@ -91,7 +91,7 @@ public virtual async Task GetModelValueAsync(RequestOptions option } /// - /// [Protocol Method] + /// [Protocol Method] The GetModelValue method /// /// /// @@ -139,7 +139,7 @@ public virtual ClientResult Put(IEnumerable body) } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// @@ -167,7 +167,7 @@ public virtual async Task PutAsync(BinaryContent content, RequestO } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs index a11c550b31a..64044e48fb0 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs @@ -80,7 +80,7 @@ internal NullableFloatValue(ClientPipeline pipeline, Uri endpoint) } /// - /// [Protocol Method] + /// [Protocol Method] The GetNullableFloatValue method /// /// /// @@ -104,7 +104,7 @@ public virtual async Task GetNullableFloatValueAsync(RequestOption } /// - /// [Protocol Method] + /// [Protocol Method] The GetNullableFloatValue method /// /// /// @@ -152,7 +152,7 @@ public virtual ClientResult Put(IEnumerable body) } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// @@ -180,7 +180,7 @@ public virtual async Task PutAsync(BinaryContent content, RequestO } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs index 006cc3c6057..86ee0c437f4 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs @@ -66,7 +66,7 @@ public virtual ClientResult> GetStringValue() } /// - /// [Protocol Method] + /// [Protocol Method] The GetStringValue method /// /// /// @@ -90,7 +90,7 @@ public virtual async Task GetStringValueAsync(RequestOptions optio } /// - /// [Protocol Method] + /// [Protocol Method] The GetStringValue method /// /// /// @@ -138,7 +138,7 @@ public virtual ClientResult Put(IEnumerable body) } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// @@ -166,7 +166,7 @@ public virtual async Task PutAsync(BinaryContent content, RequestO } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs index 942f84d7951..6adf0ddeb8e 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs @@ -80,7 +80,7 @@ public virtual ClientResult> GetUnknownValue() } /// - /// [Protocol Method] + /// [Protocol Method] The GetUnknownValue method /// /// /// @@ -104,7 +104,7 @@ public virtual async Task GetUnknownValueAsync(RequestOptions opti } /// - /// [Protocol Method] + /// [Protocol Method] The GetUnknownValue method /// /// /// @@ -152,7 +152,7 @@ public virtual ClientResult Put(IEnumerable body) } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// @@ -180,7 +180,7 @@ public virtual async Task PutAsync(BinaryContent content, RequestO } /// - /// [Protocol Method] + /// [Protocol Method] The Put method /// /// /// From f0b827774f87c9003bbd2c806254cf78aa5135ce Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Wed, 17 Apr 2024 17:25:45 +0800 Subject: [PATCH 08/19] Revert "try to fix the xml doc issue" This reverts commit a3b6e77327ff8b7ab6f94f553517d3a9270e2ee0. --- .../Common/Output/Models/Requests/RestClientMethod.cs | 2 +- .../LowLevel/Output/OperationMethodChainBuilder.cs | 2 +- .../type/array/src/Generated/BooleanValue.cs | 8 ++++---- .../type/array/src/Generated/DatetimeValue.cs | 8 ++++---- .../type/array/src/Generated/DurationValue.cs | 8 ++++---- .../type/array/src/Generated/Float32Value.cs | 8 ++++---- .../type/array/src/Generated/Int32Value.cs | 8 ++++---- .../type/array/src/Generated/Int64Value.cs | 8 ++++---- .../type/array/src/Generated/ModelValue.cs | 8 ++++---- .../type/array/src/Generated/NullableFloatValue.cs | 8 ++++---- .../type/array/src/Generated/StringValue.cs | 8 ++++---- .../type/array/src/Generated/UnknownValue.cs | 8 ++++---- .../type/array/src/Generated/BooleanValue.cs | 8 ++++---- .../type/array/src/Generated/DatetimeValue.cs | 8 ++++---- .../type/array/src/Generated/DurationValue.cs | 8 ++++---- .../type/array/src/Generated/Float32Value.cs | 8 ++++---- .../type/array/src/Generated/Int32Value.cs | 8 ++++---- .../type/array/src/Generated/Int64Value.cs | 8 ++++---- .../type/array/src/Generated/ModelValue.cs | 8 ++++---- .../type/array/src/Generated/NullableFloatValue.cs | 8 ++++---- .../type/array/src/Generated/StringValue.cs | 8 ++++---- .../type/array/src/Generated/UnknownValue.cs | 8 ++++---- 22 files changed, 82 insertions(+), 82 deletions(-) diff --git a/src/AutoRest.CSharp/Common/Output/Models/Requests/RestClientMethod.cs b/src/AutoRest.CSharp/Common/Output/Models/Requests/RestClientMethod.cs index 98134576f19..61ac6d5c7a5 100644 --- a/src/AutoRest.CSharp/Common/Output/Models/Requests/RestClientMethod.cs +++ b/src/AutoRest.CSharp/Common/Output/Models/Requests/RestClientMethod.cs @@ -23,7 +23,7 @@ public RestClientMethod(string name, string? summary, string? description, CShar Parameters = parameters; Responses = responses; Summary = summary; - Description = string.IsNullOrEmpty(description) ? $"The {name} method" : description; + Description = description; ReturnType = returnType; HeaderModel = headerModel; BufferResponse = bufferResponse; diff --git a/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs b/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs index 681cb8b659b..402b78d056e 100644 --- a/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs +++ b/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs @@ -397,7 +397,7 @@ private ReturnTypeChain BuildReturnTypes() accessibility &= ~Public; // removes public if any accessibility |= Internal; // add internal } - var convenienceSignature = new MethodSignature(name, FormattableStringHelpers.FromString(_restClientMethod.Summary), FormattableStringHelpers.FromString(_restClientMethod.Description), accessibility, _returnType.Convenience, null, parameterList, attributes); + var convenienceSignature = new MethodSignature(name, FormattableStringHelpers.FromString(_restClientMethod.Summary ?? $"The {name} method"), FormattableStringHelpers.FromString(_restClientMethod.Description), accessibility, _returnType.Convenience, null, parameterList, attributes); var diagnostic = Configuration.IsBranded ? name != _restClientMethod.Name ? new Diagnostic($"{_clientName}.{convenienceSignature.Name}") : null : null; diff --git a/test/CadlRanchProjects/type/array/src/Generated/BooleanValue.cs b/test/CadlRanchProjects/type/array/src/Generated/BooleanValue.cs index 435bb60fa62..e0c06ec91b1 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/BooleanValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/BooleanValue.cs @@ -82,7 +82,7 @@ public virtual Response> GetBooleanValue(CancellationToken c } /// - /// [Protocol Method] The GetBooleanValue method + /// [Protocol Method] /// /// /// @@ -117,7 +117,7 @@ public virtual async Task GetBooleanValueAsync(RequestContext context) } /// - /// [Protocol Method] The GetBooleanValue method + /// [Protocol Method] /// /// /// @@ -182,7 +182,7 @@ public virtual Response Put(IEnumerable body, CancellationToken cancellati } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// @@ -221,7 +221,7 @@ public virtual async Task PutAsync(RequestContent content, RequestCont } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// diff --git a/test/CadlRanchProjects/type/array/src/Generated/DatetimeValue.cs b/test/CadlRanchProjects/type/array/src/Generated/DatetimeValue.cs index 9f988774089..9a3003591ca 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/DatetimeValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/DatetimeValue.cs @@ -82,7 +82,7 @@ public virtual Response> GetDatetimeValue(Cancella } /// - /// [Protocol Method] The GetDatetimeValue method + /// [Protocol Method] /// /// /// @@ -117,7 +117,7 @@ public virtual async Task GetDatetimeValueAsync(RequestContext context } /// - /// [Protocol Method] The GetDatetimeValue method + /// [Protocol Method] /// /// /// @@ -182,7 +182,7 @@ public virtual Response Put(IEnumerable body, CancellationToken } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// @@ -221,7 +221,7 @@ public virtual async Task PutAsync(RequestContent content, RequestCont } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// diff --git a/test/CadlRanchProjects/type/array/src/Generated/DurationValue.cs b/test/CadlRanchProjects/type/array/src/Generated/DurationValue.cs index 898b28a37c2..aec17d473da 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/DurationValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/DurationValue.cs @@ -82,7 +82,7 @@ public virtual Response> GetDurationValue(CancellationTo } /// - /// [Protocol Method] The GetDurationValue method + /// [Protocol Method] /// /// /// @@ -117,7 +117,7 @@ public virtual async Task GetDurationValueAsync(RequestContext context } /// - /// [Protocol Method] The GetDurationValue method + /// [Protocol Method] /// /// /// @@ -182,7 +182,7 @@ public virtual Response Put(IEnumerable body, CancellationToken cancel } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// @@ -221,7 +221,7 @@ public virtual async Task PutAsync(RequestContent content, RequestCont } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// diff --git a/test/CadlRanchProjects/type/array/src/Generated/Float32Value.cs b/test/CadlRanchProjects/type/array/src/Generated/Float32Value.cs index 9ec35f3400b..e2fa019b8ad 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/Float32Value.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/Float32Value.cs @@ -82,7 +82,7 @@ public virtual Response> GetFloat32Value(CancellationToken } /// - /// [Protocol Method] The GetFloat32Value method + /// [Protocol Method] /// /// /// @@ -117,7 +117,7 @@ public virtual async Task GetFloat32ValueAsync(RequestContext context) } /// - /// [Protocol Method] The GetFloat32Value method + /// [Protocol Method] /// /// /// @@ -182,7 +182,7 @@ public virtual Response Put(IEnumerable body, CancellationToken cancellat } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// @@ -221,7 +221,7 @@ public virtual async Task PutAsync(RequestContent content, RequestCont } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// diff --git a/test/CadlRanchProjects/type/array/src/Generated/Int32Value.cs b/test/CadlRanchProjects/type/array/src/Generated/Int32Value.cs index 4cdd8f3d5d2..c096fb9e6c9 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/Int32Value.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/Int32Value.cs @@ -82,7 +82,7 @@ public virtual Response> GetInt32Value(CancellationToken canc } /// - /// [Protocol Method] The GetInt32Value method + /// [Protocol Method] /// /// /// @@ -117,7 +117,7 @@ public virtual async Task GetInt32ValueAsync(RequestContext context) } /// - /// [Protocol Method] The GetInt32Value method + /// [Protocol Method] /// /// /// @@ -182,7 +182,7 @@ public virtual Response Put(IEnumerable body, CancellationToken cancellatio } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// @@ -221,7 +221,7 @@ public virtual async Task PutAsync(RequestContent content, RequestCont } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// diff --git a/test/CadlRanchProjects/type/array/src/Generated/Int64Value.cs b/test/CadlRanchProjects/type/array/src/Generated/Int64Value.cs index 9fbf2b2dff9..b9d82a08a5a 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/Int64Value.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/Int64Value.cs @@ -82,7 +82,7 @@ public virtual Response> GetInt64Value(CancellationToken can } /// - /// [Protocol Method] The GetInt64Value method + /// [Protocol Method] /// /// /// @@ -117,7 +117,7 @@ public virtual async Task GetInt64ValueAsync(RequestContext context) } /// - /// [Protocol Method] The GetInt64Value method + /// [Protocol Method] /// /// /// @@ -182,7 +182,7 @@ public virtual Response Put(IEnumerable body, CancellationToken cancellati } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// @@ -221,7 +221,7 @@ public virtual async Task PutAsync(RequestContent content, RequestCont } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// diff --git a/test/CadlRanchProjects/type/array/src/Generated/ModelValue.cs b/test/CadlRanchProjects/type/array/src/Generated/ModelValue.cs index 56986d58a65..c67acf39d9c 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/ModelValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/ModelValue.cs @@ -83,7 +83,7 @@ public virtual Response> GetModelValue(CancellationTok } /// - /// [Protocol Method] The GetModelValue method + /// [Protocol Method] /// /// /// @@ -118,7 +118,7 @@ public virtual async Task GetModelValueAsync(RequestContext context) } /// - /// [Protocol Method] The GetModelValue method + /// [Protocol Method] /// /// /// @@ -183,7 +183,7 @@ public virtual Response Put(IEnumerable body, CancellationToken canc } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// @@ -222,7 +222,7 @@ public virtual async Task PutAsync(RequestContent content, RequestCont } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// diff --git a/test/CadlRanchProjects/type/array/src/Generated/NullableFloatValue.cs b/test/CadlRanchProjects/type/array/src/Generated/NullableFloatValue.cs index 1666540a962..f8aff4f8119 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/NullableFloatValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/NullableFloatValue.cs @@ -96,7 +96,7 @@ internal NullableFloatValue(ClientDiagnostics clientDiagnostics, HttpPipeline pi } /// - /// [Protocol Method] The GetNullableFloatValue method + /// [Protocol Method] /// /// /// @@ -131,7 +131,7 @@ public virtual async Task GetNullableFloatValueAsync(RequestContext co } /// - /// [Protocol Method] The GetNullableFloatValue method + /// [Protocol Method] /// /// /// @@ -196,7 +196,7 @@ public virtual Response Put(IEnumerable body, CancellationToken cancella } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// @@ -235,7 +235,7 @@ public virtual async Task PutAsync(RequestContent content, RequestCont } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// diff --git a/test/CadlRanchProjects/type/array/src/Generated/StringValue.cs b/test/CadlRanchProjects/type/array/src/Generated/StringValue.cs index d6cb510508e..bc7f38d1ed8 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/StringValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/StringValue.cs @@ -82,7 +82,7 @@ public virtual Response> GetStringValue(CancellationToken } /// - /// [Protocol Method] The GetStringValue method + /// [Protocol Method] /// /// /// @@ -117,7 +117,7 @@ public virtual async Task GetStringValueAsync(RequestContext context) } /// - /// [Protocol Method] The GetStringValue method + /// [Protocol Method] /// /// /// @@ -182,7 +182,7 @@ public virtual Response Put(IEnumerable body, CancellationToken cancella } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// @@ -221,7 +221,7 @@ public virtual async Task PutAsync(RequestContent content, RequestCont } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// diff --git a/test/CadlRanchProjects/type/array/src/Generated/UnknownValue.cs b/test/CadlRanchProjects/type/array/src/Generated/UnknownValue.cs index 7a06eb22f07..d303f1bcfcf 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/UnknownValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/UnknownValue.cs @@ -96,7 +96,7 @@ public virtual Response> GetUnknownValue(CancellationT } /// - /// [Protocol Method] The GetUnknownValue method + /// [Protocol Method] /// /// /// @@ -131,7 +131,7 @@ public virtual async Task GetUnknownValueAsync(RequestContext context) } /// - /// [Protocol Method] The GetUnknownValue method + /// [Protocol Method] /// /// /// @@ -196,7 +196,7 @@ public virtual Response Put(IEnumerable body, CancellationToken canc } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// @@ -235,7 +235,7 @@ public virtual async Task PutAsync(RequestContent content, RequestCont } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs index 6712b995aa1..d1363bc6703 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs @@ -66,7 +66,7 @@ public virtual ClientResult> GetBooleanValue() } /// - /// [Protocol Method] The GetBooleanValue method + /// [Protocol Method] /// /// /// @@ -90,7 +90,7 @@ public virtual async Task GetBooleanValueAsync(RequestOptions opti } /// - /// [Protocol Method] The GetBooleanValue method + /// [Protocol Method] /// /// /// @@ -138,7 +138,7 @@ public virtual ClientResult Put(IEnumerable body) } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// @@ -166,7 +166,7 @@ public virtual async Task PutAsync(BinaryContent content, RequestO } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs index 5495d04860d..816d3c5b53c 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs @@ -66,7 +66,7 @@ public virtual ClientResult> GetDatetimeValue() } /// - /// [Protocol Method] The GetDatetimeValue method + /// [Protocol Method] /// /// /// @@ -90,7 +90,7 @@ public virtual async Task GetDatetimeValueAsync(RequestOptions opt } /// - /// [Protocol Method] The GetDatetimeValue method + /// [Protocol Method] /// /// /// @@ -138,7 +138,7 @@ public virtual ClientResult Put(IEnumerable body) } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// @@ -166,7 +166,7 @@ public virtual async Task PutAsync(BinaryContent content, RequestO } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs index b569cf3ba9d..df981105396 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs @@ -66,7 +66,7 @@ public virtual ClientResult> GetDurationValue() } /// - /// [Protocol Method] The GetDurationValue method + /// [Protocol Method] /// /// /// @@ -90,7 +90,7 @@ public virtual async Task GetDurationValueAsync(RequestOptions opt } /// - /// [Protocol Method] The GetDurationValue method + /// [Protocol Method] /// /// /// @@ -138,7 +138,7 @@ public virtual ClientResult Put(IEnumerable body) } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// @@ -166,7 +166,7 @@ public virtual async Task PutAsync(BinaryContent content, RequestO } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs index 3318a860111..1f45bb54bb1 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs @@ -66,7 +66,7 @@ public virtual ClientResult> GetFloat32Value() } /// - /// [Protocol Method] The GetFloat32Value method + /// [Protocol Method] /// /// /// @@ -90,7 +90,7 @@ public virtual async Task GetFloat32ValueAsync(RequestOptions opti } /// - /// [Protocol Method] The GetFloat32Value method + /// [Protocol Method] /// /// /// @@ -138,7 +138,7 @@ public virtual ClientResult Put(IEnumerable body) } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// @@ -166,7 +166,7 @@ public virtual async Task PutAsync(BinaryContent content, RequestO } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs index f339f490d4f..0e8458e8134 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs @@ -66,7 +66,7 @@ public virtual ClientResult> GetInt32Value() } /// - /// [Protocol Method] The GetInt32Value method + /// [Protocol Method] /// /// /// @@ -90,7 +90,7 @@ public virtual async Task GetInt32ValueAsync(RequestOptions option } /// - /// [Protocol Method] The GetInt32Value method + /// [Protocol Method] /// /// /// @@ -138,7 +138,7 @@ public virtual ClientResult Put(IEnumerable body) } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// @@ -166,7 +166,7 @@ public virtual async Task PutAsync(BinaryContent content, RequestO } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs index 2f1ed57f801..dff532acddb 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs @@ -66,7 +66,7 @@ public virtual ClientResult> GetInt64Value() } /// - /// [Protocol Method] The GetInt64Value method + /// [Protocol Method] /// /// /// @@ -90,7 +90,7 @@ public virtual async Task GetInt64ValueAsync(RequestOptions option } /// - /// [Protocol Method] The GetInt64Value method + /// [Protocol Method] /// /// /// @@ -138,7 +138,7 @@ public virtual ClientResult Put(IEnumerable body) } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// @@ -166,7 +166,7 @@ public virtual async Task PutAsync(BinaryContent content, RequestO } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs index f34ef8eaf02..55d85f19855 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs @@ -67,7 +67,7 @@ public virtual ClientResult> GetModelValue() } /// - /// [Protocol Method] The GetModelValue method + /// [Protocol Method] /// /// /// @@ -91,7 +91,7 @@ public virtual async Task GetModelValueAsync(RequestOptions option } /// - /// [Protocol Method] The GetModelValue method + /// [Protocol Method] /// /// /// @@ -139,7 +139,7 @@ public virtual ClientResult Put(IEnumerable body) } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// @@ -167,7 +167,7 @@ public virtual async Task PutAsync(BinaryContent content, RequestO } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs index 64044e48fb0..a11c550b31a 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs @@ -80,7 +80,7 @@ internal NullableFloatValue(ClientPipeline pipeline, Uri endpoint) } /// - /// [Protocol Method] The GetNullableFloatValue method + /// [Protocol Method] /// /// /// @@ -104,7 +104,7 @@ public virtual async Task GetNullableFloatValueAsync(RequestOption } /// - /// [Protocol Method] The GetNullableFloatValue method + /// [Protocol Method] /// /// /// @@ -152,7 +152,7 @@ public virtual ClientResult Put(IEnumerable body) } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// @@ -180,7 +180,7 @@ public virtual async Task PutAsync(BinaryContent content, RequestO } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs index 86ee0c437f4..006cc3c6057 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs @@ -66,7 +66,7 @@ public virtual ClientResult> GetStringValue() } /// - /// [Protocol Method] The GetStringValue method + /// [Protocol Method] /// /// /// @@ -90,7 +90,7 @@ public virtual async Task GetStringValueAsync(RequestOptions optio } /// - /// [Protocol Method] The GetStringValue method + /// [Protocol Method] /// /// /// @@ -138,7 +138,7 @@ public virtual ClientResult Put(IEnumerable body) } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// @@ -166,7 +166,7 @@ public virtual async Task PutAsync(BinaryContent content, RequestO } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs index 6adf0ddeb8e..942f84d7951 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs @@ -80,7 +80,7 @@ public virtual ClientResult> GetUnknownValue() } /// - /// [Protocol Method] The GetUnknownValue method + /// [Protocol Method] /// /// /// @@ -104,7 +104,7 @@ public virtual async Task GetUnknownValueAsync(RequestOptions opti } /// - /// [Protocol Method] The GetUnknownValue method + /// [Protocol Method] /// /// /// @@ -152,7 +152,7 @@ public virtual ClientResult Put(IEnumerable body) } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// @@ -180,7 +180,7 @@ public virtual async Task PutAsync(BinaryContent content, RequestO } /// - /// [Protocol Method] The Put method + /// [Protocol Method] /// /// /// From 2fa55e22aa35c863fb5f5f4b1d3292548458f2e0 Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Wed, 17 Apr 2024 17:33:44 +0800 Subject: [PATCH 09/19] include type/dictionary case --- eng/testProjects.json | 1 + .../Properties/launchSettings.json | 4 + .../type/dictionary/Type.Dictionary.sln | 50 + .../dictionary/src/Generated/BooleanValue.cs | 239 ++ .../src/Generated/Configuration.json | 10 + .../dictionary/src/Generated/DatetimeValue.cs | 239 ++ .../src/Generated/DictionaryClient.cs | 117 + .../src/Generated/DictionaryClientOptions.cs | 13 + .../dictionary/src/Generated/DurationValue.cs | 239 ++ .../dictionary/src/Generated/Float32Value.cs | 239 ++ .../dictionary/src/Generated/Int32Value.cs | 239 ++ .../dictionary/src/Generated/Int64Value.cs | 239 ++ .../src/Generated/Internal/Argument.cs | 126 + .../Generated/Internal/BinaryContentHelper.cs | 119 + .../Internal/ChangeTrackingDictionary.cs | 164 ++ .../Generated/Internal/ChangeTrackingList.cs | 150 ++ .../Internal/ClientPipelineExtensions.cs | 65 + .../Generated/Internal/ClientUriBuilder.cs | 210 ++ .../src/Generated/Internal/ErrorResult.cs | 23 + .../Internal/ModelSerializationExtensions.cs | 391 +++ .../src/Generated/Internal/Optional.cs | 48 + .../Internal/Utf8JsonBinaryContent.cs | 52 + .../dictionary/src/Generated/ModelValue.cs | 240 ++ .../Models/InnerModel.Serialization.cs | 154 ++ .../src/Generated/Models/InnerModel.cs | 77 + .../src/Generated/NullableFloatValue.cs | 253 ++ .../src/Generated/RecursiveModelValue.cs | 240 ++ .../dictionary/src/Generated/StringValue.cs | 239 ++ .../dictionary/src/Generated/UnknownValue.cs | 253 ++ .../src/Generated/tspCodeModel.json | 2340 +++++++++++++++++ .../dictionary/src/Properties/AssemblyInfo.cs | 6 + .../dictionary/src/Type.Dictionary.csproj | 16 + .../tests/Type.Dictionary.Tests.csproj | 18 + .../src/Generated/tspCodeModel.json | 133 +- 34 files changed, 6943 insertions(+), 3 deletions(-) create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/Type.Dictionary.sln create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/BooleanValue.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Configuration.json create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DatetimeValue.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClient.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClientOptions.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DurationValue.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Float32Value.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int32Value.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int64Value.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Argument.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/BinaryContentHelper.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientPipelineExtensions.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientUriBuilder.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ErrorResult.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Optional.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Utf8JsonBinaryContent.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/ModelValue.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.Serialization.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/NullableFloatValue.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/RecursiveModelValue.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/StringValue.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/UnknownValue.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/tspCodeModel.json create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Properties/AssemblyInfo.cs create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/src/Type.Dictionary.csproj create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/tests/Type.Dictionary.Tests.csproj diff --git a/eng/testProjects.json b/eng/testProjects.json index 032e89aa23f..9102de1e080 100644 --- a/eng/testProjects.json +++ b/eng/testProjects.json @@ -53,6 +53,7 @@ ], "CadlRanchProjectsNonAzure":[ "type/array", + "type/dictionary", "authentication/http/custom" ], "TestServerProjects": [ diff --git a/src/AutoRest.CSharp/Properties/launchSettings.json b/src/AutoRest.CSharp/Properties/launchSettings.json index 1746a416015..fed4b3ccd14 100644 --- a/src/AutoRest.CSharp/Properties/launchSettings.json +++ b/src/AutoRest.CSharp/Properties/launchSettings.json @@ -692,6 +692,10 @@ "commandName": "Project", "commandLineArgs": "--standalone $(SolutionDir)\\test\\CadlRanchProjectsNonAzure\\type\\array\\src\\Generated -n" }, + "typespec-nonAzure-type/dictionary": { + "commandName": "Project", + "commandLineArgs": "--standalone $(SolutionDir)\\test\\CadlRanchProjectsNonAzure\\type\\dictionary\\src\\Generated -n" + }, "typespec-parameters/body-optionality": { "commandName": "Project", "commandLineArgs": "--standalone $(SolutionDir)\\test\\CadlRanchProjects\\parameters\\body-optionality\\src\\Generated -n" diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/Type.Dictionary.sln b/test/CadlRanchProjectsNonAzure/type/dictionary/Type.Dictionary.sln new file mode 100644 index 00000000000..ec6661476a8 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/Type.Dictionary.sln @@ -0,0 +1,50 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Type.Dictionary", "src\Type.Dictionary.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Type.Dictionary.Tests", "tests\Type.Dictionary.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/BooleanValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/BooleanValue.cs new file mode 100644 index 00000000000..f3bd2fbae31 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/BooleanValue.cs @@ -0,0 +1,239 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; + +namespace Type.Dictionary +{ + // Data plane generated sub-client. + /// Dictionary of boolean values. + public partial class BooleanValue + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of BooleanValue for mocking. + protected BooleanValue() + { + } + + /// Initializes a new instance of BooleanValue. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// TestServer endpoint. + internal BooleanValue(ClientPipeline pipeline, Uri endpoint) + { + _pipeline = pipeline; + _endpoint = endpoint; + } + + /// The GetBooleanValue method. + public virtual async Task>> GetBooleanValueAsync() + { + ClientResult result = await GetBooleanValueAsync(null).ConfigureAwait(false); + IReadOnlyDictionary value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + dictionary.Add(property.Name, property.Value.GetBoolean()); + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// The GetBooleanValue method. + public virtual ClientResult> GetBooleanValue() + { + ClientResult result = GetBooleanValue(null); + IReadOnlyDictionary value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + dictionary.Add(property.Name, property.Value.GetBoolean()); + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetBooleanValueAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetBooleanValueRequest(options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetBooleanValue(RequestOptions options) + { + using PipelineMessage message = CreateGetBooleanValueRequest(options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type to use. + /// is null. + public virtual async Task PutAsync(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = await PutAsync(content, null).ConfigureAwait(false); + return result; + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type to use. + /// is null. + public virtual ClientResult Put(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = Put(content, null); + return result; + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + internal PipelineMessage CreateGetBooleanValueRequest(RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "GET"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/boolean", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + if (options != null) + { + message.Apply(options); + } + return message; + } + + internal PipelineMessage CreatePutRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/boolean", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier _pipelineMessageClassifier204; + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Configuration.json b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Configuration.json new file mode 100644 index 00000000000..5ff5292abac --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Configuration.json @@ -0,0 +1,10 @@ +{ + "output-folder": ".", + "namespace": "Type.Dictionary", + "library-name": "Type.Dictionary", + "shared-source-folders": [ + "../../../../../../artifacts/bin/AutoRest.CSharp/Debug/net7.0/Generator.Shared", + "../../../../../../artifacts/bin/AutoRest.CSharp/Debug/net7.0/Azure.Core.Shared" + ], + "use-model-reader-writer": true +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DatetimeValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DatetimeValue.cs new file mode 100644 index 00000000000..5a0c035d70a --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DatetimeValue.cs @@ -0,0 +1,239 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; + +namespace Type.Dictionary +{ + // Data plane generated sub-client. + /// Dictionary of datetime values. + public partial class DatetimeValue + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of DatetimeValue for mocking. + protected DatetimeValue() + { + } + + /// Initializes a new instance of DatetimeValue. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// TestServer endpoint. + internal DatetimeValue(ClientPipeline pipeline, Uri endpoint) + { + _pipeline = pipeline; + _endpoint = endpoint; + } + + /// The GetDatetimeValue method. + public virtual async Task>> GetDatetimeValueAsync() + { + ClientResult result = await GetDatetimeValueAsync(null).ConfigureAwait(false); + IReadOnlyDictionary value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + dictionary.Add(property.Name, property.Value.GetDateTimeOffset("O")); + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// The GetDatetimeValue method. + public virtual ClientResult> GetDatetimeValue() + { + ClientResult result = GetDatetimeValue(null); + IReadOnlyDictionary value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + dictionary.Add(property.Name, property.Value.GetDateTimeOffset("O")); + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetDatetimeValueAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetDatetimeValueRequest(options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetDatetimeValue(RequestOptions options) + { + using PipelineMessage message = CreateGetDatetimeValueRequest(options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type to use. + /// is null. + public virtual async Task PutAsync(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = await PutAsync(content, null).ConfigureAwait(false); + return result; + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type to use. + /// is null. + public virtual ClientResult Put(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = Put(content, null); + return result; + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + internal PipelineMessage CreateGetDatetimeValueRequest(RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "GET"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/datetime", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + if (options != null) + { + message.Apply(options); + } + return message; + } + + internal PipelineMessage CreatePutRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/datetime", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier _pipelineMessageClassifier204; + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClient.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClient.cs new file mode 100644 index 00000000000..d4eb7adfc4b --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClient.cs @@ -0,0 +1,117 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Threading; + +namespace Type.Dictionary +{ + // Data plane generated client. + /// The Dictionary service client. + public partial class DictionaryClient + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of DictionaryClient. + public DictionaryClient() : this(new Uri("http://localhost:3000"), new DictionaryClientOptions()) + { + } + + /// Initializes a new instance of DictionaryClient. + /// TestServer endpoint. + /// The options for configuring the client. + /// is null. + public DictionaryClient(Uri endpoint, DictionaryClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new DictionaryClientOptions(); + + _pipeline = ClientPipeline.Create(options, Array.Empty(), Array.Empty(), Array.Empty()); + _endpoint = endpoint; + } + + private Int32Value _cachedInt32Value; + private Int64Value _cachedInt64Value; + private BooleanValue _cachedBooleanValue; + private StringValue _cachedStringValue; + private Float32Value _cachedFloat32Value; + private DatetimeValue _cachedDatetimeValue; + private DurationValue _cachedDurationValue; + private UnknownValue _cachedUnknownValue; + private ModelValue _cachedModelValue; + private RecursiveModelValue _cachedRecursiveModelValue; + private NullableFloatValue _cachedNullableFloatValue; + + /// Initializes a new instance of Int32Value. + public virtual Int32Value GetInt32ValueClient() + { + return Volatile.Read(ref _cachedInt32Value) ?? Interlocked.CompareExchange(ref _cachedInt32Value, new Int32Value(_pipeline, _endpoint), null) ?? _cachedInt32Value; + } + + /// Initializes a new instance of Int64Value. + public virtual Int64Value GetInt64ValueClient() + { + return Volatile.Read(ref _cachedInt64Value) ?? Interlocked.CompareExchange(ref _cachedInt64Value, new Int64Value(_pipeline, _endpoint), null) ?? _cachedInt64Value; + } + + /// Initializes a new instance of BooleanValue. + public virtual BooleanValue GetBooleanValueClient() + { + return Volatile.Read(ref _cachedBooleanValue) ?? Interlocked.CompareExchange(ref _cachedBooleanValue, new BooleanValue(_pipeline, _endpoint), null) ?? _cachedBooleanValue; + } + + /// Initializes a new instance of StringValue. + public virtual StringValue GetStringValueClient() + { + return Volatile.Read(ref _cachedStringValue) ?? Interlocked.CompareExchange(ref _cachedStringValue, new StringValue(_pipeline, _endpoint), null) ?? _cachedStringValue; + } + + /// Initializes a new instance of Float32Value. + public virtual Float32Value GetFloat32ValueClient() + { + return Volatile.Read(ref _cachedFloat32Value) ?? Interlocked.CompareExchange(ref _cachedFloat32Value, new Float32Value(_pipeline, _endpoint), null) ?? _cachedFloat32Value; + } + + /// Initializes a new instance of DatetimeValue. + public virtual DatetimeValue GetDatetimeValueClient() + { + return Volatile.Read(ref _cachedDatetimeValue) ?? Interlocked.CompareExchange(ref _cachedDatetimeValue, new DatetimeValue(_pipeline, _endpoint), null) ?? _cachedDatetimeValue; + } + + /// Initializes a new instance of DurationValue. + public virtual DurationValue GetDurationValueClient() + { + return Volatile.Read(ref _cachedDurationValue) ?? Interlocked.CompareExchange(ref _cachedDurationValue, new DurationValue(_pipeline, _endpoint), null) ?? _cachedDurationValue; + } + + /// Initializes a new instance of UnknownValue. + public virtual UnknownValue GetUnknownValueClient() + { + return Volatile.Read(ref _cachedUnknownValue) ?? Interlocked.CompareExchange(ref _cachedUnknownValue, new UnknownValue(_pipeline, _endpoint), null) ?? _cachedUnknownValue; + } + + /// Initializes a new instance of ModelValue. + public virtual ModelValue GetModelValueClient() + { + return Volatile.Read(ref _cachedModelValue) ?? Interlocked.CompareExchange(ref _cachedModelValue, new ModelValue(_pipeline, _endpoint), null) ?? _cachedModelValue; + } + + /// Initializes a new instance of RecursiveModelValue. + public virtual RecursiveModelValue GetRecursiveModelValueClient() + { + return Volatile.Read(ref _cachedRecursiveModelValue) ?? Interlocked.CompareExchange(ref _cachedRecursiveModelValue, new RecursiveModelValue(_pipeline, _endpoint), null) ?? _cachedRecursiveModelValue; + } + + /// Initializes a new instance of NullableFloatValue. + public virtual NullableFloatValue GetNullableFloatValueClient() + { + return Volatile.Read(ref _cachedNullableFloatValue) ?? Interlocked.CompareExchange(ref _cachedNullableFloatValue, new NullableFloatValue(_pipeline, _endpoint), null) ?? _cachedNullableFloatValue; + } + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClientOptions.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClientOptions.cs new file mode 100644 index 00000000000..c8ed98b06d5 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClientOptions.cs @@ -0,0 +1,13 @@ +// + +#nullable disable + +using System.ClientModel.Primitives; + +namespace Type.Dictionary +{ + /// Client options for DictionaryClient. + public partial class DictionaryClientOptions : ClientPipelineOptions + { + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DurationValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DurationValue.cs new file mode 100644 index 00000000000..fece3c4adc8 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DurationValue.cs @@ -0,0 +1,239 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; + +namespace Type.Dictionary +{ + // Data plane generated sub-client. + /// Dictionary of duration values. + public partial class DurationValue + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of DurationValue for mocking. + protected DurationValue() + { + } + + /// Initializes a new instance of DurationValue. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// TestServer endpoint. + internal DurationValue(ClientPipeline pipeline, Uri endpoint) + { + _pipeline = pipeline; + _endpoint = endpoint; + } + + /// The GetDurationValue method. + public virtual async Task>> GetDurationValueAsync() + { + ClientResult result = await GetDurationValueAsync(null).ConfigureAwait(false); + IReadOnlyDictionary value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + dictionary.Add(property.Name, property.Value.GetTimeSpan("P")); + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// The GetDurationValue method. + public virtual ClientResult> GetDurationValue() + { + ClientResult result = GetDurationValue(null); + IReadOnlyDictionary value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + dictionary.Add(property.Name, property.Value.GetTimeSpan("P")); + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetDurationValueAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetDurationValueRequest(options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetDurationValue(RequestOptions options) + { + using PipelineMessage message = CreateGetDurationValueRequest(options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type to use. + /// is null. + public virtual async Task PutAsync(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = await PutAsync(content, null).ConfigureAwait(false); + return result; + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type to use. + /// is null. + public virtual ClientResult Put(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = Put(content, null); + return result; + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + internal PipelineMessage CreateGetDurationValueRequest(RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "GET"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/duration", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + if (options != null) + { + message.Apply(options); + } + return message; + } + + internal PipelineMessage CreatePutRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/duration", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier _pipelineMessageClassifier204; + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Float32Value.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Float32Value.cs new file mode 100644 index 00000000000..8371c4a006b --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Float32Value.cs @@ -0,0 +1,239 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; + +namespace Type.Dictionary +{ + // Data plane generated sub-client. + /// Dictionary of float values. + public partial class Float32Value + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of Float32Value for mocking. + protected Float32Value() + { + } + + /// Initializes a new instance of Float32Value. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// TestServer endpoint. + internal Float32Value(ClientPipeline pipeline, Uri endpoint) + { + _pipeline = pipeline; + _endpoint = endpoint; + } + + /// The GetFloat32Value method. + public virtual async Task>> GetFloat32ValueAsync() + { + ClientResult result = await GetFloat32ValueAsync(null).ConfigureAwait(false); + IReadOnlyDictionary value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + dictionary.Add(property.Name, property.Value.GetSingle()); + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// The GetFloat32Value method. + public virtual ClientResult> GetFloat32Value() + { + ClientResult result = GetFloat32Value(null); + IReadOnlyDictionary value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + dictionary.Add(property.Name, property.Value.GetSingle()); + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetFloat32ValueAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetFloat32ValueRequest(options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetFloat32Value(RequestOptions options) + { + using PipelineMessage message = CreateGetFloat32ValueRequest(options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type to use. + /// is null. + public virtual async Task PutAsync(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = await PutAsync(content, null).ConfigureAwait(false); + return result; + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type to use. + /// is null. + public virtual ClientResult Put(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = Put(content, null); + return result; + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + internal PipelineMessage CreateGetFloat32ValueRequest(RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "GET"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/float32", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + if (options != null) + { + message.Apply(options); + } + return message; + } + + internal PipelineMessage CreatePutRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/float32", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier _pipelineMessageClassifier204; + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int32Value.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int32Value.cs new file mode 100644 index 00000000000..be27ee24302 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int32Value.cs @@ -0,0 +1,239 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; + +namespace Type.Dictionary +{ + // Data plane generated sub-client. + /// Dictionary of int32 values. + public partial class Int32Value + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of Int32Value for mocking. + protected Int32Value() + { + } + + /// Initializes a new instance of Int32Value. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// TestServer endpoint. + internal Int32Value(ClientPipeline pipeline, Uri endpoint) + { + _pipeline = pipeline; + _endpoint = endpoint; + } + + /// The GetInt32Value method. + public virtual async Task>> GetInt32ValueAsync() + { + ClientResult result = await GetInt32ValueAsync(null).ConfigureAwait(false); + IReadOnlyDictionary value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + dictionary.Add(property.Name, property.Value.GetInt32()); + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// The GetInt32Value method. + public virtual ClientResult> GetInt32Value() + { + ClientResult result = GetInt32Value(null); + IReadOnlyDictionary value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + dictionary.Add(property.Name, property.Value.GetInt32()); + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetInt32ValueAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetInt32ValueRequest(options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetInt32Value(RequestOptions options) + { + using PipelineMessage message = CreateGetInt32ValueRequest(options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type to use. + /// is null. + public virtual async Task PutAsync(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = await PutAsync(content, null).ConfigureAwait(false); + return result; + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type to use. + /// is null. + public virtual ClientResult Put(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = Put(content, null); + return result; + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + internal PipelineMessage CreateGetInt32ValueRequest(RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "GET"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/int32", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + if (options != null) + { + message.Apply(options); + } + return message; + } + + internal PipelineMessage CreatePutRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/int32", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier _pipelineMessageClassifier204; + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int64Value.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int64Value.cs new file mode 100644 index 00000000000..0b0649f179e --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int64Value.cs @@ -0,0 +1,239 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; + +namespace Type.Dictionary +{ + // Data plane generated sub-client. + /// Dictionary of int64 values. + public partial class Int64Value + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of Int64Value for mocking. + protected Int64Value() + { + } + + /// Initializes a new instance of Int64Value. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// TestServer endpoint. + internal Int64Value(ClientPipeline pipeline, Uri endpoint) + { + _pipeline = pipeline; + _endpoint = endpoint; + } + + /// The GetInt64Value method. + public virtual async Task>> GetInt64ValueAsync() + { + ClientResult result = await GetInt64ValueAsync(null).ConfigureAwait(false); + IReadOnlyDictionary value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + dictionary.Add(property.Name, property.Value.GetInt64()); + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// The GetInt64Value method. + public virtual ClientResult> GetInt64Value() + { + ClientResult result = GetInt64Value(null); + IReadOnlyDictionary value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + dictionary.Add(property.Name, property.Value.GetInt64()); + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetInt64ValueAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetInt64ValueRequest(options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetInt64Value(RequestOptions options) + { + using PipelineMessage message = CreateGetInt64ValueRequest(options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type to use. + /// is null. + public virtual async Task PutAsync(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = await PutAsync(content, null).ConfigureAwait(false); + return result; + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type to use. + /// is null. + public virtual ClientResult Put(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = Put(content, null); + return result; + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + internal PipelineMessage CreateGetInt64ValueRequest(RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "GET"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/int64", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + if (options != null) + { + message.Apply(options); + } + return message; + } + + internal PipelineMessage CreatePutRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/int64", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier _pipelineMessageClassifier204; + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Argument.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Argument.cs new file mode 100644 index 00000000000..dbe4b67cebb --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Argument.cs @@ -0,0 +1,126 @@ +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Type.Dictionary +{ + internal static class Argument + { + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNullOrEmpty(IEnumerable value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value is ICollection collectionOfT && collectionOfT.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + if (value is ICollection collection && collection.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + using IEnumerator e = value.GetEnumerator(); + if (!e.MoveNext()) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + } + + public static void AssertNotNullOrEmpty(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value.Length == 0) + { + throw new ArgumentException("Value cannot be an empty string.", name); + } + } + + public static void AssertNotNullOrWhiteSpace(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); + } + } + + public static void AssertNotDefault(ref T value, string name) + where T : struct, IEquatable + { + if (value.Equals(default)) + { + throw new ArgumentException("Value cannot be empty.", name); + } + } + + public static void AssertInRange(T value, T minimum, T maximum, string name) + where T : notnull, IComparable + { + if (minimum.CompareTo(value) > 0) + { + throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); + } + if (maximum.CompareTo(value) < 0) + { + throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); + } + } + + public static void AssertEnumDefined(System.Type enumType, object value, string name) + { + if (!Enum.IsDefined(enumType, value)) + { + throw new ArgumentException($"Value not defined for {enumType.FullName}.", name); + } + } + + public static T CheckNotNull(T value, string name) + where T : class + { + AssertNotNull(value, name); + return value; + } + + public static string CheckNotNullOrEmpty(string value, string name) + { + AssertNotNullOrEmpty(value, name); + return value; + } + + public static void AssertNull(T value, string name, string message = null) + { + if (value != null) + { + throw new ArgumentException(message ?? "Value must be null.", name); + } + } + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/BinaryContentHelper.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/BinaryContentHelper.cs new file mode 100644 index 00000000000..8d0fceb39a8 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/BinaryContentHelper.cs @@ -0,0 +1,119 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.Collections.Generic; +using System.Text.Json; + +namespace Type.Dictionary +{ + internal static class BinaryContentHelper + { + public static BinaryContent FromEnumerable(IEnumerable enumerable) + where T : notnull + { + Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); + content.JsonWriter.WriteStartArray(); + foreach (var item in enumerable) + { + content.JsonWriter.WriteObjectValue(item, ModelSerializationExtensions.WireOptions); + } + content.JsonWriter.WriteEndArray(); + + return content; + } + + public static BinaryContent FromEnumerable(IEnumerable enumerable) + { + Utf8JsonBinaryContent content = new 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 (JsonDocument document = JsonDocument.Parse(item)) + { + JsonSerializer.Serialize(content.JsonWriter, document.RootElement); + } +#endif + } + } + content.JsonWriter.WriteEndArray(); + + return content; + } + + public static BinaryContent FromDictionary(IDictionary dictionary) + where TValue : notnull + { + 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.WriteEndObject(); + + return content; + } + + public static BinaryContent FromDictionary(IDictionary dictionary) + { + Utf8JsonBinaryContent content = new 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 (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(content.JsonWriter, document.RootElement); + } +#endif + } + } + content.JsonWriter.WriteEndObject(); + + return content; + } + + public static BinaryContent FromObject(object value) + { + Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); + content.JsonWriter.WriteObjectValue(value, ModelSerializationExtensions.WireOptions); + return content; + } + + public static BinaryContent FromObject(BinaryData value) + { + Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); +#if NET6_0_OR_GREATER + content.JsonWriter.WriteRawValue(value); +#else + using (JsonDocument document = JsonDocument.Parse(value)) + { + JsonSerializer.Serialize(content.JsonWriter, document.RootElement); + } +#endif + return content; + } + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingDictionary.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 00000000000..808273e57f0 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -0,0 +1,164 @@ +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Type.Dictionary +{ + internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + { + private IDictionary _innerDictionary; + + public ChangeTrackingDictionary() + { + } + + public ChangeTrackingDictionary(IDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(dictionary); + } + + public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(); + foreach (var pair in dictionary) + { + _innerDictionary.Add(pair); + } + } + + public bool IsUndefined => _innerDictionary == null; + + public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + + public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + + public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + + public TValue this[TKey key] + { + get + { + if (IsUndefined) + { + throw new KeyNotFoundException(nameof(key)); + } + return EnsureDictionary()[key]; + } + set + { + EnsureDictionary()[key] = value; + } + } + + IEnumerable IReadOnlyDictionary.Keys => Keys; + + IEnumerable IReadOnlyDictionary.Values => Values; + + public IEnumerator> GetEnumerator() + { + if (IsUndefined) + { + IEnumerator> enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureDictionary().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(KeyValuePair item) + { + EnsureDictionary().Add(item); + } + + public void Clear() + { + EnsureDictionary().Clear(); + } + + public bool Contains(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int index) + { + if (IsUndefined) + { + return; + } + EnsureDictionary().CopyTo(array, index); + } + + public bool Remove(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(item); + } + + public void Add(TKey key, TValue value) + { + EnsureDictionary().Add(key, value); + } + + public bool ContainsKey(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().ContainsKey(key); + } + + public bool Remove(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(key); + } + + public bool TryGetValue(TKey key, out TValue value) + { + if (IsUndefined) + { + value = default; + return false; + } + return EnsureDictionary().TryGetValue(key, out value); + } + + public IDictionary EnsureDictionary() + { + return _innerDictionary ??= new Dictionary(); + } + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingList.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 00000000000..7ab0348e548 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingList.cs @@ -0,0 +1,150 @@ +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Type.Dictionary +{ + internal class ChangeTrackingList : IList, IReadOnlyList + { + private IList _innerList; + + public ChangeTrackingList() + { + } + + public ChangeTrackingList(IList innerList) + { + if (innerList != null) + { + _innerList = innerList; + } + } + + public ChangeTrackingList(IReadOnlyList innerList) + { + if (innerList != null) + { + _innerList = innerList.ToList(); + } + } + + public bool IsUndefined => _innerList == null; + + public int Count => IsUndefined ? 0 : EnsureList().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + + public T this[int index] + { + get + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + return EnsureList()[index]; + } + set + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList()[index] = value; + } + } + + public void Reset() + { + _innerList = null; + } + + public IEnumerator GetEnumerator() + { + if (IsUndefined) + { + IEnumerator enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureList().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(T item) + { + EnsureList().Add(item); + } + + public void Clear() + { + EnsureList().Clear(); + } + + public bool Contains(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + if (IsUndefined) + { + return; + } + EnsureList().CopyTo(array, arrayIndex); + } + + public bool Remove(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Remove(item); + } + + public int IndexOf(T item) + { + if (IsUndefined) + { + return -1; + } + return EnsureList().IndexOf(item); + } + + public void Insert(int index, T item) + { + EnsureList().Insert(index, item); + } + + public void RemoveAt(int index) + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList().RemoveAt(index); + } + + public IList EnsureList() + { + return _innerList ??= new List(); + } + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientPipelineExtensions.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientPipelineExtensions.cs new file mode 100644 index 00000000000..376866a8994 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientPipelineExtensions.cs @@ -0,0 +1,65 @@ +// + +#nullable disable + +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Threading.Tasks; + +namespace Type.Dictionary +{ + internal static class ClientPipelineExtensions + { + public static async ValueTask ProcessMessageAsync(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) + { + await pipeline.SendAsync(message).ConfigureAwait(false); + + if (message.Response.IsError && (options?.ErrorOptions & ClientErrorBehaviors.NoThrow) != ClientErrorBehaviors.NoThrow) + { + throw await ClientResultException.CreateAsync(message.Response).ConfigureAwait(false); + } + + return message.Response; + } + + public static PipelineResponse ProcessMessage(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) + { + pipeline.Send(message); + + if (message.Response.IsError && (options?.ErrorOptions & ClientErrorBehaviors.NoThrow) != ClientErrorBehaviors.NoThrow) + { + throw new ClientResultException(message.Response); + } + + return message.Response; + } + + public static async ValueTask> ProcessHeadAsBoolMessageAsync(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) + { + PipelineResponse response = await pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false); + switch (response.Status) + { + case >= 200 and < 300: + return ClientResult.FromValue(true, response); + case >= 400 and < 500: + return ClientResult.FromValue(false, response); + default: + return new ErrorResult(response, new ClientResultException(response)); + } + } + + public static ClientResult ProcessHeadAsBoolMessage(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) + { + PipelineResponse response = pipeline.ProcessMessage(message, options); + switch (response.Status) + { + case >= 200 and < 300: + return ClientResult.FromValue(true, response); + case >= 400 and < 500: + return ClientResult.FromValue(false, response); + default: + return new ErrorResult(response, new ClientResultException(response)); + } + } + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientUriBuilder.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientUriBuilder.cs new file mode 100644 index 00000000000..f3811c23968 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientUriBuilder.cs @@ -0,0 +1,210 @@ +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Type.Dictionary +{ + internal class ClientUriBuilder + { + private UriBuilder _uriBuilder; + private StringBuilder _pathBuilder; + private StringBuilder _queryBuilder; + private const char PathSeparator = '/'; + + public ClientUriBuilder() + { + } + + private UriBuilder UriBuilder => _uriBuilder ??= new UriBuilder(); + + private StringBuilder PathBuilder => _pathBuilder ??= new StringBuilder(UriBuilder.Path); + + private StringBuilder QueryBuilder => _queryBuilder ??= new StringBuilder(UriBuilder.Query); + + public void Reset(Uri uri) + { + _uriBuilder = new UriBuilder(uri); + _pathBuilder = new StringBuilder(UriBuilder.Path); + _queryBuilder = new StringBuilder(UriBuilder.Query); + } + + public void AppendPath(string value, bool escape) + { + Argument.AssertNotNullOrWhiteSpace(value, nameof(value)); + + if (escape) + { + value = Uri.EscapeDataString(value); + } + + if (value[0] == PathSeparator) + { + value = value.Substring(1); + } + + PathBuilder.Append(value); + UriBuilder.Path = PathBuilder.ToString(); + } + + public void AppendPath(bool value, bool escape = false) + { + AppendPath(ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendPath(float value, bool escape = true) + { + AppendPath(ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendPath(double value, bool escape = true) + { + AppendPath(ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendPath(int value, bool escape = true) + { + AppendPath(ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendPath(byte[] value, string format, bool escape = true) + { + AppendPath(ModelSerializationExtensions.TypeFormatters.ConvertToString(value, format), escape); + } + + public void AppendPath(IEnumerable value, bool escape = true) + { + AppendPath(ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendPath(DateTimeOffset value, string format, bool escape = true) + { + AppendPath(ModelSerializationExtensions.TypeFormatters.ConvertToString(value, format), escape); + } + + public void AppendPath(TimeSpan value, string format, bool escape = true) + { + AppendPath(ModelSerializationExtensions.TypeFormatters.ConvertToString(value, format), escape); + } + + public void AppendPath(Guid value, bool escape = true) + { + AppendPath(ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendPath(long value, bool escape = true) + { + AppendPath(ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendQuery(string name, string value, bool escape) + { + Argument.AssertNotNullOrWhiteSpace(name, nameof(name)); + Argument.AssertNotNullOrWhiteSpace(value, nameof(value)); + + if (QueryBuilder.Length == 0) + { + QueryBuilder.Append('?'); + } + else + { + QueryBuilder.Append('&'); + } + + if (escape) + { + value = Uri.EscapeDataString(value); + } + + QueryBuilder.Append(name); + QueryBuilder.Append('='); + QueryBuilder.Append(value); + } + + public void AppendQuery(string name, bool value, bool escape = false) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendQuery(string name, float value, bool escape = true) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendQuery(string name, DateTimeOffset value, string format, bool escape = true) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value, format), escape); + } + + public void AppendQuery(string name, TimeSpan value, string format, bool escape = true) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value, format), escape); + } + + public void AppendQuery(string name, double value, bool escape = true) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendQuery(string name, decimal value, bool escape = true) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendQuery(string name, int value, bool escape = true) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendQuery(string name, long value, bool escape = true) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendQuery(string name, TimeSpan value, bool escape = true) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendQuery(string name, byte[] value, string format, bool escape = true) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value, format), escape); + } + + public void AppendQuery(string name, Guid value, bool escape = true) + { + AppendQuery(name, ModelSerializationExtensions.TypeFormatters.ConvertToString(value), escape); + } + + public void AppendQueryDelimited(string name, IEnumerable value, string delimiter, bool escape = true) + { + var stringValues = value.Select(v => ModelSerializationExtensions.TypeFormatters.ConvertToString(v)); + AppendQuery(name, string.Join(delimiter, stringValues), escape); + } + + public void AppendQueryDelimited(string name, IEnumerable value, string delimiter, string format, bool escape = true) + { + var stringValues = value.Select(v => ModelSerializationExtensions.TypeFormatters.ConvertToString(v, format)); + AppendQuery(name, string.Join(delimiter, stringValues), escape); + } + + public Uri ToUri() + { + if (_pathBuilder != null) + { + UriBuilder.Path = _pathBuilder.ToString(); + } + + if (_queryBuilder != null) + { + UriBuilder.Query = _queryBuilder.ToString(); + } + + return UriBuilder.Uri; + } + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ErrorResult.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ErrorResult.cs new file mode 100644 index 00000000000..b6a5cf967cc --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ErrorResult.cs @@ -0,0 +1,23 @@ +// + +#nullable disable + +using System.ClientModel; +using System.ClientModel.Primitives; + +namespace Type.Dictionary +{ + internal class ErrorResult : ClientResult + { + private readonly PipelineResponse _response; + private readonly ClientResultException _exception; + + public ErrorResult(PipelineResponse response, ClientResultException exception) : base(default, response) + { + _response = response; + _exception = exception; + } + + public override T Value => throw _exception; + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ModelSerializationExtensions.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 00000000000..222ddcf4a3c --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,391 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Text.Json; +using System.Xml; + +namespace Type.Dictionary +{ + internal static class ModelSerializationExtensions + { + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + + public static object GetObject(this JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.String: + return element.GetString(); + case JsonValueKind.Number: + if (element.TryGetInt32(out int intValue)) + { + return intValue; + } + if (element.TryGetInt64(out long longValue)) + { + return longValue; + } + return element.GetDouble(); + case JsonValueKind.True: + return true; + case JsonValueKind.False: + return false; + case JsonValueKind.Undefined: + case JsonValueKind.Null: + return null; + case JsonValueKind.Object: + var dictionary = new Dictionary(); + foreach (var jsonProperty in element.EnumerateObject()) + { + dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); + } + return dictionary; + case JsonValueKind.Array: + var list = new List(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + var text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + { + throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + } + + public static string GetRequiredString(this JsonElement element) + { + var value = element.GetString(); + if (value == null) + { + throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + 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 Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + + internal static class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Generated clients require it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; + int size = checked(numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ConvertToString(object value, string format = null) => value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when format != null => ToString(b0, format), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when format != null => ToString(dateTime, format), + TimeSpan timeSpan when format != null => ToString(timeSpan, format), + TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Optional.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Optional.cs new file mode 100644 index 00000000000..c72de41f119 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Optional.cs @@ -0,0 +1,48 @@ +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Type.Dictionary +{ + internal static class Optional + { + public static bool IsCollectionDefined(IEnumerable collection) + { + return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); + } + + public static bool IsCollectionDefined(IDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsCollectionDefined(IReadOnlyDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsDefined(T? value) + where T : struct + { + return value.HasValue; + } + + public static bool IsDefined(object value) + { + return value != null; + } + + public static bool IsDefined(JsonElement value) + { + return value.ValueKind != JsonValueKind.Undefined; + } + + public static bool IsDefined(string value) + { + return value != null; + } + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Utf8JsonBinaryContent.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Utf8JsonBinaryContent.cs new file mode 100644 index 00000000000..0b6d69d210f --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Utf8JsonBinaryContent.cs @@ -0,0 +1,52 @@ +// + +#nullable disable + +using System.ClientModel; +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; + +namespace Type.Dictionary +{ + internal class Utf8JsonBinaryContent : BinaryContent + { + private readonly MemoryStream _stream; + private readonly BinaryContent _content; + + public Utf8JsonBinaryContent() + { + _stream = new MemoryStream(); + _content = Create(_stream); + JsonWriter = new Utf8JsonWriter(_stream); + } + + public Utf8JsonWriter JsonWriter { get; } + + public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) + { + await JsonWriter.FlushAsync().ConfigureAwait(false); + await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); + } + + public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) + { + JsonWriter.Flush(); + _content.WriteTo(stream, cancellationToken); + } + + public override bool TryComputeLength(out long length) + { + length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; + return true; + } + + public override void Dispose() + { + JsonWriter.Dispose(); + _content.Dispose(); + _stream.Dispose(); + } + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/ModelValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/ModelValue.cs new file mode 100644 index 00000000000..868aed0a01e --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/ModelValue.cs @@ -0,0 +1,240 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; +using Type.Dictionary.Models; + +namespace Type.Dictionary +{ + // Data plane generated sub-client. + /// Dictionary of model values. + public partial class ModelValue + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of ModelValue for mocking. + protected ModelValue() + { + } + + /// Initializes a new instance of ModelValue. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// TestServer endpoint. + internal ModelValue(ClientPipeline pipeline, Uri endpoint) + { + _pipeline = pipeline; + _endpoint = endpoint; + } + + /// The GetModelValue method. + public virtual async Task>> GetModelValueAsync() + { + ClientResult result = await GetModelValueAsync(null).ConfigureAwait(false); + IReadOnlyDictionary value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + dictionary.Add(property.Name, InnerModel.DeserializeInnerModel(property.Value)); + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// The GetModelValue method. + public virtual ClientResult> GetModelValue() + { + ClientResult result = GetModelValue(null); + IReadOnlyDictionary value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + dictionary.Add(property.Name, InnerModel.DeserializeInnerModel(property.Value)); + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetModelValueAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetModelValueRequest(options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetModelValue(RequestOptions options) + { + using PipelineMessage message = CreateGetModelValueRequest(options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type to use. + /// is null. + public virtual async Task PutAsync(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = await PutAsync(content, null).ConfigureAwait(false); + return result; + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type to use. + /// is null. + public virtual ClientResult Put(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = Put(content, null); + return result; + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + internal PipelineMessage CreateGetModelValueRequest(RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "GET"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/model", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + if (options != null) + { + message.Apply(options); + } + return message; + } + + internal PipelineMessage CreatePutRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/model", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier _pipelineMessageClassifier204; + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.Serialization.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.Serialization.cs new file mode 100644 index 00000000000..88f10b1ed72 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.Serialization.cs @@ -0,0 +1,154 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; + +namespace Type.Dictionary.Models +{ + public partial class InnerModel : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InnerModel)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("property"u8); + writer.WriteStringValue(Property); + if (Optional.IsCollectionDefined(Children)) + { + writer.WritePropertyName("children"u8); + writer.WriteStartObject(); + foreach (var item in Children) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + InnerModel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InnerModel)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInnerModel(document.RootElement, options); + } + + internal static InnerModel DeserializeInnerModel(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string property = default; + IDictionary children = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property0 in element.EnumerateObject()) + { + if (property0.NameEquals("property"u8)) + { + property = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("children"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, DeserializeInnerModel(property1.Value, options)); + } + children = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InnerModel(property, children ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InnerModel)} does not support writing '{options.Format}' format."); + } + } + + InnerModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInnerModel(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InnerModel)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The result to deserialize the model from. + internal static InnerModel FromResponse(PipelineResponse response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeInnerModel(document.RootElement); + } + + /// Convert into a . + internal virtual BinaryContent ToBinaryContent() + { + return BinaryContent.Create(this, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.cs new file mode 100644 index 00000000000..c0d1f9e8c10 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.cs @@ -0,0 +1,77 @@ +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Type.Dictionary.Models +{ + /// Dictionary inner model. + public partial class InnerModel + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Required string property. + /// is null. + public InnerModel(string property) + { + Argument.AssertNotNull(property, nameof(property)); + + Property = property; + Children = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Required string property. + /// + /// Keeps track of any properties unknown to the library. + internal InnerModel(string property, IDictionary children, IDictionary serializedAdditionalRawData) + { + Property = property; + Children = children; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InnerModel() + { + } + + /// Required string property. + public string Property { get; set; } + /// Gets the children. + public IDictionary Children { get; } + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/NullableFloatValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/NullableFloatValue.cs new file mode 100644 index 00000000000..d4470d4644d --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/NullableFloatValue.cs @@ -0,0 +1,253 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; + +namespace Type.Dictionary +{ + // Data plane generated sub-client. + /// Dictionary of nullable float values. + public partial class NullableFloatValue + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of NullableFloatValue for mocking. + protected NullableFloatValue() + { + } + + /// Initializes a new instance of NullableFloatValue. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// TestServer endpoint. + internal NullableFloatValue(ClientPipeline pipeline, Uri endpoint) + { + _pipeline = pipeline; + _endpoint = endpoint; + } + + /// The GetNullableFloatValue method. + public virtual async Task>> GetNullableFloatValueAsync() + { + ClientResult result = await GetNullableFloatValueAsync(null).ConfigureAwait(false); + IReadOnlyDictionary value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property.Name, null); + } + else + { + dictionary.Add(property.Name, property.Value.GetSingle()); + } + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// The GetNullableFloatValue method. + public virtual ClientResult> GetNullableFloatValue() + { + ClientResult result = GetNullableFloatValue(null); + IReadOnlyDictionary value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property.Name, null); + } + else + { + dictionary.Add(property.Name, property.Value.GetSingle()); + } + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetNullableFloatValueAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetNullableFloatValueRequest(options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetNullableFloatValue(RequestOptions options) + { + using PipelineMessage message = CreateGetNullableFloatValueRequest(options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type ? to use. + /// is null. + public virtual async Task PutAsync(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = await PutAsync(content, null).ConfigureAwait(false); + return result; + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type ? to use. + /// is null. + public virtual ClientResult Put(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = Put(content, null); + return result; + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + internal PipelineMessage CreateGetNullableFloatValueRequest(RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "GET"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/nullable-float", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + if (options != null) + { + message.Apply(options); + } + return message; + } + + internal PipelineMessage CreatePutRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/nullable-float", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier _pipelineMessageClassifier204; + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/RecursiveModelValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/RecursiveModelValue.cs new file mode 100644 index 00000000000..7a06fdf540a --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/RecursiveModelValue.cs @@ -0,0 +1,240 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; +using Type.Dictionary.Models; + +namespace Type.Dictionary +{ + // Data plane generated sub-client. + /// Dictionary of model values. + public partial class RecursiveModelValue + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of RecursiveModelValue for mocking. + protected RecursiveModelValue() + { + } + + /// Initializes a new instance of RecursiveModelValue. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// TestServer endpoint. + internal RecursiveModelValue(ClientPipeline pipeline, Uri endpoint) + { + _pipeline = pipeline; + _endpoint = endpoint; + } + + /// The GetRecursiveModelValue method. + public virtual async Task>> GetRecursiveModelValueAsync() + { + ClientResult result = await GetRecursiveModelValueAsync(null).ConfigureAwait(false); + IReadOnlyDictionary value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + dictionary.Add(property.Name, InnerModel.DeserializeInnerModel(property.Value)); + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// The GetRecursiveModelValue method. + public virtual ClientResult> GetRecursiveModelValue() + { + ClientResult result = GetRecursiveModelValue(null); + IReadOnlyDictionary value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + dictionary.Add(property.Name, InnerModel.DeserializeInnerModel(property.Value)); + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetRecursiveModelValueAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetRecursiveModelValueRequest(options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetRecursiveModelValue(RequestOptions options) + { + using PipelineMessage message = CreateGetRecursiveModelValueRequest(options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type to use. + /// is null. + public virtual async Task PutAsync(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = await PutAsync(content, null).ConfigureAwait(false); + return result; + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type to use. + /// is null. + public virtual ClientResult Put(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = Put(content, null); + return result; + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + internal PipelineMessage CreateGetRecursiveModelValueRequest(RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "GET"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/model/recursive", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + if (options != null) + { + message.Apply(options); + } + return message; + } + + internal PipelineMessage CreatePutRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/model/recursive", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier _pipelineMessageClassifier204; + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/StringValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/StringValue.cs new file mode 100644 index 00000000000..cf08c1de236 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/StringValue.cs @@ -0,0 +1,239 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; + +namespace Type.Dictionary +{ + // Data plane generated sub-client. + /// Dictionary of string values. + public partial class StringValue + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of StringValue for mocking. + protected StringValue() + { + } + + /// Initializes a new instance of StringValue. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// TestServer endpoint. + internal StringValue(ClientPipeline pipeline, Uri endpoint) + { + _pipeline = pipeline; + _endpoint = endpoint; + } + + /// The GetStringValue method. + public virtual async Task>> GetStringValueAsync() + { + ClientResult result = await GetStringValueAsync(null).ConfigureAwait(false); + IReadOnlyDictionary value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + dictionary.Add(property.Name, property.Value.GetString()); + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// The GetStringValue method. + public virtual ClientResult> GetStringValue() + { + ClientResult result = GetStringValue(null); + IReadOnlyDictionary value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + dictionary.Add(property.Name, property.Value.GetString()); + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetStringValueAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetStringValueRequest(options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetStringValue(RequestOptions options) + { + using PipelineMessage message = CreateGetStringValueRequest(options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type to use. + /// is null. + public virtual async Task PutAsync(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = await PutAsync(content, null).ConfigureAwait(false); + return result; + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type to use. + /// is null. + public virtual ClientResult Put(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = Put(content, null); + return result; + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + internal PipelineMessage CreateGetStringValueRequest(RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "GET"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/string", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + if (options != null) + { + message.Apply(options); + } + return message; + } + + internal PipelineMessage CreatePutRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/string", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier _pipelineMessageClassifier204; + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/UnknownValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/UnknownValue.cs new file mode 100644 index 00000000000..2131299bb80 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/UnknownValue.cs @@ -0,0 +1,253 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; + +namespace Type.Dictionary +{ + // Data plane generated sub-client. + /// Dictionary of unknown values. + public partial class UnknownValue + { + private readonly ClientPipeline _pipeline; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual ClientPipeline Pipeline => _pipeline; + + /// Initializes a new instance of UnknownValue for mocking. + protected UnknownValue() + { + } + + /// Initializes a new instance of UnknownValue. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// TestServer endpoint. + internal UnknownValue(ClientPipeline pipeline, Uri endpoint) + { + _pipeline = pipeline; + _endpoint = endpoint; + } + + /// The GetUnknownValue method. + public virtual async Task>> GetUnknownValueAsync() + { + ClientResult result = await GetUnknownValueAsync(null).ConfigureAwait(false); + IReadOnlyDictionary value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property.Name, null); + } + else + { + dictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// The GetUnknownValue method. + public virtual ClientResult> GetUnknownValue() + { + ClientResult result = GetUnknownValue(null); + IReadOnlyDictionary value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property.Name, null); + } + else + { + dictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + value = dictionary; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetUnknownValueAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetUnknownValueRequest(options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetUnknownValue(RequestOptions options) + { + using PipelineMessage message = CreateGetUnknownValueRequest(options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type to use. + /// is null. + public virtual async Task PutAsync(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = await PutAsync(content, null).ConfigureAwait(false); + return result; + } + + /// The Put method. + /// The where TKey is of type , where TValue is of type to use. + /// is null. + public virtual ClientResult Put(IDictionary body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromDictionary(body); + ClientResult result = Put(content, null); + return result; + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PutAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreatePutRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + + internal PipelineMessage CreateGetUnknownValueRequest(RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "GET"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/unknown", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + if (options != null) + { + message.Apply(options); + } + return message; + } + + internal PipelineMessage CreatePutRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier204; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/dictionary/unknown", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier _pipelineMessageClassifier204; + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + } +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/tspCodeModel.json b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/tspCodeModel.json new file mode 100644 index 00000000000..a058167a4b2 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/tspCodeModel.json @@ -0,0 +1,2340 @@ +{ + "$id": "1", + "Name": "Type.Dictionary", + "Description": "Illustrates various of dictionaries.", + "ApiVersions": [], + "Enums": [], + "Models": [ + { + "$id": "2", + "Kind": "Model", + "Name": "InnerModel", + "Namespace": "Type.Dictionary", + "Description": "Dictionary inner model", + "IsNullable": false, + "Usage": "RoundTrip", + "Properties": [ + { + "$id": "3", + "Name": "property", + "SerializedName": "property", + "Description": "Required string property", + "Type": { + "$id": "4", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "5", + "Name": "children", + "SerializedName": "children", + "Description": "", + "Type": { + "$id": "6", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "7", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$ref": "2" + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + } + ], + "Clients": [ + { + "$id": "8", + "Name": "DictionaryClient", + "Description": "", + "Operations": [], + "Protocol": { + "$id": "9" + }, + "Creatable": true + }, + { + "$id": "10", + "Name": "Int32Value", + "Description": "Dictionary of int32 values", + "Operations": [ + { + "$id": "11", + "Name": "get", + "ResourceName": "Int32Value", + "Parameters": [ + { + "$id": "12", + "Name": "host", + "NameInRequest": "host", + "Description": "TestServer endpoint", + "Type": { + "$id": "13", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Uri", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": true, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Client", + "DefaultValue": { + "$id": "14", + "Type": { + "$id": "15", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Value": "http://localhost:3000" + } + }, + { + "$id": "16", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "17", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "18", + "Type": { + "$ref": "17" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "19", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "20", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "21", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "22", + "Kind": "Primitive", + "Name": "Int32", + "IsNullable": false + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/type/dictionary/int32", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "23", + "Name": "put", + "ResourceName": "Int32Value", + "Parameters": [ + { + "$ref": "12" + }, + { + "$id": "24", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "25", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "26", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "27", + "Kind": "Primitive", + "Name": "Int32", + "IsNullable": false + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "28", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "29", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "30", + "Type": { + "$ref": "29" + }, + "Value": "application/json" + } + }, + { + "$id": "31", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "32", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "33", + "Type": { + "$ref": "32" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "34", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/type/dictionary/int32", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "35" + }, + "Creatable": false, + "Parent": "DictionaryClient" + }, + { + "$id": "36", + "Name": "Int64Value", + "Description": "Dictionary of int64 values", + "Operations": [ + { + "$id": "37", + "Name": "get", + "ResourceName": "Int64Value", + "Parameters": [ + { + "$ref": "12" + }, + { + "$id": "38", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "39", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "40", + "Type": { + "$ref": "39" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "41", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "42", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "43", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "44", + "Kind": "Primitive", + "Name": "Int64", + "IsNullable": false + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/type/dictionary/int64", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "45", + "Name": "put", + "ResourceName": "Int64Value", + "Parameters": [ + { + "$ref": "12" + }, + { + "$id": "46", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "47", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "48", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "49", + "Kind": "Primitive", + "Name": "Int64", + "IsNullable": false + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "50", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "51", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "52", + "Type": { + "$ref": "51" + }, + "Value": "application/json" + } + }, + { + "$id": "53", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "54", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "55", + "Type": { + "$ref": "54" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "56", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/type/dictionary/int64", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "57" + }, + "Creatable": false, + "Parent": "DictionaryClient" + }, + { + "$id": "58", + "Name": "BooleanValue", + "Description": "Dictionary of boolean values", + "Operations": [ + { + "$id": "59", + "Name": "get", + "ResourceName": "BooleanValue", + "Parameters": [ + { + "$ref": "12" + }, + { + "$id": "60", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "61", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "62", + "Type": { + "$ref": "61" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "63", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "64", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "65", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "66", + "Kind": "Primitive", + "Name": "Boolean", + "IsNullable": false + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/type/dictionary/boolean", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "67", + "Name": "put", + "ResourceName": "BooleanValue", + "Parameters": [ + { + "$ref": "12" + }, + { + "$id": "68", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "69", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "70", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "71", + "Kind": "Primitive", + "Name": "Boolean", + "IsNullable": false + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "72", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "73", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "74", + "Type": { + "$ref": "73" + }, + "Value": "application/json" + } + }, + { + "$id": "75", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "76", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "77", + "Type": { + "$ref": "76" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "78", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/type/dictionary/boolean", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "79" + }, + "Creatable": false, + "Parent": "DictionaryClient" + }, + { + "$id": "80", + "Name": "StringValue", + "Description": "Dictionary of string values", + "Operations": [ + { + "$id": "81", + "Name": "get", + "ResourceName": "StringValue", + "Parameters": [ + { + "$ref": "12" + }, + { + "$id": "82", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "83", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "84", + "Type": { + "$ref": "83" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "85", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "86", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "87", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "88", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/type/dictionary/string", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "89", + "Name": "put", + "ResourceName": "StringValue", + "Parameters": [ + { + "$ref": "12" + }, + { + "$id": "90", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "91", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "92", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "93", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "94", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "95", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "96", + "Type": { + "$ref": "95" + }, + "Value": "application/json" + } + }, + { + "$id": "97", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "98", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "99", + "Type": { + "$ref": "98" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "100", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/type/dictionary/string", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "101" + }, + "Creatable": false, + "Parent": "DictionaryClient" + }, + { + "$id": "102", + "Name": "Float32Value", + "Description": "Dictionary of float values", + "Operations": [ + { + "$id": "103", + "Name": "get", + "ResourceName": "Float32Value", + "Parameters": [ + { + "$ref": "12" + }, + { + "$id": "104", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "105", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "106", + "Type": { + "$ref": "105" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "107", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "108", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "109", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "110", + "Kind": "Primitive", + "Name": "Float32", + "IsNullable": false + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/type/dictionary/float32", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "111", + "Name": "put", + "ResourceName": "Float32Value", + "Parameters": [ + { + "$ref": "12" + }, + { + "$id": "112", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "113", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "114", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "115", + "Kind": "Primitive", + "Name": "Float32", + "IsNullable": false + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "116", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "117", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "118", + "Type": { + "$ref": "117" + }, + "Value": "application/json" + } + }, + { + "$id": "119", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "120", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "121", + "Type": { + "$ref": "120" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "122", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/type/dictionary/float32", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "123" + }, + "Creatable": false, + "Parent": "DictionaryClient" + }, + { + "$id": "124", + "Name": "DatetimeValue", + "Description": "Dictionary of datetime values", + "Operations": [ + { + "$id": "125", + "Name": "get", + "ResourceName": "DatetimeValue", + "Parameters": [ + { + "$ref": "12" + }, + { + "$id": "126", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "127", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "128", + "Type": { + "$ref": "127" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "129", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "130", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "131", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "132", + "Kind": "Primitive", + "Name": "DateTime", + "IsNullable": false + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/type/dictionary/datetime", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "133", + "Name": "put", + "ResourceName": "DatetimeValue", + "Parameters": [ + { + "$ref": "12" + }, + { + "$id": "134", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "135", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "136", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "137", + "Kind": "Primitive", + "Name": "DateTime", + "IsNullable": false + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "138", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "139", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "140", + "Type": { + "$ref": "139" + }, + "Value": "application/json" + } + }, + { + "$id": "141", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "142", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "143", + "Type": { + "$ref": "142" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "144", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/type/dictionary/datetime", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "145" + }, + "Creatable": false, + "Parent": "DictionaryClient" + }, + { + "$id": "146", + "Name": "DurationValue", + "Description": "Dictionary of duration values", + "Operations": [ + { + "$id": "147", + "Name": "get", + "ResourceName": "DurationValue", + "Parameters": [ + { + "$ref": "12" + }, + { + "$id": "148", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "149", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "150", + "Type": { + "$ref": "149" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "151", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "152", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "153", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "154", + "Kind": "Primitive", + "Name": "DurationISO8601", + "IsNullable": false + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/type/dictionary/duration", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "155", + "Name": "put", + "ResourceName": "DurationValue", + "Parameters": [ + { + "$ref": "12" + }, + { + "$id": "156", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "157", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "158", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "159", + "Kind": "Primitive", + "Name": "DurationISO8601", + "IsNullable": false + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "160", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "161", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "162", + "Type": { + "$ref": "161" + }, + "Value": "application/json" + } + }, + { + "$id": "163", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "164", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "165", + "Type": { + "$ref": "164" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "166", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/type/dictionary/duration", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "167" + }, + "Creatable": false, + "Parent": "DictionaryClient" + }, + { + "$id": "168", + "Name": "UnknownValue", + "Description": "Dictionary of unknown values", + "Operations": [ + { + "$id": "169", + "Name": "get", + "ResourceName": "UnknownValue", + "Parameters": [ + { + "$ref": "12" + }, + { + "$id": "170", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "171", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "172", + "Type": { + "$ref": "171" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "173", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "174", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "175", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "176", + "Kind": "Intrinsic", + "Name": "unknown", + "IsNullable": false + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/type/dictionary/unknown", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "177", + "Name": "put", + "ResourceName": "UnknownValue", + "Parameters": [ + { + "$ref": "12" + }, + { + "$id": "178", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "179", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "180", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "181", + "Kind": "Intrinsic", + "Name": "unknown", + "IsNullable": false + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "182", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "183", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "184", + "Type": { + "$ref": "183" + }, + "Value": "application/json" + } + }, + { + "$id": "185", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "186", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "187", + "Type": { + "$ref": "186" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "188", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/type/dictionary/unknown", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "189" + }, + "Creatable": false, + "Parent": "DictionaryClient" + }, + { + "$id": "190", + "Name": "ModelValue", + "Description": "Dictionary of model values", + "Operations": [ + { + "$id": "191", + "Name": "get", + "ResourceName": "ModelValue", + "Parameters": [ + { + "$ref": "12" + }, + { + "$id": "192", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "193", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "194", + "Type": { + "$ref": "193" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "195", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "196", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "197", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$ref": "2" + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/type/dictionary/model", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "198", + "Name": "put", + "ResourceName": "ModelValue", + "Parameters": [ + { + "$ref": "12" + }, + { + "$id": "199", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "200", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "201", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$ref": "2" + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "202", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "203", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "204", + "Type": { + "$ref": "203" + }, + "Value": "application/json" + } + }, + { + "$id": "205", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "206", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "207", + "Type": { + "$ref": "206" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "208", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/type/dictionary/model", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "209" + }, + "Creatable": false, + "Parent": "DictionaryClient" + }, + { + "$id": "210", + "Name": "RecursiveModelValue", + "Description": "Dictionary of model values", + "Operations": [ + { + "$id": "211", + "Name": "get", + "ResourceName": "RecursiveModelValue", + "Parameters": [ + { + "$ref": "12" + }, + { + "$id": "212", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "213", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "214", + "Type": { + "$ref": "213" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "215", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "216", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "217", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$ref": "2" + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/type/dictionary/model/recursive", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "218", + "Name": "put", + "ResourceName": "RecursiveModelValue", + "Parameters": [ + { + "$ref": "12" + }, + { + "$id": "219", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "220", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "221", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$ref": "2" + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "222", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "223", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "224", + "Type": { + "$ref": "223" + }, + "Value": "application/json" + } + }, + { + "$id": "225", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "226", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "227", + "Type": { + "$ref": "226" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "228", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/type/dictionary/model/recursive", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "229" + }, + "Creatable": false, + "Parent": "DictionaryClient" + }, + { + "$id": "230", + "Name": "NullableFloatValue", + "Description": "Dictionary of nullable float values", + "Operations": [ + { + "$id": "231", + "Name": "get", + "ResourceName": "NullableFloatValue", + "Parameters": [ + { + "$ref": "12" + }, + { + "$id": "232", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "233", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "234", + "Type": { + "$ref": "233" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "235", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "236", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "237", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "238", + "Kind": "Primitive", + "Name": "Float32", + "IsNullable": true + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/type/dictionary/nullable-float", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "239", + "Name": "put", + "ResourceName": "NullableFloatValue", + "Parameters": [ + { + "$ref": "12" + }, + { + "$id": "240", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "241", + "Kind": "Dictionary", + "Name": "Dictionary", + "KeyType": { + "$id": "242", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "243", + "Kind": "Primitive", + "Name": "Float32", + "IsNullable": true + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "244", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "245", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "246", + "Type": { + "$ref": "245" + }, + "Value": "application/json" + } + }, + { + "$id": "247", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "248", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "249", + "Type": { + "$ref": "248" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "250", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/type/dictionary/nullable-float", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "251" + }, + "Creatable": false, + "Parent": "DictionaryClient" + } + ] +} diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Properties/AssemblyInfo.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..28e570ee6f6 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Properties/AssemblyInfo.cs @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Type.Dictionary.Tests")] diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Type.Dictionary.csproj b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Type.Dictionary.csproj new file mode 100644 index 00000000000..f4280ff175e --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Type.Dictionary.csproj @@ -0,0 +1,16 @@ + + + This is the Type.Dictionary client library for developing .NET applications with rich experience. + SDK Code Generation Type.Dictionary + 1.0.0-beta.1 + Type.Dictionary + netstandard2.0 + latest + true + + + + + + + diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/tests/Type.Dictionary.Tests.csproj b/test/CadlRanchProjectsNonAzure/type/dictionary/tests/Type.Dictionary.Tests.csproj new file mode 100644 index 00000000000..df5104a4100 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/tests/Type.Dictionary.Tests.csproj @@ -0,0 +1,18 @@ + + + net7.0 + + $(NoWarn);CS1591 + + + + + + + + + + + + + diff --git a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/tspCodeModel.json b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/tspCodeModel.json index 97127595a7e..e505ebb9e96 100644 --- a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/tspCodeModel.json +++ b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/tspCodeModel.json @@ -3076,18 +3076,145 @@ "BufferResponse": true, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": true + }, + { + "$id": "316", + "Name": "handleArray", + "ResourceName": "UnbrandedTypeSpec", + "Description": "head as boolean.", + "Parameters": [ + { + "$ref": "145" + }, + { + "$id": "317", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$id": "318", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$id": "319", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "320", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "321", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "322", + "Type": { + "$ref": "321" + }, + "Value": "application/json" + } + }, + { + "$id": "323", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "324", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "325", + "Type": { + "$ref": "324" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "326", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$id": "327", + "Kind": "Array", + "Name": "Array", + "ElementType": { + "$id": "328", + "Kind": "Primitive", + "Name": "String", + "IsNullable": false + }, + "IsNullable": false + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false, + "ContentTypes": [ + "application/json" + ] + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{unbrandedTypeSpecUrl}", + "Path": "/headAsBoolean", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true } ], "Protocol": { - "$id": "316" + "$id": "329" }, "Creatable": true } ], "Auth": { - "$id": "317", + "$id": "330", "ApiKey": { - "$id": "318", + "$id": "331", "Name": "my-api-key" } } From 5c64edf7452cd8887895abb0072f4b2785a9802d Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Wed, 17 Apr 2024 17:33:58 +0800 Subject: [PATCH 10/19] move the test cases from azure.core here --- .../dictionary/src/Generated/BooleanValue.cs | 4 + .../dictionary/src/Generated/DatetimeValue.cs | 4 + .../dictionary/src/Generated/DurationValue.cs | 4 + .../dictionary/src/Generated/Float32Value.cs | 4 + .../dictionary/src/Generated/Int32Value.cs | 4 + .../dictionary/src/Generated/Int64Value.cs | 4 + .../dictionary/src/Generated/ModelValue.cs | 4 + .../src/Generated/NullableFloatValue.cs | 4 + .../src/Generated/RecursiveModelValue.cs | 4 + .../dictionary/src/Generated/StringValue.cs | 4 + .../dictionary/src/Generated/UnknownValue.cs | 4 + .../BinaryContentHelperTests.cs | 213 ++++++++++++++++++ .../Unbranded-TypeSpec/Unbranded-TypeSpec.tsp | 6 + .../Generated/Internal/BinaryContentHelper.cs | 119 ++++++++++ .../Internal/Utf8JsonBinaryContent.cs | 52 +++++ .../src/Generated/UnbrandedTypeSpecClient.cs | 192 ++++++++++++++-- 16 files changed, 602 insertions(+), 24 deletions(-) create mode 100644 test/UnbrandedProjects.Tests/BinaryContentHelperTests.cs create mode 100644 test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/BinaryContentHelper.cs create mode 100644 test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/Utf8JsonBinaryContent.cs diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/BooleanValue.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/BooleanValue.cs index 4f660f237fd..ea56f3350d2 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/BooleanValue.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/BooleanValue.cs @@ -45,6 +45,7 @@ internal BooleanValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline _endpoint = endpoint; } + /// The GetBooleanValue method. /// The cancellation token to use. /// public virtual async Task>> GetBooleanValueAsync(CancellationToken cancellationToken = default) @@ -62,6 +63,7 @@ public virtual async Task>> GetBoolea return Response.FromValue(value, response); } + /// The GetBooleanValue method. /// The cancellation token to use. /// public virtual Response> GetBooleanValue(CancellationToken cancellationToken = default) @@ -149,6 +151,7 @@ public virtual Response GetBooleanValue(RequestContext context) } } + /// The Put method. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. @@ -163,6 +166,7 @@ public virtual async Task PutAsync(IDictionary body, Can return response; } + /// The Put method. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/DatetimeValue.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/DatetimeValue.cs index 850390cfea6..910ff460887 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/DatetimeValue.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/DatetimeValue.cs @@ -45,6 +45,7 @@ internal DatetimeValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipelin _endpoint = endpoint; } + /// The GetDatetimeValue method. /// The cancellation token to use. /// public virtual async Task>> GetDatetimeValueAsync(CancellationToken cancellationToken = default) @@ -62,6 +63,7 @@ public virtual async Task>> return Response.FromValue(value, response); } + /// The GetDatetimeValue method. /// The cancellation token to use. /// public virtual Response> GetDatetimeValue(CancellationToken cancellationToken = default) @@ -149,6 +151,7 @@ public virtual Response GetDatetimeValue(RequestContext context) } } + /// The Put method. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. @@ -163,6 +166,7 @@ public virtual async Task PutAsync(IDictionary return response; } + /// The Put method. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/DurationValue.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/DurationValue.cs index afb429823a8..4fc018c29d1 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/DurationValue.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/DurationValue.cs @@ -45,6 +45,7 @@ internal DurationValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipelin _endpoint = endpoint; } + /// The GetDurationValue method. /// The cancellation token to use. /// public virtual async Task>> GetDurationValueAsync(CancellationToken cancellationToken = default) @@ -62,6 +63,7 @@ public virtual async Task>> GetDu return Response.FromValue(value, response); } + /// The GetDurationValue method. /// The cancellation token to use. /// public virtual Response> GetDurationValue(CancellationToken cancellationToken = default) @@ -149,6 +151,7 @@ public virtual Response GetDurationValue(RequestContext context) } } + /// The Put method. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. @@ -163,6 +166,7 @@ public virtual async Task PutAsync(IDictionary body, return response; } + /// The Put method. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/Float32Value.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/Float32Value.cs index 18505bdbbe3..0d1a1fd464b 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/Float32Value.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/Float32Value.cs @@ -45,6 +45,7 @@ internal Float32Value(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline _endpoint = endpoint; } + /// The GetFloat32Value method. /// The cancellation token to use. /// public virtual async Task>> GetFloat32ValueAsync(CancellationToken cancellationToken = default) @@ -62,6 +63,7 @@ public virtual async Task>> GetFloat return Response.FromValue(value, response); } + /// The GetFloat32Value method. /// The cancellation token to use. /// public virtual Response> GetFloat32Value(CancellationToken cancellationToken = default) @@ -149,6 +151,7 @@ public virtual Response GetFloat32Value(RequestContext context) } } + /// The Put method. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. @@ -163,6 +166,7 @@ public virtual async Task PutAsync(IDictionary body, Ca return response; } + /// The Put method. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/Int32Value.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/Int32Value.cs index ca833eb2341..3cfdc21a535 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/Int32Value.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/Int32Value.cs @@ -45,6 +45,7 @@ internal Int32Value(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, _endpoint = endpoint; } + /// The GetInt32Value method. /// The cancellation token to use. /// public virtual async Task>> GetInt32ValueAsync(CancellationToken cancellationToken = default) @@ -62,6 +63,7 @@ public virtual async Task>> GetInt32Va return Response.FromValue(value, response); } + /// The GetInt32Value method. /// The cancellation token to use. /// public virtual Response> GetInt32Value(CancellationToken cancellationToken = default) @@ -149,6 +151,7 @@ public virtual Response GetInt32Value(RequestContext context) } } + /// The Put method. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. @@ -163,6 +166,7 @@ public virtual async Task PutAsync(IDictionary body, Canc return response; } + /// The Put method. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/Int64Value.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/Int64Value.cs index b7559a43067..c8ad0c2ecca 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/Int64Value.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/Int64Value.cs @@ -45,6 +45,7 @@ internal Int64Value(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, _endpoint = endpoint; } + /// The GetInt64Value method. /// The cancellation token to use. /// public virtual async Task>> GetInt64ValueAsync(CancellationToken cancellationToken = default) @@ -62,6 +63,7 @@ public virtual async Task>> GetInt64V return Response.FromValue(value, response); } + /// The GetInt64Value method. /// The cancellation token to use. /// public virtual Response> GetInt64Value(CancellationToken cancellationToken = default) @@ -149,6 +151,7 @@ public virtual Response GetInt64Value(RequestContext context) } } + /// The Put method. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. @@ -163,6 +166,7 @@ public virtual async Task PutAsync(IDictionary body, Can return response; } + /// The Put method. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/ModelValue.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/ModelValue.cs index 7fcb9a367df..b1804b9d800 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/ModelValue.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/ModelValue.cs @@ -46,6 +46,7 @@ internal ModelValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, _endpoint = endpoint; } + /// The GetModelValue method. /// The cancellation token to use. /// public virtual async Task>> GetModelValueAsync(CancellationToken cancellationToken = default) @@ -63,6 +64,7 @@ public virtual async Task>> Get return Response.FromValue(value, response); } + /// The GetModelValue method. /// The cancellation token to use. /// public virtual Response> GetModelValue(CancellationToken cancellationToken = default) @@ -150,6 +152,7 @@ public virtual Response GetModelValue(RequestContext context) } } + /// The Put method. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. @@ -164,6 +167,7 @@ public virtual async Task PutAsync(IDictionary bod return response; } + /// The Put method. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/NullableFloatValue.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/NullableFloatValue.cs index ab42f4486b5..6318c5e97c7 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/NullableFloatValue.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/NullableFloatValue.cs @@ -45,6 +45,7 @@ internal NullableFloatValue(ClientDiagnostics clientDiagnostics, HttpPipeline pi _endpoint = endpoint; } + /// The GetNullableFloatValue method. /// The cancellation token to use. /// public virtual async Task>> GetNullableFloatValueAsync(CancellationToken cancellationToken = default) @@ -69,6 +70,7 @@ internal NullableFloatValue(ClientDiagnostics clientDiagnostics, HttpPipeline pi return Response.FromValue(value, response); } + /// The GetNullableFloatValue method. /// The cancellation token to use. /// public virtual Response> GetNullableFloatValue(CancellationToken cancellationToken = default) @@ -163,6 +165,7 @@ public virtual Response GetNullableFloatValue(RequestContext context) } } + /// The Put method. /// The where TKey is of type , where TValue is of type ? to use. /// The cancellation token to use. /// is null. @@ -177,6 +180,7 @@ public virtual async Task PutAsync(IDictionary body, C return response; } + /// The Put method. /// The where TKey is of type , where TValue is of type ? to use. /// The cancellation token to use. /// is null. diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/RecursiveModelValue.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/RecursiveModelValue.cs index 0de34e7c693..c56d2e576bb 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/RecursiveModelValue.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/RecursiveModelValue.cs @@ -46,6 +46,7 @@ internal RecursiveModelValue(ClientDiagnostics clientDiagnostics, HttpPipeline p _endpoint = endpoint; } + /// The GetRecursiveModelValue method. /// The cancellation token to use. /// public virtual async Task>> GetRecursiveModelValueAsync(CancellationToken cancellationToken = default) @@ -63,6 +64,7 @@ public virtual async Task>> Get return Response.FromValue(value, response); } + /// The GetRecursiveModelValue method. /// The cancellation token to use. /// public virtual Response> GetRecursiveModelValue(CancellationToken cancellationToken = default) @@ -150,6 +152,7 @@ public virtual Response GetRecursiveModelValue(RequestContext context) } } + /// The Put method. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. @@ -164,6 +167,7 @@ public virtual async Task PutAsync(IDictionary bod return response; } + /// The Put method. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/StringValue.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/StringValue.cs index 7ec94dbbe2d..ef628ac282b 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/StringValue.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/StringValue.cs @@ -45,6 +45,7 @@ internal StringValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, _endpoint = endpoint; } + /// The GetStringValue method. /// The cancellation token to use. /// public virtual async Task>> GetStringValueAsync(CancellationToken cancellationToken = default) @@ -62,6 +63,7 @@ public virtual async Task>> GetStri return Response.FromValue(value, response); } + /// The GetStringValue method. /// The cancellation token to use. /// public virtual Response> GetStringValue(CancellationToken cancellationToken = default) @@ -149,6 +151,7 @@ public virtual Response GetStringValue(RequestContext context) } } + /// The Put method. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. @@ -163,6 +166,7 @@ public virtual async Task PutAsync(IDictionary body, C return response; } + /// The Put method. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/UnknownValue.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/UnknownValue.cs index a9ef3b98eee..9b99c68da9b 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/UnknownValue.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/UnknownValue.cs @@ -45,6 +45,7 @@ internal UnknownValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline _endpoint = endpoint; } + /// The GetUnknownValue method. /// The cancellation token to use. /// public virtual async Task>> GetUnknownValueAsync(CancellationToken cancellationToken = default) @@ -69,6 +70,7 @@ public virtual async Task>> Get return Response.FromValue(value, response); } + /// The GetUnknownValue method. /// The cancellation token to use. /// public virtual Response> GetUnknownValue(CancellationToken cancellationToken = default) @@ -163,6 +165,7 @@ public virtual Response GetUnknownValue(RequestContext context) } } + /// The Put method. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. @@ -177,6 +180,7 @@ public virtual async Task PutAsync(IDictionary bod return response; } + /// The Put method. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. diff --git a/test/UnbrandedProjects.Tests/BinaryContentHelperTests.cs b/test/UnbrandedProjects.Tests/BinaryContentHelperTests.cs new file mode 100644 index 00000000000..b59ff19667f --- /dev/null +++ b/test/UnbrandedProjects.Tests/BinaryContentHelperTests.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Text.Json; +using System.Xml; +using AutoRest.TestServer.Tests.Infrastructure; +using NUnit.Framework; +using UnbrandedTypeSpec; + +namespace UnbrandedProjects.Tests +{ + public class BinaryContentHelperTests + { + public static IEnumerable GetTimeSpanData() + { + yield return new TestCaseData(XmlConvert.ToTimeSpan("P123DT22H14M12.011S"), XmlConvert.ToTimeSpan("P163DT22H14M12.011S")); + } + + public static IEnumerable GetDateTimeData() + { + yield return new TestCaseData(DateTimeOffset.Parse("2022-08-26T18:38:00Z"), DateTimeOffset.Parse("2022-09-26T18:38:00Z")); + } + + public static IEnumerable GetOneDateTimeData() + { + yield return new TestCaseData(DateTimeOffset.Parse("2022-08-26T18:38:00Z")); + } + + public static object[] BinaryDataCases = + { + new object[] { BinaryData.FromString("\"test\"") }, + new object[] { new BinaryData(1)}, + new object[] { new BinaryData(1.1)}, + new object[] { new BinaryData(true)}, + new object[] { BinaryData.FromObjectAsJson(new {name="a", age=1})}, + new object[] { new BinaryData(DateTimeOffset.Parse("2022-08-26T18:38:00Z"))} + }; + + [TestCase(1, 2)] + [TestCase("a", "b")] + [TestCase(true, false)] + [TestCaseSource(nameof(GetTimeSpanData))] + [TestCaseSource(nameof(GetDateTimeData))] + public void TestGenericFromEnumerable(T expectedValue1, T expectedValue2) + { + var expectedList = new List { expectedValue1, expectedValue2 }; + var content = BinaryContentHelper.FromEnumerable(expectedList); + + var stream = new MemoryStream(); + content.WriteTo(stream, default); + stream.Position = 0; + + var document = JsonDocument.Parse(stream); + int count = 0; + foreach (var property in document.RootElement.EnumerateArray()) + { + if (typeof(T) == typeof(int)) + { + Assert.AreEqual(expectedList[count++], property.GetInt32()); + } + else if (typeof(T) == typeof(string)) + { + Assert.AreEqual(expectedList[count++], property.GetString()); + } + else if (typeof(T) == typeof(bool)) + { + Assert.AreEqual(expectedList[count++], property.GetBoolean()); + } + } + } + + [Test] + public void TestBinaryDataFromEnumerable() + { + var expectedList = new List { new BinaryData(1), new BinaryData("\"hello\""), null }; + var content = BinaryContentHelper.FromEnumerable(expectedList); + + var stream = new MemoryStream(); + content.WriteTo(stream, default); + stream.Position = 0; + + var document = JsonDocument.Parse(stream); + int count = 0; + foreach (var property in document.RootElement.EnumerateArray()) + { + if (property.ValueKind == JsonValueKind.Null) + { + Assert.IsNull(expectedList[count++]); + } + else + { + BinaryDataAssert.AreEqual(expectedList[count++], BinaryData.FromString(property.GetRawText())); + } + } + } + + [TestCase(1, 2)] + [TestCase("a", "b")] + [TestCase(true, false)] + [TestCaseSource(nameof(GetTimeSpanData))] + [TestCaseSource(nameof(GetDateTimeData))] + public void TestGenericFromDictionary(T expectedValue1, T expectedValue2) + { + var expectedDictionary = new Dictionary() + { + {"k1", expectedValue1 }, + {"k2", expectedValue2 } + }; + var content = BinaryContentHelper.FromDictionary(expectedDictionary); + + var stream = new MemoryStream(); + content.WriteTo(stream, default); + stream.Position = 0; + + var document = JsonDocument.Parse(stream); + int count = 1; + foreach (var property in document.RootElement.EnumerateObject()) + { + if (typeof(T) == typeof(int)) + { + Assert.AreEqual(expectedDictionary["k" + count++], property.Value.GetInt32()); + } + else if (typeof(T) == typeof(string)) + { + Assert.AreEqual(expectedDictionary["k" + count++], property.Value.GetString()); + } + else if (typeof(T) == typeof(bool)) + { + Assert.AreEqual(expectedDictionary["k" + count++], property.Value.GetBoolean()); + } + } + } + + [Test] + public void TestBinaryDataFromDictionary() + { + var expectedDictionary = new Dictionary() + { + {"k1", new BinaryData(1) }, + {"k2", new BinaryData("\"hello\"") }, + {"k3", null } + }; + + var content = BinaryContentHelper.FromDictionary(expectedDictionary); + + var stream = new MemoryStream(); + content.WriteTo(stream, default); + stream.Position = 0; + + var document = JsonDocument.Parse(stream); + int count = 1; + foreach (var property in document.RootElement.EnumerateObject()) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + Assert.IsNull(expectedDictionary["k" + count++]); + } + else + { + BinaryDataAssert.AreEqual(expectedDictionary["k" + count++], BinaryData.FromString(property.Value.GetRawText())); + } + } + } + + [TestCase("a")] + [TestCase(true)] + [TestCase(1)] + [TestCase(1.0)] + [TestCaseSource(nameof(GetOneDateTimeData))] + public void TestFromObject(T value) + { + var content = BinaryContentHelper.FromObject(value); + var stream = new MemoryStream(); + content.WriteTo(stream, default); + stream.Position = 0; + var document = JsonDocument.Parse(stream); + switch (value) + { + case string: + Assert.AreEqual(JsonValueKind.String, document.RootElement.ValueKind); + Assert.AreEqual($"\"{value}\"", document.RootElement.GetRawText()); + break; + case bool: + Assert.AreEqual(value, document.RootElement.GetBoolean()); + break; + case int: + Assert.AreEqual(value, document.RootElement.GetInt32()); + break; + case double: + Assert.AreEqual(value, document.RootElement.GetDouble()); + break; + case DateTimeOffset: + Assert.AreEqual(JsonValueKind.String, document.RootElement.ValueKind); + Assert.AreEqual(value, DateTimeOffset.Parse(document.RootElement.GetString())); + break; + } + } + + [TestCaseSource(nameof(BinaryDataCases))] + public void TestFromObjectForBinaryData(BinaryData value) + { + var content = BinaryContentHelper.FromObject(value); + var stream = new MemoryStream(); + content.WriteTo(stream, default); + stream.Position = 0; + var document = JsonDocument.Parse(stream); + BinaryDataAssert.AreEqual(value, BinaryData.FromString(document.RootElement.GetRawText())); + } + } +} diff --git a/test/UnbrandedProjects/Unbranded-TypeSpec/Unbranded-TypeSpec.tsp b/test/UnbrandedProjects/Unbranded-TypeSpec/Unbranded-TypeSpec.tsp index 9202ca1d995..8a736e4af6c 100644 --- a/test/UnbrandedProjects/Unbranded-TypeSpec/Unbranded-TypeSpec.tsp +++ b/test/UnbrandedProjects/Unbranded-TypeSpec/Unbranded-TypeSpec.tsp @@ -352,3 +352,9 @@ op stillConvenient(): void; @head @convenientAPI(true) op headAsBoolean(@path id: string): void; + +@route("/headAsBoolean") +@doc("head as boolean.") +@put +@convenientAPI(true) +op handleArray(@body body: string[]): string[]; diff --git a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/BinaryContentHelper.cs b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/BinaryContentHelper.cs new file mode 100644 index 00000000000..e698542535d --- /dev/null +++ b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/BinaryContentHelper.cs @@ -0,0 +1,119 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.Collections.Generic; +using System.Text.Json; + +namespace UnbrandedTypeSpec +{ + internal static class BinaryContentHelper + { + public static BinaryContent FromEnumerable(IEnumerable enumerable) + where T : notnull + { + Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); + content.JsonWriter.WriteStartArray(); + foreach (var item in enumerable) + { + content.JsonWriter.WriteObjectValue(item, ModelSerializationExtensions.WireOptions); + } + content.JsonWriter.WriteEndArray(); + + return content; + } + + public static BinaryContent FromEnumerable(IEnumerable enumerable) + { + Utf8JsonBinaryContent content = new 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 (JsonDocument document = JsonDocument.Parse(item)) + { + JsonSerializer.Serialize(content.JsonWriter, document.RootElement); + } +#endif + } + } + content.JsonWriter.WriteEndArray(); + + return content; + } + + public static BinaryContent FromDictionary(IDictionary dictionary) + where TValue : notnull + { + 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.WriteEndObject(); + + return content; + } + + public static BinaryContent FromDictionary(IDictionary dictionary) + { + Utf8JsonBinaryContent content = new 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 (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(content.JsonWriter, document.RootElement); + } +#endif + } + } + content.JsonWriter.WriteEndObject(); + + return content; + } + + public static BinaryContent FromObject(object value) + { + Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); + content.JsonWriter.WriteObjectValue(value, ModelSerializationExtensions.WireOptions); + return content; + } + + public static BinaryContent FromObject(BinaryData value) + { + Utf8JsonBinaryContent content = new Utf8JsonBinaryContent(); +#if NET6_0_OR_GREATER + content.JsonWriter.WriteRawValue(value); +#else + using (JsonDocument document = JsonDocument.Parse(value)) + { + JsonSerializer.Serialize(content.JsonWriter, document.RootElement); + } +#endif + return content; + } + } +} diff --git a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/Utf8JsonBinaryContent.cs b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/Utf8JsonBinaryContent.cs new file mode 100644 index 00000000000..ea26d5655b9 --- /dev/null +++ b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/Internal/Utf8JsonBinaryContent.cs @@ -0,0 +1,52 @@ +// + +#nullable disable + +using System.ClientModel; +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; + +namespace UnbrandedTypeSpec +{ + internal class Utf8JsonBinaryContent : BinaryContent + { + private readonly MemoryStream _stream; + private readonly BinaryContent _content; + + public Utf8JsonBinaryContent() + { + _stream = new MemoryStream(); + _content = Create(_stream); + JsonWriter = new Utf8JsonWriter(_stream); + } + + public Utf8JsonWriter JsonWriter { get; } + + public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) + { + await JsonWriter.FlushAsync().ConfigureAwait(false); + await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); + } + + public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) + { + JsonWriter.Flush(); + _content.WriteTo(stream, cancellationToken); + } + + public override bool TryComputeLength(out long length) + { + length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; + return true; + } + + public override void Dispose() + { + JsonWriter.Dispose(); + _content.Dispose(); + _stream.Dispose(); + } + } +} diff --git a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/UnbrandedTypeSpecClient.cs b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/UnbrandedTypeSpecClient.cs index b969885fd53..0328dc3e2cd 100644 --- a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/UnbrandedTypeSpecClient.cs +++ b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/UnbrandedTypeSpecClient.cs @@ -5,6 +5,8 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; using System.Threading.Tasks; using UnbrandedTypeSpec.Models; @@ -103,12 +105,13 @@ public virtual ClientResult SayHi(string headParameter, string queryParameter, s return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// Return hi again. + /// The HelloAgain method. /// The to use. /// The to use. /// The to use. /// , or is null. /// is an empty string, and was expected to be non-empty. + /// Return hi again. public virtual async Task> HelloAgainAsync(string p2, string p1, RoundTripModel action) { Argument.AssertNotNullOrEmpty(p2, nameof(p2)); @@ -120,12 +123,13 @@ public virtual async Task> HelloAgainAsync(string p return ClientResult.FromValue(RoundTripModel.FromResponse(result.GetRawResponse()), result.GetRawResponse()); } - /// Return hi again. + /// The HelloAgain method. /// The to use. /// The to use. /// The to use. /// , or is null. /// is an empty string, and was expected to be non-empty. + /// Return hi again. public virtual ClientResult HelloAgain(string p2, string p1, RoundTripModel action) { Argument.AssertNotNullOrEmpty(p2, nameof(p2)); @@ -259,14 +263,16 @@ public virtual ClientResult NoContentType(string p2, string p1, BinaryContent co return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// Return hi in demo2. + /// The HelloDemo2 method. + /// Return hi in demo2. public virtual async Task> HelloDemo2Async() { ClientResult result = await HelloDemo2Async(null).ConfigureAwait(false); return ClientResult.FromValue(Thing.FromResponse(result.GetRawResponse()), result.GetRawResponse()); } - /// Return hi in demo2. + /// The HelloDemo2 method. + /// Return hi in demo2. public virtual ClientResult HelloDemo2() { ClientResult result = HelloDemo2(null); @@ -321,9 +327,10 @@ public virtual ClientResult HelloDemo2(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// Create with literal value. + /// The CreateLiteral method. /// The to use. /// is null. + /// Create with literal value. public virtual async Task> CreateLiteralAsync(Thing body) { Argument.AssertNotNull(body, nameof(body)); @@ -333,9 +340,10 @@ public virtual async Task> CreateLiteralAsync(Thing body) return ClientResult.FromValue(Thing.FromResponse(result.GetRawResponse()), result.GetRawResponse()); } - /// Create with literal value. + /// The CreateLiteral method. /// The to use. /// is null. + /// Create with literal value. public virtual ClientResult CreateLiteral(Thing body) { Argument.AssertNotNull(body, nameof(body)); @@ -401,14 +409,16 @@ public virtual ClientResult CreateLiteral(BinaryContent content, RequestOptions return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// Send literal parameters. + /// The HelloLiteral method. + /// Send literal parameters. public virtual async Task> HelloLiteralAsync() { ClientResult result = await HelloLiteralAsync(null).ConfigureAwait(false); return ClientResult.FromValue(Thing.FromResponse(result.GetRawResponse()), result.GetRawResponse()); } - /// Send literal parameters. + /// The HelloLiteral method. + /// Send literal parameters. public virtual ClientResult HelloLiteral() { ClientResult result = HelloLiteral(null); @@ -463,16 +473,18 @@ public virtual ClientResult HelloLiteral(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// top level method. + /// The TopAction method. /// The to use. + /// top level method. public virtual async Task> TopActionAsync(DateTimeOffset action) { ClientResult result = await TopActionAsync(action, null).ConfigureAwait(false); return ClientResult.FromValue(Thing.FromResponse(result.GetRawResponse()), result.GetRawResponse()); } - /// top level method. + /// The TopAction method. /// The to use. + /// top level method. public virtual ClientResult TopAction(DateTimeOffset action) { ClientResult result = TopAction(action, null); @@ -613,9 +625,10 @@ public virtual ClientResult PatchAction(BinaryContent content, RequestOptions op return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// body parameter without body decorator. + /// The AnonymousBody method. /// A model with a few properties of literal types. /// is null. + /// body parameter without body decorator. public virtual async Task> AnonymousBodyAsync(Thing thing) { Argument.AssertNotNull(thing, nameof(thing)); @@ -625,9 +638,10 @@ public virtual async Task> AnonymousBodyAsync(Thing thing) return ClientResult.FromValue(Thing.FromResponse(result.GetRawResponse()), result.GetRawResponse()); } - /// body parameter without body decorator. + /// The AnonymousBody method. /// A model with a few properties of literal types. /// is null. + /// body parameter without body decorator. public virtual ClientResult AnonymousBody(Thing thing) { Argument.AssertNotNull(thing, nameof(thing)); @@ -693,9 +707,10 @@ public virtual ClientResult AnonymousBody(BinaryContent content, RequestOptions return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// Model can have its friendly name. + /// The FriendlyModel method. /// this is not a friendly model but with a friendly name. /// is null. + /// Model can have its friendly name. public virtual async Task> FriendlyModelAsync(Friend friend) { Argument.AssertNotNull(friend, nameof(friend)); @@ -705,9 +720,10 @@ public virtual async Task> FriendlyModelAsync(Friend friend return ClientResult.FromValue(Friend.FromResponse(result.GetRawResponse()), result.GetRawResponse()); } - /// Model can have its friendly name. + /// The FriendlyModel method. /// this is not a friendly model but with a friendly name. /// is null. + /// Model can have its friendly name. public virtual ClientResult FriendlyModel(Friend friend) { Argument.AssertNotNull(friend, nameof(friend)); @@ -811,10 +827,11 @@ public virtual ClientResult AddTimeHeader(RequestOptions options = null) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// parameter has string format. + /// The StringFormat method. /// The to use. /// The to use. /// is null. + /// parameter has string format. public virtual async Task StringFormatAsync(Guid subscriptionId, ModelWithFormat body) { Argument.AssertNotNull(body, nameof(body)); @@ -824,10 +841,11 @@ public virtual async Task StringFormatAsync(Guid subscriptionId, M return result; } - /// parameter has string format. + /// The StringFormat method. /// The to use. /// The to use. /// is null. + /// parameter has string format. public virtual ClientResult StringFormat(Guid subscriptionId, ModelWithFormat body) { Argument.AssertNotNull(body, nameof(body)); @@ -895,9 +913,10 @@ public virtual ClientResult StringFormat(Guid subscriptionId, BinaryContent cont return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// Model can have its projected name. + /// The ProjectedNameModel method. /// this is a model with a projected name. /// is null. + /// Model can have its projected name. public virtual async Task> ProjectedNameModelAsync(ProjectedModel projectedModel) { Argument.AssertNotNull(projectedModel, nameof(projectedModel)); @@ -907,9 +926,10 @@ public virtual async Task> ProjectedNameModelAsync( return ClientResult.FromValue(ProjectedModel.FromResponse(result.GetRawResponse()), result.GetRawResponse()); } - /// Model can have its projected name. + /// The ProjectedNameModel method. /// this is a model with a projected name. /// is null. + /// Model can have its projected name. public virtual ClientResult ProjectedNameModel(ProjectedModel projectedModel) { Argument.AssertNotNull(projectedModel, nameof(projectedModel)); @@ -975,14 +995,16 @@ public virtual ClientResult ProjectedNameModel(BinaryContent content, RequestOpt return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// return anonymous model. + /// The ReturnsAnonymousModel method. + /// return anonymous model. public virtual async Task> ReturnsAnonymousModelAsync() { ClientResult result = await ReturnsAnonymousModelAsync(null).ConfigureAwait(false); return ClientResult.FromValue(ReturnsAnonymousModelResponse.FromResponse(result.GetRawResponse()), result.GetRawResponse()); } - /// return anonymous model. + /// The ReturnsAnonymousModel method. + /// return anonymous model. public virtual ClientResult ReturnsAnonymousModel() { ClientResult result = ReturnsAnonymousModel(null); @@ -1083,9 +1105,10 @@ public virtual ClientResult CreateUnknownValue(BinaryContent content, RequestOpt return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// When set protocol false and convenient true, then the protocol method should be internal. + /// The InternalProtocol method. /// The to use. /// is null. + /// When set protocol false and convenient true, then the protocol method should be internal. public virtual async Task> InternalProtocolAsync(Thing body) { Argument.AssertNotNull(body, nameof(body)); @@ -1095,9 +1118,10 @@ public virtual async Task> InternalProtocolAsync(Thing body) return ClientResult.FromValue(Thing.FromResponse(result.GetRawResponse()), result.GetRawResponse()); } - /// When set protocol false and convenient true, then the protocol method should be internal. + /// The InternalProtocol method. /// The to use. /// is null. + /// When set protocol false and convenient true, then the protocol method should be internal. public virtual ClientResult InternalProtocol(Thing body) { Argument.AssertNotNull(body, nameof(body)); @@ -1153,14 +1177,16 @@ internal virtual ClientResult InternalProtocol(BinaryContent content, RequestOpt return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// When set protocol false and convenient true, the convenient method should be generated even it has the same signature as protocol one. + /// The StillConvenientValue method. + /// When set protocol false and convenient true, the convenient method should be generated even it has the same signature as protocol one. public virtual async Task StillConvenientValueAsync() { ClientResult result = await StillConvenientAsync(null).ConfigureAwait(false); return result; } - /// When set protocol false and convenient true, the convenient method should be generated even it has the same signature as protocol one. + /// The StillConvenientValue method. + /// When set protocol false and convenient true, the convenient method should be generated even it has the same signature as protocol one. public virtual ClientResult StillConvenientValue() { ClientResult result = StillConvenient(null); @@ -1257,6 +1283,104 @@ public virtual ClientResult HeadAsBoolean(string id, RequestOptions option return ClientResult.FromValue(result.Value, result.GetRawResponse()); } + /// The HandleArray method. + /// The where T is of type to use. + /// is null. + /// head as boolean. + public virtual async Task>> HandleArrayAsync(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = await HandleArrayAsync(content, null).ConfigureAwait(false); + IReadOnlyList value = default; + using var document = await JsonDocument.ParseAsync(result.GetRawResponse().ContentStream, default, default).ConfigureAwait(false); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(item.GetString()); + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// The HandleArray method. + /// The where T is of type to use. + /// is null. + /// head as boolean. + public virtual ClientResult> HandleArray(IEnumerable body) + { + Argument.AssertNotNull(body, nameof(body)); + + using BinaryContent content = BinaryContentHelper.FromEnumerable(body); + ClientResult result = HandleArray(content, null); + IReadOnlyList value = default; + using var document = JsonDocument.Parse(result.GetRawResponse().ContentStream); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(item.GetString()); + } + value = array; + return ClientResult.FromValue(value, result.GetRawResponse()); + } + + /// + /// [Protocol Method] head as boolean. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task HandleArrayAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreateHandleArrayRequest(content, options); + return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// + /// [Protocol Method] head as boolean. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult HandleArray(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreateHandleArrayRequest(content, options); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); + } + internal PipelineMessage CreateSayHiRequest(string headParameter, string queryParameter, string optionalQuery, RequestOptions options) { var message = _pipeline.CreateMessage(); @@ -1636,6 +1760,26 @@ internal PipelineMessage CreateHeadAsBooleanRequest(string id, RequestOptions op return message; } + internal PipelineMessage CreateHandleArrayRequest(BinaryContent content, RequestOptions options) + { + var message = _pipeline.CreateMessage(); + message.ResponseClassifier = PipelineMessageClassifier200; + var request = message.Request; + request.Method = "PUT"; + var uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/headAsBoolean", false); + request.Uri = uri.ToUri(); + request.Headers.Set("Accept", "application/json"); + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + if (options != null) + { + message.Apply(options); + } + return message; + } + private static PipelineMessageClassifier _pipelineMessageClassifier200; private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); private static PipelineMessageClassifier _pipelineMessageClassifier204; From 8973c0b37881ae7e5ff9749b24030c6f86c3fc40 Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Thu, 18 Apr 2024 13:36:28 +0800 Subject: [PATCH 11/19] refine test cases --- test/CadlRanchProjects.Tests/type-array.cs | 4 ++-- test/CadlRanchProjectsNonAzure.Tests/type-array.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/CadlRanchProjects.Tests/type-array.cs b/test/CadlRanchProjects.Tests/type-array.cs index 84d3c3a5659..8d428d945fc 100644 --- a/test/CadlRanchProjects.Tests/type-array.cs +++ b/test/CadlRanchProjects.Tests/type-array.cs @@ -137,8 +137,8 @@ public Task Type_Array_ModelValue_get() => Test(async (host) => { var response = await new ArrayClient(host, null).GetModelValueClient().GetModelValueAsync(); Assert.AreEqual(2, response.Value.Count); - Assert.AreEqual("hello", response.Value.First().Property); - Assert.AreEqual("world", response.Value.Last().Property); + Assert.AreEqual("hello", response.Value[0].Property); + Assert.AreEqual("world", response.Value[1].Property); }); [Test] diff --git a/test/CadlRanchProjectsNonAzure.Tests/type-array.cs b/test/CadlRanchProjectsNonAzure.Tests/type-array.cs index 32b314dc827..fa95daf553e 100644 --- a/test/CadlRanchProjectsNonAzure.Tests/type-array.cs +++ b/test/CadlRanchProjectsNonAzure.Tests/type-array.cs @@ -137,8 +137,8 @@ public Task Type_Array_ModelValue_get() => Test(async (host) => { var response = await new ArrayClient(host, null).GetModelValueClient().GetModelValueAsync(); Assert.AreEqual(2, response.Value.Count); - Assert.AreEqual("hello", response.Value.First().Property); - Assert.AreEqual("world", response.Value.Last().Property); + Assert.AreEqual("hello", response.Value[0].Property); + Assert.AreEqual("world", response.Value[1].Property); }); [Test] From c29c5eacfe509170a5acebb121ffb30e962bf74a Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Thu, 18 Apr 2024 13:38:48 +0800 Subject: [PATCH 12/19] more refinement for test cases --- test/AutoRest.Shared.Tests/RequestContentHelperTests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/AutoRest.Shared.Tests/RequestContentHelperTests.cs b/test/AutoRest.Shared.Tests/RequestContentHelperTests.cs index cb47cb942ae..f1cf588b50f 100644 --- a/test/AutoRest.Shared.Tests/RequestContentHelperTests.cs +++ b/test/AutoRest.Shared.Tests/RequestContentHelperTests.cs @@ -23,8 +23,8 @@ public static IEnumerable GetDateTimeData() [TestCase(1, 2)] [TestCase("a", "b")] [TestCase(true, false)] - [TestCaseSource("GetTimeSpanData")] - [TestCaseSource("GetDateTimeData")] + [TestCaseSource(nameof(GetTimeSpanData))] + [TestCaseSource(nameof(GetDateTimeData))] public void TestGenericFromEnumerable(T expectedValue1, T expectedValue2) { var expectedList = new List { expectedValue1, expectedValue2 }; @@ -81,8 +81,8 @@ public void TestBinaryDataFromEnumerable() [TestCase(1, 2)] [TestCase("a", "b")] [TestCase(true, false)] - [TestCaseSource("GetTimeSpanData")] - [TestCaseSource("GetDateTimeData")] + [TestCaseSource(nameof(GetTimeSpanData))] + [TestCaseSource(nameof(GetDateTimeData))] public void TestGenericFromDictionary(T expectedValue1, T expectedValue2) { var expectedDictionary = new Dictionary() From f96fdcf9d58c4b97c4b4ba8de2bf7cf112e1a32f Mon Sep 17 00:00:00 2001 From: ArcturusZhang Date: Fri, 19 Apr 2024 00:02:05 +0800 Subject: [PATCH 13/19] fix namespace issue --- .../{Type.Dictionary.sln => _Type._Dictionary.sln} | 4 ++-- .../type/dictionary/src/Generated/BooleanValue.cs | 2 +- .../type/dictionary/src/Generated/Configuration.json | 4 ++-- .../type/dictionary/src/Generated/DatetimeValue.cs | 2 +- .../type/dictionary/src/Generated/DictionaryClient.cs | 2 +- .../dictionary/src/Generated/DictionaryClientOptions.cs | 2 +- .../type/dictionary/src/Generated/DurationValue.cs | 2 +- .../type/dictionary/src/Generated/Float32Value.cs | 2 +- .../type/dictionary/src/Generated/Int32Value.cs | 2 +- .../type/dictionary/src/Generated/Int64Value.cs | 2 +- .../type/dictionary/src/Generated/Internal/Argument.cs | 4 ++-- .../src/Generated/Internal/BinaryContentHelper.cs | 2 +- .../src/Generated/Internal/ChangeTrackingDictionary.cs | 2 +- .../dictionary/src/Generated/Internal/ChangeTrackingList.cs | 2 +- .../src/Generated/Internal/ClientPipelineExtensions.cs | 2 +- .../dictionary/src/Generated/Internal/ClientUriBuilder.cs | 2 +- .../type/dictionary/src/Generated/Internal/ErrorResult.cs | 2 +- .../src/Generated/Internal/ModelSerializationExtensions.cs | 2 +- .../type/dictionary/src/Generated/Internal/Optional.cs | 2 +- .../src/Generated/Internal/Utf8JsonBinaryContent.cs | 2 +- .../type/dictionary/src/Generated/ModelValue.cs | 4 ++-- .../src/Generated/Models/InnerModel.Serialization.cs | 2 +- .../type/dictionary/src/Generated/Models/InnerModel.cs | 2 +- .../type/dictionary/src/Generated/NullableFloatValue.cs | 2 +- .../type/dictionary/src/Generated/RecursiveModelValue.cs | 4 ++-- .../type/dictionary/src/Generated/StringValue.cs | 2 +- .../type/dictionary/src/Generated/UnknownValue.cs | 2 +- .../type/dictionary/src/Properties/AssemblyInfo.cs | 2 +- .../{Type.Dictionary.csproj => _Type._Dictionary.csproj} | 6 +++--- ...ctionary.Tests.csproj => _Type._Dictionary.Tests.csproj} | 2 +- .../type/dictionary/tspconfig.yaml | 3 +++ 31 files changed, 40 insertions(+), 37 deletions(-) rename test/CadlRanchProjectsNonAzure/type/dictionary/{Type.Dictionary.sln => _Type._Dictionary.sln} (90%) rename test/CadlRanchProjectsNonAzure/type/dictionary/src/{Type.Dictionary.csproj => _Type._Dictionary.csproj} (63%) rename test/CadlRanchProjectsNonAzure/type/dictionary/tests/{Type.Dictionary.Tests.csproj => _Type._Dictionary.Tests.csproj} (89%) create mode 100644 test/CadlRanchProjectsNonAzure/type/dictionary/tspconfig.yaml diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/Type.Dictionary.sln b/test/CadlRanchProjectsNonAzure/type/dictionary/_Type._Dictionary.sln similarity index 90% rename from test/CadlRanchProjectsNonAzure/type/dictionary/Type.Dictionary.sln rename to test/CadlRanchProjectsNonAzure/type/dictionary/_Type._Dictionary.sln index ec6661476a8..c067512da4b 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/Type.Dictionary.sln +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/_Type._Dictionary.sln @@ -2,9 +2,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29709.97 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Type.Dictionary", "src\Type.Dictionary.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_Type._Dictionary", "src\_Type._Dictionary.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Type.Dictionary.Tests", "tests\Type.Dictionary.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_Type._Dictionary.Tests", "tests\_Type._Dictionary.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/BooleanValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/BooleanValue.cs index cbfed0dd822..a8b51a65b95 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/BooleanValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/BooleanValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace Type.Dictionary +namespace _Type._Dictionary { // Data plane generated sub-client. /// Dictionary of boolean values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Configuration.json b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Configuration.json index 5ff5292abac..db360878713 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Configuration.json +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Configuration.json @@ -1,7 +1,7 @@ { "output-folder": ".", - "namespace": "Type.Dictionary", - "library-name": "Type.Dictionary", + "namespace": "_Type._Dictionary", + "library-name": "_Type._Dictionary", "shared-source-folders": [ "../../../../../../artifacts/bin/AutoRest.CSharp/Debug/net7.0/Generator.Shared", "../../../../../../artifacts/bin/AutoRest.CSharp/Debug/net7.0/Azure.Core.Shared" diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DatetimeValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DatetimeValue.cs index b057a9e8272..ae98292fc97 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DatetimeValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DatetimeValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace Type.Dictionary +namespace _Type._Dictionary { // Data plane generated sub-client. /// Dictionary of datetime values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClient.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClient.cs index d4eb7adfc4b..a76c76b4eb2 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClient.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClient.cs @@ -6,7 +6,7 @@ using System.ClientModel.Primitives; using System.Threading; -namespace Type.Dictionary +namespace _Type._Dictionary { // Data plane generated client. /// The Dictionary service client. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClientOptions.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClientOptions.cs index c8ed98b06d5..e34a8ac9fcd 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClientOptions.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClientOptions.cs @@ -4,7 +4,7 @@ using System.ClientModel.Primitives; -namespace Type.Dictionary +namespace _Type._Dictionary { /// Client options for DictionaryClient. public partial class DictionaryClientOptions : ClientPipelineOptions diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DurationValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DurationValue.cs index 8f28c251790..0870e1b37c7 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DurationValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DurationValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace Type.Dictionary +namespace _Type._Dictionary { // Data plane generated sub-client. /// Dictionary of duration values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Float32Value.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Float32Value.cs index a77a87ce867..3c18acff450 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Float32Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Float32Value.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace Type.Dictionary +namespace _Type._Dictionary { // Data plane generated sub-client. /// Dictionary of float values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int32Value.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int32Value.cs index 4b7793a052b..c4abc1ada6c 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int32Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int32Value.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace Type.Dictionary +namespace _Type._Dictionary { // Data plane generated sub-client. /// Dictionary of int32 values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int64Value.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int64Value.cs index b6bc0e0cd8c..80d269566ff 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int64Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int64Value.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace Type.Dictionary +namespace _Type._Dictionary { // Data plane generated sub-client. /// Dictionary of int64 values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Argument.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Argument.cs index dbe4b67cebb..cb70bdce136 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Argument.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Argument.cs @@ -6,7 +6,7 @@ using System.Collections; using System.Collections.Generic; -namespace Type.Dictionary +namespace _Type._Dictionary { internal static class Argument { @@ -94,7 +94,7 @@ public static void AssertInRange(T value, T minimum, T maximum, string name) } } - public static void AssertEnumDefined(System.Type enumType, object value, string name) + public static void AssertEnumDefined(Type enumType, object value, string name) { if (!Enum.IsDefined(enumType, value)) { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/BinaryContentHelper.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/BinaryContentHelper.cs index 8d0fceb39a8..58c89671f76 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/BinaryContentHelper.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/BinaryContentHelper.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; using System.Text.Json; -namespace Type.Dictionary +namespace _Type._Dictionary { internal static class BinaryContentHelper { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingDictionary.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingDictionary.cs index 808273e57f0..083ecd92782 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingDictionary.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -6,7 +6,7 @@ using System.Collections; using System.Collections.Generic; -namespace Type.Dictionary +namespace _Type._Dictionary { internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingList.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingList.cs index 7ab0348e548..649c24aff0b 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingList.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingList.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; using System.Linq; -namespace Type.Dictionary +namespace _Type._Dictionary { internal class ChangeTrackingList : IList, IReadOnlyList { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientPipelineExtensions.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientPipelineExtensions.cs index 376866a8994..c1965985a3d 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientPipelineExtensions.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientPipelineExtensions.cs @@ -6,7 +6,7 @@ using System.ClientModel.Primitives; using System.Threading.Tasks; -namespace Type.Dictionary +namespace _Type._Dictionary { internal static class ClientPipelineExtensions { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientUriBuilder.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientUriBuilder.cs index f3811c23968..cc6ddca5e22 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientUriBuilder.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientUriBuilder.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Text; -namespace Type.Dictionary +namespace _Type._Dictionary { internal class ClientUriBuilder { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ErrorResult.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ErrorResult.cs index b6a5cf967cc..c56081417c5 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ErrorResult.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ErrorResult.cs @@ -5,7 +5,7 @@ using System.ClientModel; using System.ClientModel.Primitives; -namespace Type.Dictionary +namespace _Type._Dictionary { internal class ErrorResult : ClientResult { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ModelSerializationExtensions.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ModelSerializationExtensions.cs index 222ddcf4a3c..1d19345323e 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ModelSerializationExtensions.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ModelSerializationExtensions.cs @@ -10,7 +10,7 @@ using System.Text.Json; using System.Xml; -namespace Type.Dictionary +namespace _Type._Dictionary { internal static class ModelSerializationExtensions { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Optional.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Optional.cs index c72de41f119..1fd134b1e4f 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Optional.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Optional.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Text.Json; -namespace Type.Dictionary +namespace _Type._Dictionary { internal static class Optional { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Utf8JsonBinaryContent.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Utf8JsonBinaryContent.cs index 0b6d69d210f..ebb3e3a009a 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Utf8JsonBinaryContent.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Utf8JsonBinaryContent.cs @@ -8,7 +8,7 @@ using System.Threading; using System.Threading.Tasks; -namespace Type.Dictionary +namespace _Type._Dictionary { internal class Utf8JsonBinaryContent : BinaryContent { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/ModelValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/ModelValue.cs index b2c6e80e5ba..4f7b1d6f386 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/ModelValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/ModelValue.cs @@ -8,9 +8,9 @@ using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; -using Type.Dictionary.Models; +using _Type._Dictionary.Models; -namespace Type.Dictionary +namespace _Type._Dictionary { // Data plane generated sub-client. /// Dictionary of model values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.Serialization.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.Serialization.cs index 88f10b1ed72..4c78c340650 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.Serialization.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; -namespace Type.Dictionary.Models +namespace _Type._Dictionary.Models { public partial class InnerModel : IJsonModel { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.cs index c0d1f9e8c10..ed93f06e4a0 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; -namespace Type.Dictionary.Models +namespace _Type._Dictionary.Models { /// Dictionary inner model. public partial class InnerModel diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/NullableFloatValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/NullableFloatValue.cs index 6fbbb29de95..2c8962b9834 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/NullableFloatValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/NullableFloatValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace Type.Dictionary +namespace _Type._Dictionary { // Data plane generated sub-client. /// Dictionary of nullable float values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/RecursiveModelValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/RecursiveModelValue.cs index a868f7f0ef2..51dd6c870cd 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/RecursiveModelValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/RecursiveModelValue.cs @@ -8,9 +8,9 @@ using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; -using Type.Dictionary.Models; +using _Type._Dictionary.Models; -namespace Type.Dictionary +namespace _Type._Dictionary { // Data plane generated sub-client. /// Dictionary of model values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/StringValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/StringValue.cs index 41dc66a9808..01b8eec8407 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/StringValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/StringValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace Type.Dictionary +namespace _Type._Dictionary { // Data plane generated sub-client. /// Dictionary of string values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/UnknownValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/UnknownValue.cs index 26812bd96b3..73ed89a3f44 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/UnknownValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/UnknownValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace Type.Dictionary +namespace _Type._Dictionary { // Data plane generated sub-client. /// Dictionary of unknown values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Properties/AssemblyInfo.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Properties/AssemblyInfo.cs index 28e570ee6f6..8411ac7041a 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Properties/AssemblyInfo.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Properties/AssemblyInfo.cs @@ -3,4 +3,4 @@ using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("Type.Dictionary.Tests")] +[assembly: InternalsVisibleTo("_Type._Dictionary.Tests")] diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Type.Dictionary.csproj b/test/CadlRanchProjectsNonAzure/type/dictionary/src/_Type._Dictionary.csproj similarity index 63% rename from test/CadlRanchProjectsNonAzure/type/dictionary/src/Type.Dictionary.csproj rename to test/CadlRanchProjectsNonAzure/type/dictionary/src/_Type._Dictionary.csproj index f4280ff175e..703435ebbdd 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Type.Dictionary.csproj +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/_Type._Dictionary.csproj @@ -1,9 +1,9 @@ - This is the Type.Dictionary client library for developing .NET applications with rich experience. - SDK Code Generation Type.Dictionary + This is the _Type._Dictionary client library for developing .NET applications with rich experience. + SDK Code Generation _Type._Dictionary 1.0.0-beta.1 - Type.Dictionary + _Type._Dictionary netstandard2.0 latest true diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/tests/Type.Dictionary.Tests.csproj b/test/CadlRanchProjectsNonAzure/type/dictionary/tests/_Type._Dictionary.Tests.csproj similarity index 89% rename from test/CadlRanchProjectsNonAzure/type/dictionary/tests/Type.Dictionary.Tests.csproj rename to test/CadlRanchProjectsNonAzure/type/dictionary/tests/_Type._Dictionary.Tests.csproj index df5104a4100..4368c2dd6f2 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/tests/Type.Dictionary.Tests.csproj +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/tests/_Type._Dictionary.Tests.csproj @@ -6,7 +6,7 @@ - + diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/tspconfig.yaml b/test/CadlRanchProjectsNonAzure/type/dictionary/tspconfig.yaml new file mode 100644 index 00000000000..58d3a423f3c --- /dev/null +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/tspconfig.yaml @@ -0,0 +1,3 @@ +options: + "@azure-tools/typespec-csharp": + namespace: _Type._Dictionary From 2b1beb843cf1e98fda28096aadd2785fbf7f5deb Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Fri, 19 Apr 2024 10:25:52 +0800 Subject: [PATCH 14/19] revert a undesired change and add test cases for type/dictionary --- .../Output/OperationMethodChainBuilder.cs | 2 +- .../type-dictionary.cs | 11 + .../type-dictionary.cs | 241 ++++++++++++++++++ 3 files changed, 253 insertions(+), 1 deletion(-) create mode 100644 test/CadlRanchProjectsNonAzure.Tests/type-dictionary.cs diff --git a/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs b/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs index 402b78d056e..681cb8b659b 100644 --- a/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs +++ b/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs @@ -397,7 +397,7 @@ private ReturnTypeChain BuildReturnTypes() accessibility &= ~Public; // removes public if any accessibility |= Internal; // add internal } - var convenienceSignature = new MethodSignature(name, FormattableStringHelpers.FromString(_restClientMethod.Summary ?? $"The {name} method"), FormattableStringHelpers.FromString(_restClientMethod.Description), accessibility, _returnType.Convenience, null, parameterList, attributes); + var convenienceSignature = new MethodSignature(name, FormattableStringHelpers.FromString(_restClientMethod.Summary), FormattableStringHelpers.FromString(_restClientMethod.Description), accessibility, _returnType.Convenience, null, parameterList, attributes); var diagnostic = Configuration.IsBranded ? name != _restClientMethod.Name ? new Diagnostic($"{_clientName}.{convenienceSignature.Name}") : null : null; diff --git a/test/CadlRanchProjects.Tests/type-dictionary.cs b/test/CadlRanchProjects.Tests/type-dictionary.cs index 6b269c7dbc5..d4e5b60e84e 100644 --- a/test/CadlRanchProjects.Tests/type-dictionary.cs +++ b/test/CadlRanchProjects.Tests/type-dictionary.cs @@ -16,6 +16,7 @@ public class TypeDictionaryTests : CadlRanchTestBase public Task Dictionary_Int32Value_get() => Test(async (host) => { var response = await new DictionaryClient(host, null).GetInt32ValueClient().GetInt32ValueAsync(); + Assert.AreEqual(2, response.Value.Count); Assert.AreEqual(1, response.Value["k1"]); Assert.AreEqual(2, response.Value["k2"]); }); @@ -35,6 +36,7 @@ public Task Dictionary_Int32Value_put() => Test(async (host) => public Task Dictionary_Int64Value_get() => Test(async (host) => { var response = await new DictionaryClient(host, null).GetInt64ValueClient().GetInt64ValueAsync(); + Assert.AreEqual(2, response.Value.Count); Assert.AreEqual(9007199254740991, response.Value["k1"]); Assert.AreEqual(-9007199254740991, response.Value["k2"]); }); @@ -54,6 +56,7 @@ public Task Dictionary_Int64Value_put() => Test(async (host) => public Task Dictionary_BooleanValue_get() => Test(async (host) => { var response = await new DictionaryClient(host, null).GetBooleanValueClient().GetBooleanValueAsync(); + Assert.AreEqual(2, response.Value.Count); Assert.AreEqual(true, response.Value["k1"]); Assert.AreEqual(false, response.Value["k2"]); }); @@ -73,6 +76,7 @@ public Task Dictionary_BooleanValue_put() => Test(async (host) => public Task Dictionary_StringValue_get() => Test(async (host) => { var response = await new DictionaryClient(host, null).GetStringValueClient().GetStringValueAsync(); + Assert.AreEqual(2, response.Value.Count); Assert.AreEqual("hello", response.Value["k1"]); Assert.AreEqual("", response.Value["k2"]); }); @@ -92,6 +96,7 @@ public Task Dictionary_StringValue_put() => Test(async (host) => public Task Dictionary_Float32Value_get() => Test(async (host) => { var response = await new DictionaryClient(host, null).GetFloat32ValueClient().GetFloat32ValueAsync(); + Assert.AreEqual(1, response.Value.Count); Assert.AreEqual(43.125f, response.Value["k1"]); }); @@ -109,6 +114,7 @@ public Task Dictionary_Float32Value_put() => Test(async (host) => public Task Dictionary_DatetimeValue_get() => Test(async (host) => { var response = await new DictionaryClient(host, null).GetDatetimeValueClient().GetDatetimeValueAsync(); + Assert.AreEqual(1, response.Value.Count); Assert.AreEqual(DateTimeOffset.Parse("2022-08-26T18:38:00Z"), response.Value["k1"]); }); @@ -126,6 +132,7 @@ public Task Dictionary_DatetimeValue_put() => Test(async (host) => public Task Dictionary_DurationValue_get() => Test(async (host) => { var response = await new DictionaryClient(host, null).GetDurationValueClient().GetDurationValueAsync(); + Assert.AreEqual(1, response.Value.Count); Assert.AreEqual(XmlConvert.ToTimeSpan("P123DT22H14M12.011S"), response.Value["k1"]); }); @@ -143,6 +150,7 @@ public Task Dictionary_DurationValue_put() => Test(async (host) => public Task Dictionary_UnknownValue_get() => Test(async (host) => { var response = await new DictionaryClient(host, null).GetUnknownValueClient().GetUnknownValueAsync(); + Assert.AreEqual(3, response.Value.Count); Assert.AreEqual(1, response.Value["k1"].ToObjectFromJson()); Assert.AreEqual("hello", response.Value["k2"].ToObjectFromJson()); Assert.AreEqual(null, response.Value["k3"]); @@ -164,6 +172,7 @@ public Task Dictionary_UnknownValue_put() => Test(async (host) => public Task Dictionary_ModelValue_get() => Test(async (host) => { var response = await new DictionaryClient(host, null).GetModelValueClient().GetModelValueAsync(); + Assert.AreEqual(2, response.Value.Count); Assert.AreEqual("hello", response.Value["k1"].Property); Assert.AreEqual("world", response.Value["k2"].Property); }); @@ -183,6 +192,7 @@ public Task Dictionary_ModelValue_put() => Test(async (host) => public Task Dictionary_RecursiveModelValue_get() => Test(async (host) => { var response = await new DictionaryClient(host, null).GetRecursiveModelValueClient().GetRecursiveModelValueAsync(); + Assert.AreEqual(2, response.Value.Count); Assert.AreEqual("hello", response.Value["k1"].Property); Assert.AreEqual(0, response.Value["k1"].Children.Count); Assert.AreEqual("world", response.Value["k2"].Property); @@ -212,6 +222,7 @@ public Task Dictionary_RecursiveModelValue_put() => Test(async (host) => public Task Type_Dictionary_NullableFloatValue_get() => Test(async (host) => { var response = await new DictionaryClient(host, null).GetNullableFloatValueClient().GetNullableFloatValueAsync(); + Assert.AreEqual(3, response.Value.Count); Assert.AreEqual(1.25f, response.Value["k1"]); Assert.AreEqual(0.5f, response.Value["k2"]); Assert.AreEqual(null, response.Value["k3"]); diff --git a/test/CadlRanchProjectsNonAzure.Tests/type-dictionary.cs b/test/CadlRanchProjectsNonAzure.Tests/type-dictionary.cs new file mode 100644 index 00000000000..7c060cd8eb2 --- /dev/null +++ b/test/CadlRanchProjectsNonAzure.Tests/type-dictionary.cs @@ -0,0 +1,241 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using System.Xml; +using _Type._Dictionary; +using _Type._Dictionary.Models; +using AutoRest.TestServer.Tests.Infrastructure; +using NUnit.Framework; + +namespace CadlRanchProjectsNonAzure.Tests +{ + public class TypeDictionaryTests : CadlRanchTestBase + { + [Test] + public Task Dictionary_Int32Value_get() => Test(async (host) => + { + var response = await new DictionaryClient(host, null).GetInt32ValueClient().GetInt32ValueAsync(); + Assert.AreEqual(2, response.Value.Count); + Assert.AreEqual(1, response.Value["k1"]); + Assert.AreEqual(2, response.Value["k2"]); + }); + + [Test] + public Task Dictionary_Int32Value_put() => Test(async (host) => + { + var response = await new DictionaryClient(host, null).GetInt32ValueClient().PutAsync(new Dictionary() + { + {"k1", 1 }, + {"k2", 2 } + }); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [Test] + public Task Dictionary_Int64Value_get() => Test(async (host) => + { + var response = await new DictionaryClient(host, null).GetInt64ValueClient().GetInt64ValueAsync(); + Assert.AreEqual(2, response.Value.Count); + Assert.AreEqual(9007199254740991, response.Value["k1"]); + Assert.AreEqual(-9007199254740991, response.Value["k2"]); + }); + + [Test] + public Task Dictionary_Int64Value_put() => Test(async (host) => + { + var response = await new DictionaryClient(host, null).GetInt64ValueClient().PutAsync(new Dictionary() + { + {"k1", 9007199254740991 }, + {"k2", -9007199254740991 } + }); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [Test] + public Task Dictionary_BooleanValue_get() => Test(async (host) => + { + var response = await new DictionaryClient(host, null).GetBooleanValueClient().GetBooleanValueAsync(); + Assert.AreEqual(true, response.Value["k1"]); + Assert.AreEqual(false, response.Value["k2"]); + }); + + [Test] + public Task Dictionary_BooleanValue_put() => Test(async (host) => + { + var response = await new DictionaryClient(host, null).GetBooleanValueClient().PutAsync(new Dictionary() + { + {"k1", true }, + {"k2", false } + }); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [Test] + public Task Dictionary_StringValue_get() => Test(async (host) => + { + var response = await new DictionaryClient(host, null).GetStringValueClient().GetStringValueAsync(); + Assert.AreEqual(2, response.Value.Count); + Assert.AreEqual("hello", response.Value["k1"]); + Assert.AreEqual("", response.Value["k2"]); + }); + + [Test] + public Task Dictionary_StringValue_put() => Test(async (host) => + { + var response = await new DictionaryClient(host, null).GetStringValueClient().PutAsync(new Dictionary() + { + {"k1", "hello" }, + {"k2", "" } + }); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [Test] + public Task Dictionary_Float32Value_get() => Test(async (host) => + { + var response = await new DictionaryClient(host, null).GetFloat32ValueClient().GetFloat32ValueAsync(); + Assert.AreEqual(1, response.Value.Count); + Assert.AreEqual(43.125f, response.Value["k1"]); + }); + + [Test] + public Task Dictionary_Float32Value_put() => Test(async (host) => + { + var response = await new DictionaryClient(host, null).GetFloat32ValueClient().PutAsync(new Dictionary() + { + {"k1", 43.125f } + }); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [Test] + public Task Dictionary_DatetimeValue_get() => Test(async (host) => + { + var response = await new DictionaryClient(host, null).GetDatetimeValueClient().GetDatetimeValueAsync(); + Assert.AreEqual(1, response.Value.Count); + Assert.AreEqual(DateTimeOffset.Parse("2022-08-26T18:38:00Z"), response.Value["k1"]); + }); + + [Test] + public Task Dictionary_DatetimeValue_put() => Test(async (host) => + { + var response = await new DictionaryClient(host, null).GetDatetimeValueClient().PutAsync(new Dictionary() + { + {"k1", DateTimeOffset.Parse("2022-08-26T18:38:00Z") } + }); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [Test] + public Task Dictionary_DurationValue_get() => Test(async (host) => + { + var response = await new DictionaryClient(host, null).GetDurationValueClient().GetDurationValueAsync(); + Assert.AreEqual(1, response.Value.Count); + Assert.AreEqual(XmlConvert.ToTimeSpan("P123DT22H14M12.011S"), response.Value["k1"]); + }); + + [Test] + public Task Dictionary_DurationValue_put() => Test(async (host) => + { + var response = await new DictionaryClient(host, null).GetDurationValueClient().PutAsync(new Dictionary() + { + {"k1", XmlConvert.ToTimeSpan("P123DT22H14M12.011S") } + }); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [Test] + public Task Dictionary_UnknownValue_get() => Test(async (host) => + { + var response = await new DictionaryClient(host, null).GetUnknownValueClient().GetUnknownValueAsync(); + Assert.AreEqual(3, response.Value.Count); + Assert.AreEqual(1, response.Value["k1"].ToObjectFromJson()); + Assert.AreEqual("hello", response.Value["k2"].ToObjectFromJson()); + Assert.AreEqual(null, response.Value["k3"]); + }); + + [Test] + public Task Dictionary_UnknownValue_put() => Test(async (host) => + { + var response = await new DictionaryClient(host, null).GetUnknownValueClient().PutAsync(new Dictionary() + { + {"k1", new BinaryData(1) }, + {"k2", new BinaryData("\"hello\"") }, + {"k3", null } + }); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [Test] + public Task Dictionary_ModelValue_get() => Test(async (host) => + { + var response = await new DictionaryClient(host, null).GetModelValueClient().GetModelValueAsync(); + Assert.AreEqual(2, response.Value.Count); + Assert.AreEqual("hello", response.Value["k1"].Property); + Assert.AreEqual("world", response.Value["k2"].Property); + }); + + [Test] + public Task Dictionary_ModelValue_put() => Test(async (host) => + { + var response = await new DictionaryClient(host, null).GetModelValueClient().PutAsync(new Dictionary() + { + {"k1", new InnerModel("hello") }, + {"k2", new InnerModel("world") } + }); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [Test] + public Task Dictionary_RecursiveModelValue_get() => Test(async (host) => + { + var response = await new DictionaryClient(host, null).GetRecursiveModelValueClient().GetRecursiveModelValueAsync(); + Assert.AreEqual(2, response.Value.Count); + Assert.AreEqual("hello", response.Value["k1"].Property); + Assert.AreEqual(0, response.Value["k1"].Children.Count); + Assert.AreEqual("world", response.Value["k2"].Property); + Assert.AreEqual("inner world", response.Value["k2"].Children["k2.1"].Property); + }); + + [Test] + public Task Dictionary_RecursiveModelValue_put() => Test(async (host) => + { + var firstModel = new InnerModel("hello"); + firstModel.Children.Clear(); + var response = await new DictionaryClient(host, null).GetRecursiveModelValueClient().PutAsync(new Dictionary() + { + ["k1"] = firstModel, + ["k2"] = new InnerModel("world") + { + Children = + { + ["k2.1"] = new InnerModel("inner world") + } + } + }); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [Test] + public Task Type_Dictionary_NullableFloatValue_get() => Test(async (host) => + { + var response = await new DictionaryClient(host, null).GetNullableFloatValueClient().GetNullableFloatValueAsync(); + Assert.AreEqual(3, response.Value.Count); + Assert.AreEqual(1.25f, response.Value["k1"]); + Assert.AreEqual(0.5f, response.Value["k2"]); + Assert.AreEqual(null, response.Value["k3"]); + }); + + [Test] + public Task Type_Dictionary_NullableFloatValue_put() => Test(async (host) => + { + var response = await new DictionaryClient(host, null).GetNullableFloatValueClient().PutAsync(new Dictionary() + { + {"k1", 1.25f }, + {"k2", 0.5f }, + {"k3", null } + }); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + } +} From df24d4aeeda3fe437a9e3e8b7a18c9af5400be51 Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Fri, 19 Apr 2024 10:30:48 +0800 Subject: [PATCH 15/19] regen after merge --- .../type/array/src/Generated/BooleanValue.cs | 12 ++++-------- .../type/array/src/Generated/DatetimeValue.cs | 12 ++++-------- .../type/array/src/Generated/DurationValue.cs | 12 ++++-------- .../type/array/src/Generated/Float32Value.cs | 12 ++++-------- .../type/array/src/Generated/Int32Value.cs | 12 ++++-------- .../type/array/src/Generated/Int64Value.cs | 12 ++++-------- .../type/array/src/Generated/ModelValue.cs | 12 ++++-------- .../type/array/src/Generated/NullableFloatValue.cs | 12 ++++-------- .../type/array/src/Generated/StringValue.cs | 12 ++++-------- .../type/array/src/Generated/UnknownValue.cs | 12 ++++-------- .../type/dictionary/src/Generated/BooleanValue.cs | 12 ++++-------- .../type/dictionary/src/Generated/DatetimeValue.cs | 12 ++++-------- .../type/dictionary/src/Generated/DurationValue.cs | 12 ++++-------- .../type/dictionary/src/Generated/Float32Value.cs | 12 ++++-------- .../type/dictionary/src/Generated/Int32Value.cs | 12 ++++-------- .../type/dictionary/src/Generated/Int64Value.cs | 12 ++++-------- .../type/dictionary/src/Generated/ModelValue.cs | 12 ++++-------- .../dictionary/src/Generated/NullableFloatValue.cs | 12 ++++-------- .../dictionary/src/Generated/RecursiveModelValue.cs | 12 ++++-------- .../type/dictionary/src/Generated/StringValue.cs | 12 ++++-------- .../type/dictionary/src/Generated/UnknownValue.cs | 12 ++++-------- .../type/array/src/Generated/BooleanValue.cs | 12 ++++-------- .../type/array/src/Generated/DatetimeValue.cs | 12 ++++-------- .../type/array/src/Generated/DurationValue.cs | 12 ++++-------- .../type/array/src/Generated/Float32Value.cs | 12 ++++-------- .../type/array/src/Generated/Int32Value.cs | 12 ++++-------- .../type/array/src/Generated/Int64Value.cs | 12 ++++-------- .../type/array/src/Generated/ModelValue.cs | 12 ++++-------- .../type/array/src/Generated/NullableFloatValue.cs | 12 ++++-------- .../type/array/src/Generated/StringValue.cs | 12 ++++-------- .../type/array/src/Generated/UnknownValue.cs | 12 ++++-------- .../type/dictionary/src/Generated/BooleanValue.cs | 12 ++++-------- .../type/dictionary/src/Generated/DatetimeValue.cs | 12 ++++-------- .../type/dictionary/src/Generated/DurationValue.cs | 12 ++++-------- .../type/dictionary/src/Generated/Float32Value.cs | 12 ++++-------- .../type/dictionary/src/Generated/Int32Value.cs | 12 ++++-------- .../type/dictionary/src/Generated/Int64Value.cs | 12 ++++-------- .../type/dictionary/src/Generated/ModelValue.cs | 12 ++++-------- .../dictionary/src/Generated/NullableFloatValue.cs | 12 ++++-------- .../dictionary/src/Generated/RecursiveModelValue.cs | 12 ++++-------- .../type/dictionary/src/Generated/StringValue.cs | 12 ++++-------- .../type/dictionary/src/Generated/UnknownValue.cs | 12 ++++-------- 42 files changed, 168 insertions(+), 336 deletions(-) diff --git a/test/CadlRanchProjects/type/array/src/Generated/BooleanValue.cs b/test/CadlRanchProjects/type/array/src/Generated/BooleanValue.cs index 102ef166b8d..27a067ca613 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/BooleanValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/BooleanValue.cs @@ -45,9 +45,8 @@ internal BooleanValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline _endpoint = endpoint; } - /// The GetBooleanValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual async Task>> GetBooleanValueAsync(CancellationToken cancellationToken = default) { @@ -64,9 +63,8 @@ public virtual async Task>> GetBooleanValueAsync(Ca return Response.FromValue(value, response); } - /// The GetBooleanValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual Response> GetBooleanValue(CancellationToken cancellationToken = default) { @@ -153,11 +151,10 @@ public virtual Response GetBooleanValue(RequestContext context) } } - /// The Put method. + /// Put. /// The where T is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual async Task PutAsync(IEnumerable body, CancellationToken cancellationToken = default) { @@ -169,11 +166,10 @@ public virtual async Task PutAsync(IEnumerable body, Cancellatio return response; } - /// The Put method. + /// Put. /// The where T is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual Response Put(IEnumerable body, CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjects/type/array/src/Generated/DatetimeValue.cs b/test/CadlRanchProjects/type/array/src/Generated/DatetimeValue.cs index c28bf37586b..9d957c3bcf2 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/DatetimeValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/DatetimeValue.cs @@ -45,9 +45,8 @@ internal DatetimeValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipelin _endpoint = endpoint; } - /// The GetDatetimeValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual async Task>> GetDatetimeValueAsync(CancellationToken cancellationToken = default) { @@ -64,9 +63,8 @@ public virtual async Task>> GetDatetimeVa return Response.FromValue(value, response); } - /// The GetDatetimeValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual Response> GetDatetimeValue(CancellationToken cancellationToken = default) { @@ -153,11 +151,10 @@ public virtual Response GetDatetimeValue(RequestContext context) } } - /// The Put method. + /// Put. /// The where T is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual async Task PutAsync(IEnumerable body, CancellationToken cancellationToken = default) { @@ -169,11 +166,10 @@ public virtual async Task PutAsync(IEnumerable body, C return response; } - /// The Put method. + /// Put. /// The where T is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual Response Put(IEnumerable body, CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjects/type/array/src/Generated/DurationValue.cs b/test/CadlRanchProjects/type/array/src/Generated/DurationValue.cs index b66df55a873..17512149bf6 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/DurationValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/DurationValue.cs @@ -45,9 +45,8 @@ internal DurationValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipelin _endpoint = endpoint; } - /// The GetDurationValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual async Task>> GetDurationValueAsync(CancellationToken cancellationToken = default) { @@ -64,9 +63,8 @@ public virtual async Task>> GetDurationValueAsy return Response.FromValue(value, response); } - /// The GetDurationValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual Response> GetDurationValue(CancellationToken cancellationToken = default) { @@ -153,11 +151,10 @@ public virtual Response GetDurationValue(RequestContext context) } } - /// The Put method. + /// Put. /// The where T is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual async Task PutAsync(IEnumerable body, CancellationToken cancellationToken = default) { @@ -169,11 +166,10 @@ public virtual async Task PutAsync(IEnumerable body, Cancell return response; } - /// The Put method. + /// Put. /// The where T is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual Response Put(IEnumerable body, CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjects/type/array/src/Generated/Float32Value.cs b/test/CadlRanchProjects/type/array/src/Generated/Float32Value.cs index ab3b4ac53dd..5e5bbbda301 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/Float32Value.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/Float32Value.cs @@ -45,9 +45,8 @@ internal Float32Value(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline _endpoint = endpoint; } - /// The GetFloat32Value method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual async Task>> GetFloat32ValueAsync(CancellationToken cancellationToken = default) { @@ -64,9 +63,8 @@ public virtual async Task>> GetFloat32ValueAsync(C return Response.FromValue(value, response); } - /// The GetFloat32Value method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual Response> GetFloat32Value(CancellationToken cancellationToken = default) { @@ -153,11 +151,10 @@ public virtual Response GetFloat32Value(RequestContext context) } } - /// The Put method. + /// Put. /// The where T is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual async Task PutAsync(IEnumerable body, CancellationToken cancellationToken = default) { @@ -169,11 +166,10 @@ public virtual async Task PutAsync(IEnumerable body, Cancellati return response; } - /// The Put method. + /// Put. /// The where T is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual Response Put(IEnumerable body, CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjects/type/array/src/Generated/Int32Value.cs b/test/CadlRanchProjects/type/array/src/Generated/Int32Value.cs index 444f5d36cca..1f89073b16c 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/Int32Value.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/Int32Value.cs @@ -45,9 +45,8 @@ internal Int32Value(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, _endpoint = endpoint; } - /// The GetInt32Value method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual async Task>> GetInt32ValueAsync(CancellationToken cancellationToken = default) { @@ -64,9 +63,8 @@ public virtual async Task>> GetInt32ValueAsync(Cance return Response.FromValue(value, response); } - /// The GetInt32Value method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual Response> GetInt32Value(CancellationToken cancellationToken = default) { @@ -153,11 +151,10 @@ public virtual Response GetInt32Value(RequestContext context) } } - /// The Put method. + /// Put. /// The where T is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual async Task PutAsync(IEnumerable body, CancellationToken cancellationToken = default) { @@ -169,11 +166,10 @@ public virtual async Task PutAsync(IEnumerable body, Cancellation return response; } - /// The Put method. + /// Put. /// The where T is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual Response Put(IEnumerable body, CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjects/type/array/src/Generated/Int64Value.cs b/test/CadlRanchProjects/type/array/src/Generated/Int64Value.cs index 809703275ae..c5f0b5b2f6c 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/Int64Value.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/Int64Value.cs @@ -45,9 +45,8 @@ internal Int64Value(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, _endpoint = endpoint; } - /// The GetInt64Value method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual async Task>> GetInt64ValueAsync(CancellationToken cancellationToken = default) { @@ -64,9 +63,8 @@ public virtual async Task>> GetInt64ValueAsync(Canc return Response.FromValue(value, response); } - /// The GetInt64Value method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual Response> GetInt64Value(CancellationToken cancellationToken = default) { @@ -153,11 +151,10 @@ public virtual Response GetInt64Value(RequestContext context) } } - /// The Put method. + /// Put. /// The where T is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual async Task PutAsync(IEnumerable body, CancellationToken cancellationToken = default) { @@ -169,11 +166,10 @@ public virtual async Task PutAsync(IEnumerable body, Cancellatio return response; } - /// The Put method. + /// Put. /// The where T is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual Response Put(IEnumerable body, CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjects/type/array/src/Generated/ModelValue.cs b/test/CadlRanchProjects/type/array/src/Generated/ModelValue.cs index a9c2b0637f9..d3a020aa419 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/ModelValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/ModelValue.cs @@ -46,9 +46,8 @@ internal ModelValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, _endpoint = endpoint; } - /// The GetModelValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual async Task>> GetModelValueAsync(CancellationToken cancellationToken = default) { @@ -65,9 +64,8 @@ public virtual async Task>> GetModelValueAsyn return Response.FromValue(value, response); } - /// The GetModelValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual Response> GetModelValue(CancellationToken cancellationToken = default) { @@ -154,11 +152,10 @@ public virtual Response GetModelValue(RequestContext context) } } - /// The Put method. + /// Put. /// The where T is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual async Task PutAsync(IEnumerable body, CancellationToken cancellationToken = default) { @@ -170,11 +167,10 @@ public virtual async Task PutAsync(IEnumerable body, Cance return response; } - /// The Put method. + /// Put. /// The where T is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual Response Put(IEnumerable body, CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjects/type/array/src/Generated/NullableFloatValue.cs b/test/CadlRanchProjects/type/array/src/Generated/NullableFloatValue.cs index dc5967bce96..4f8097460ee 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/NullableFloatValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/NullableFloatValue.cs @@ -45,9 +45,8 @@ internal NullableFloatValue(ClientDiagnostics clientDiagnostics, HttpPipeline pi _endpoint = endpoint; } - /// The GetNullableFloatValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual async Task>> GetNullableFloatValueAsync(CancellationToken cancellationToken = default) { @@ -71,9 +70,8 @@ internal NullableFloatValue(ClientDiagnostics clientDiagnostics, HttpPipeline pi return Response.FromValue(value, response); } - /// The GetNullableFloatValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual Response> GetNullableFloatValue(CancellationToken cancellationToken = default) { @@ -167,11 +165,10 @@ public virtual Response GetNullableFloatValue(RequestContext context) } } - /// The Put method. + /// Put. /// The where T is of type ? to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual async Task PutAsync(IEnumerable body, CancellationToken cancellationToken = default) { @@ -183,11 +180,10 @@ public virtual async Task PutAsync(IEnumerable body, Cancellat return response; } - /// The Put method. + /// Put. /// The where T is of type ? to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual Response Put(IEnumerable body, CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjects/type/array/src/Generated/StringValue.cs b/test/CadlRanchProjects/type/array/src/Generated/StringValue.cs index 0677cbd20b1..741b2fca27c 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/StringValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/StringValue.cs @@ -45,9 +45,8 @@ internal StringValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, _endpoint = endpoint; } - /// The GetStringValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual async Task>> GetStringValueAsync(CancellationToken cancellationToken = default) { @@ -64,9 +63,8 @@ public virtual async Task>> GetStringValueAsync(C return Response.FromValue(value, response); } - /// The GetStringValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual Response> GetStringValue(CancellationToken cancellationToken = default) { @@ -153,11 +151,10 @@ public virtual Response GetStringValue(RequestContext context) } } - /// The Put method. + /// Put. /// The where T is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual async Task PutAsync(IEnumerable body, CancellationToken cancellationToken = default) { @@ -169,11 +166,10 @@ public virtual async Task PutAsync(IEnumerable body, Cancellat return response; } - /// The Put method. + /// Put. /// The where T is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual Response Put(IEnumerable body, CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjects/type/array/src/Generated/UnknownValue.cs b/test/CadlRanchProjects/type/array/src/Generated/UnknownValue.cs index 60ae52c2828..d0ef4f627c3 100644 --- a/test/CadlRanchProjects/type/array/src/Generated/UnknownValue.cs +++ b/test/CadlRanchProjects/type/array/src/Generated/UnknownValue.cs @@ -45,9 +45,8 @@ internal UnknownValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline _endpoint = endpoint; } - /// The GetUnknownValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual async Task>> GetUnknownValueAsync(CancellationToken cancellationToken = default) { @@ -71,9 +70,8 @@ public virtual async Task>> GetUnknownValueAs return Response.FromValue(value, response); } - /// The GetUnknownValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual Response> GetUnknownValue(CancellationToken cancellationToken = default) { @@ -167,11 +165,10 @@ public virtual Response GetUnknownValue(RequestContext context) } } - /// The Put method. + /// Put. /// The where T is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual async Task PutAsync(IEnumerable body, CancellationToken cancellationToken = default) { @@ -183,11 +180,10 @@ public virtual async Task PutAsync(IEnumerable body, Cance return response; } - /// The Put method. + /// Put. /// The where T is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual Response Put(IEnumerable body, CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/BooleanValue.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/BooleanValue.cs index bd9214bb597..61ff53d6238 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/BooleanValue.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/BooleanValue.cs @@ -45,9 +45,8 @@ internal BooleanValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline _endpoint = endpoint; } - /// The GetBooleanValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual async Task>> GetBooleanValueAsync(CancellationToken cancellationToken = default) { @@ -64,9 +63,8 @@ public virtual async Task>> GetBoolea return Response.FromValue(value, response); } - /// The GetBooleanValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual Response> GetBooleanValue(CancellationToken cancellationToken = default) { @@ -153,11 +151,10 @@ public virtual Response GetBooleanValue(RequestContext context) } } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual async Task PutAsync(IDictionary body, CancellationToken cancellationToken = default) { @@ -169,11 +166,10 @@ public virtual async Task PutAsync(IDictionary body, Can return response; } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual Response Put(IDictionary body, CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/DatetimeValue.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/DatetimeValue.cs index e97ce1b0b0f..cfb117e32b1 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/DatetimeValue.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/DatetimeValue.cs @@ -45,9 +45,8 @@ internal DatetimeValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipelin _endpoint = endpoint; } - /// The GetDatetimeValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual async Task>> GetDatetimeValueAsync(CancellationToken cancellationToken = default) { @@ -64,9 +63,8 @@ public virtual async Task>> return Response.FromValue(value, response); } - /// The GetDatetimeValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual Response> GetDatetimeValue(CancellationToken cancellationToken = default) { @@ -153,11 +151,10 @@ public virtual Response GetDatetimeValue(RequestContext context) } } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual async Task PutAsync(IDictionary body, CancellationToken cancellationToken = default) { @@ -169,11 +166,10 @@ public virtual async Task PutAsync(IDictionary return response; } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual Response Put(IDictionary body, CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/DurationValue.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/DurationValue.cs index 9e7d4f31a21..40c98531394 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/DurationValue.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/DurationValue.cs @@ -45,9 +45,8 @@ internal DurationValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipelin _endpoint = endpoint; } - /// The GetDurationValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual async Task>> GetDurationValueAsync(CancellationToken cancellationToken = default) { @@ -64,9 +63,8 @@ public virtual async Task>> GetDu return Response.FromValue(value, response); } - /// The GetDurationValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual Response> GetDurationValue(CancellationToken cancellationToken = default) { @@ -153,11 +151,10 @@ public virtual Response GetDurationValue(RequestContext context) } } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual async Task PutAsync(IDictionary body, CancellationToken cancellationToken = default) { @@ -169,11 +166,10 @@ public virtual async Task PutAsync(IDictionary body, return response; } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual Response Put(IDictionary body, CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/Float32Value.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/Float32Value.cs index b02b527f92e..0507648999e 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/Float32Value.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/Float32Value.cs @@ -45,9 +45,8 @@ internal Float32Value(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline _endpoint = endpoint; } - /// The GetFloat32Value method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual async Task>> GetFloat32ValueAsync(CancellationToken cancellationToken = default) { @@ -64,9 +63,8 @@ public virtual async Task>> GetFloat return Response.FromValue(value, response); } - /// The GetFloat32Value method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual Response> GetFloat32Value(CancellationToken cancellationToken = default) { @@ -153,11 +151,10 @@ public virtual Response GetFloat32Value(RequestContext context) } } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual async Task PutAsync(IDictionary body, CancellationToken cancellationToken = default) { @@ -169,11 +166,10 @@ public virtual async Task PutAsync(IDictionary body, Ca return response; } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual Response Put(IDictionary body, CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/Int32Value.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/Int32Value.cs index ad747350eb1..c4165ba1458 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/Int32Value.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/Int32Value.cs @@ -45,9 +45,8 @@ internal Int32Value(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, _endpoint = endpoint; } - /// The GetInt32Value method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual async Task>> GetInt32ValueAsync(CancellationToken cancellationToken = default) { @@ -64,9 +63,8 @@ public virtual async Task>> GetInt32Va return Response.FromValue(value, response); } - /// The GetInt32Value method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual Response> GetInt32Value(CancellationToken cancellationToken = default) { @@ -153,11 +151,10 @@ public virtual Response GetInt32Value(RequestContext context) } } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual async Task PutAsync(IDictionary body, CancellationToken cancellationToken = default) { @@ -169,11 +166,10 @@ public virtual async Task PutAsync(IDictionary body, Canc return response; } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual Response Put(IDictionary body, CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/Int64Value.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/Int64Value.cs index 0bb48b218c5..6492cac52bd 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/Int64Value.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/Int64Value.cs @@ -45,9 +45,8 @@ internal Int64Value(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, _endpoint = endpoint; } - /// The GetInt64Value method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual async Task>> GetInt64ValueAsync(CancellationToken cancellationToken = default) { @@ -64,9 +63,8 @@ public virtual async Task>> GetInt64V return Response.FromValue(value, response); } - /// The GetInt64Value method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual Response> GetInt64Value(CancellationToken cancellationToken = default) { @@ -153,11 +151,10 @@ public virtual Response GetInt64Value(RequestContext context) } } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual async Task PutAsync(IDictionary body, CancellationToken cancellationToken = default) { @@ -169,11 +166,10 @@ public virtual async Task PutAsync(IDictionary body, Can return response; } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual Response Put(IDictionary body, CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/ModelValue.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/ModelValue.cs index 319032fc27c..02dfe3378a3 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/ModelValue.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/ModelValue.cs @@ -46,9 +46,8 @@ internal ModelValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, _endpoint = endpoint; } - /// The GetModelValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual async Task>> GetModelValueAsync(CancellationToken cancellationToken = default) { @@ -65,9 +64,8 @@ public virtual async Task>> Get return Response.FromValue(value, response); } - /// The GetModelValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual Response> GetModelValue(CancellationToken cancellationToken = default) { @@ -154,11 +152,10 @@ public virtual Response GetModelValue(RequestContext context) } } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual async Task PutAsync(IDictionary body, CancellationToken cancellationToken = default) { @@ -170,11 +167,10 @@ public virtual async Task PutAsync(IDictionary bod return response; } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual Response Put(IDictionary body, CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/NullableFloatValue.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/NullableFloatValue.cs index 2eae52f1047..7cc113a79f2 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/NullableFloatValue.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/NullableFloatValue.cs @@ -45,9 +45,8 @@ internal NullableFloatValue(ClientDiagnostics clientDiagnostics, HttpPipeline pi _endpoint = endpoint; } - /// The GetNullableFloatValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual async Task>> GetNullableFloatValueAsync(CancellationToken cancellationToken = default) { @@ -71,9 +70,8 @@ internal NullableFloatValue(ClientDiagnostics clientDiagnostics, HttpPipeline pi return Response.FromValue(value, response); } - /// The GetNullableFloatValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual Response> GetNullableFloatValue(CancellationToken cancellationToken = default) { @@ -167,11 +165,10 @@ public virtual Response GetNullableFloatValue(RequestContext context) } } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type ? to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual async Task PutAsync(IDictionary body, CancellationToken cancellationToken = default) { @@ -183,11 +180,10 @@ public virtual async Task PutAsync(IDictionary body, C return response; } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type ? to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual Response Put(IDictionary body, CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/RecursiveModelValue.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/RecursiveModelValue.cs index 1013a1fc4da..72de7c2a303 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/RecursiveModelValue.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/RecursiveModelValue.cs @@ -46,9 +46,8 @@ internal RecursiveModelValue(ClientDiagnostics clientDiagnostics, HttpPipeline p _endpoint = endpoint; } - /// The GetRecursiveModelValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual async Task>> GetRecursiveModelValueAsync(CancellationToken cancellationToken = default) { @@ -65,9 +64,8 @@ public virtual async Task>> Get return Response.FromValue(value, response); } - /// The GetRecursiveModelValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual Response> GetRecursiveModelValue(CancellationToken cancellationToken = default) { @@ -154,11 +152,10 @@ public virtual Response GetRecursiveModelValue(RequestContext context) } } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual async Task PutAsync(IDictionary body, CancellationToken cancellationToken = default) { @@ -170,11 +167,10 @@ public virtual async Task PutAsync(IDictionary bod return response; } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual Response Put(IDictionary body, CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/StringValue.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/StringValue.cs index c82037eab41..5c35c7dab3a 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/StringValue.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/StringValue.cs @@ -45,9 +45,8 @@ internal StringValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, _endpoint = endpoint; } - /// The GetStringValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual async Task>> GetStringValueAsync(CancellationToken cancellationToken = default) { @@ -64,9 +63,8 @@ public virtual async Task>> GetStri return Response.FromValue(value, response); } - /// The GetStringValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual Response> GetStringValue(CancellationToken cancellationToken = default) { @@ -153,11 +151,10 @@ public virtual Response GetStringValue(RequestContext context) } } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual async Task PutAsync(IDictionary body, CancellationToken cancellationToken = default) { @@ -169,11 +166,10 @@ public virtual async Task PutAsync(IDictionary body, C return response; } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual Response Put(IDictionary body, CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjects/type/dictionary/src/Generated/UnknownValue.cs b/test/CadlRanchProjects/type/dictionary/src/Generated/UnknownValue.cs index 30119681a7e..2ac97874bb7 100644 --- a/test/CadlRanchProjects/type/dictionary/src/Generated/UnknownValue.cs +++ b/test/CadlRanchProjects/type/dictionary/src/Generated/UnknownValue.cs @@ -45,9 +45,8 @@ internal UnknownValue(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline _endpoint = endpoint; } - /// The GetUnknownValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual async Task>> GetUnknownValueAsync(CancellationToken cancellationToken = default) { @@ -71,9 +70,8 @@ public virtual async Task>> Get return Response.FromValue(value, response); } - /// The GetUnknownValue method. + /// Get. /// The cancellation token to use. - /// Get. /// public virtual Response> GetUnknownValue(CancellationToken cancellationToken = default) { @@ -167,11 +165,10 @@ public virtual Response GetUnknownValue(RequestContext context) } } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual async Task PutAsync(IDictionary body, CancellationToken cancellationToken = default) { @@ -183,11 +180,10 @@ public virtual async Task PutAsync(IDictionary bod return response; } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// The cancellation token to use. /// is null. - /// Put. /// public virtual Response Put(IDictionary body, CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs index 1835fbbc1d5..f132c1b89f0 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs @@ -35,8 +35,7 @@ internal BooleanValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } - /// The GetBooleanValue method. - /// Get. + /// Get. public virtual async Task>> GetBooleanValueAsync() { ClientResult result = await GetBooleanValueAsync(null).ConfigureAwait(false); @@ -51,8 +50,7 @@ public virtual async Task>> GetBooleanValueAsyn return ClientResult.FromValue(value, result.GetRawResponse()); } - /// The GetBooleanValue method. - /// Get. + /// Get. public virtual ClientResult> GetBooleanValue() { ClientResult result = GetBooleanValue(null); @@ -115,10 +113,9 @@ public virtual ClientResult GetBooleanValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The Put method. + /// Put. /// The where T is of type to use. /// is null. - /// Put. public virtual async Task PutAsync(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); @@ -128,10 +125,9 @@ public virtual async Task PutAsync(IEnumerable body) return result; } - /// The Put method. + /// Put. /// The where T is of type to use. /// is null. - /// Put. public virtual ClientResult Put(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs index c43f75c8224..0d06e54b590 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs @@ -35,8 +35,7 @@ internal DatetimeValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } - /// The GetDatetimeValue method. - /// Get. + /// Get. public virtual async Task>> GetDatetimeValueAsync() { ClientResult result = await GetDatetimeValueAsync(null).ConfigureAwait(false); @@ -51,8 +50,7 @@ public virtual async Task>> GetDateti return ClientResult.FromValue(value, result.GetRawResponse()); } - /// The GetDatetimeValue method. - /// Get. + /// Get. public virtual ClientResult> GetDatetimeValue() { ClientResult result = GetDatetimeValue(null); @@ -115,10 +113,9 @@ public virtual ClientResult GetDatetimeValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The Put method. + /// Put. /// The where T is of type to use. /// is null. - /// Put. public virtual async Task PutAsync(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); @@ -128,10 +125,9 @@ public virtual async Task PutAsync(IEnumerable bod return result; } - /// The Put method. + /// Put. /// The where T is of type to use. /// is null. - /// Put. public virtual ClientResult Put(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs index b35d591c25a..62a1abd6052 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs @@ -35,8 +35,7 @@ internal DurationValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } - /// The GetDurationValue method. - /// Get. + /// Get. public virtual async Task>> GetDurationValueAsync() { ClientResult result = await GetDurationValueAsync(null).ConfigureAwait(false); @@ -51,8 +50,7 @@ public virtual async Task>> GetDurationValu return ClientResult.FromValue(value, result.GetRawResponse()); } - /// The GetDurationValue method. - /// Get. + /// Get. public virtual ClientResult> GetDurationValue() { ClientResult result = GetDurationValue(null); @@ -115,10 +113,9 @@ public virtual ClientResult GetDurationValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The Put method. + /// Put. /// The where T is of type to use. /// is null. - /// Put. public virtual async Task PutAsync(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); @@ -128,10 +125,9 @@ public virtual async Task PutAsync(IEnumerable body) return result; } - /// The Put method. + /// Put. /// The where T is of type to use. /// is null. - /// Put. public virtual ClientResult Put(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs index 6ddea88c8e0..a71b66fbd8b 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs @@ -35,8 +35,7 @@ internal Float32Value(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } - /// The GetFloat32Value method. - /// Get. + /// Get. public virtual async Task>> GetFloat32ValueAsync() { ClientResult result = await GetFloat32ValueAsync(null).ConfigureAwait(false); @@ -51,8 +50,7 @@ public virtual async Task>> GetFloat32ValueAsy return ClientResult.FromValue(value, result.GetRawResponse()); } - /// The GetFloat32Value method. - /// Get. + /// Get. public virtual ClientResult> GetFloat32Value() { ClientResult result = GetFloat32Value(null); @@ -115,10 +113,9 @@ public virtual ClientResult GetFloat32Value(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The Put method. + /// Put. /// The where T is of type to use. /// is null. - /// Put. public virtual async Task PutAsync(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); @@ -128,10 +125,9 @@ public virtual async Task PutAsync(IEnumerable body) return result; } - /// The Put method. + /// Put. /// The where T is of type to use. /// is null. - /// Put. public virtual ClientResult Put(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs index 76550deaf2f..2f6c7527067 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs @@ -35,8 +35,7 @@ internal Int32Value(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } - /// The GetInt32Value method. - /// Get. + /// Get. public virtual async Task>> GetInt32ValueAsync() { ClientResult result = await GetInt32ValueAsync(null).ConfigureAwait(false); @@ -51,8 +50,7 @@ public virtual async Task>> GetInt32ValueAsync() return ClientResult.FromValue(value, result.GetRawResponse()); } - /// The GetInt32Value method. - /// Get. + /// Get. public virtual ClientResult> GetInt32Value() { ClientResult result = GetInt32Value(null); @@ -115,10 +113,9 @@ public virtual ClientResult GetInt32Value(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The Put method. + /// Put. /// The where T is of type to use. /// is null. - /// Put. public virtual async Task PutAsync(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); @@ -128,10 +125,9 @@ public virtual async Task PutAsync(IEnumerable body) return result; } - /// The Put method. + /// Put. /// The where T is of type to use. /// is null. - /// Put. public virtual ClientResult Put(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs index a20b5269ec2..4322a73f546 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs @@ -35,8 +35,7 @@ internal Int64Value(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } - /// The GetInt64Value method. - /// Get. + /// Get. public virtual async Task>> GetInt64ValueAsync() { ClientResult result = await GetInt64ValueAsync(null).ConfigureAwait(false); @@ -51,8 +50,7 @@ public virtual async Task>> GetInt64ValueAsync( return ClientResult.FromValue(value, result.GetRawResponse()); } - /// The GetInt64Value method. - /// Get. + /// Get. public virtual ClientResult> GetInt64Value() { ClientResult result = GetInt64Value(null); @@ -115,10 +113,9 @@ public virtual ClientResult GetInt64Value(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The Put method. + /// Put. /// The where T is of type to use. /// is null. - /// Put. public virtual async Task PutAsync(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); @@ -128,10 +125,9 @@ public virtual async Task PutAsync(IEnumerable body) return result; } - /// The Put method. + /// Put. /// The where T is of type to use. /// is null. - /// Put. public virtual ClientResult Put(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs index 73a0643acd5..a030fdf2805 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs @@ -36,8 +36,7 @@ internal ModelValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } - /// The GetModelValue method. - /// Get. + /// Get. public virtual async Task>> GetModelValueAsync() { ClientResult result = await GetModelValueAsync(null).ConfigureAwait(false); @@ -52,8 +51,7 @@ public virtual async Task>> GetModelValue return ClientResult.FromValue(value, result.GetRawResponse()); } - /// The GetModelValue method. - /// Get. + /// Get. public virtual ClientResult> GetModelValue() { ClientResult result = GetModelValue(null); @@ -116,10 +114,9 @@ public virtual ClientResult GetModelValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The Put method. + /// Put. /// The where T is of type to use. /// is null. - /// Put. public virtual async Task PutAsync(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); @@ -129,10 +126,9 @@ public virtual async Task PutAsync(IEnumerable body) return result; } - /// The Put method. + /// Put. /// The where T is of type to use. /// is null. - /// Put. public virtual ClientResult Put(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs index 7b56c355d5f..749406a3dc6 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs @@ -35,8 +35,7 @@ internal NullableFloatValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } - /// The GetNullableFloatValue method. - /// Get. + /// Get. public virtual async Task>> GetNullableFloatValueAsync() { ClientResult result = await GetNullableFloatValueAsync(null).ConfigureAwait(false); @@ -58,8 +57,7 @@ internal NullableFloatValue(ClientPipeline pipeline, Uri endpoint) return ClientResult.FromValue(value, result.GetRawResponse()); } - /// The GetNullableFloatValue method. - /// Get. + /// Get. public virtual ClientResult> GetNullableFloatValue() { ClientResult result = GetNullableFloatValue(null); @@ -129,10 +127,9 @@ public virtual ClientResult GetNullableFloatValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The Put method. + /// Put. /// The where T is of type ? to use. /// is null. - /// Put. public virtual async Task PutAsync(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); @@ -142,10 +139,9 @@ public virtual async Task PutAsync(IEnumerable body) return result; } - /// The Put method. + /// Put. /// The where T is of type ? to use. /// is null. - /// Put. public virtual ClientResult Put(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs index 6739d50c482..170a89c0626 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs @@ -35,8 +35,7 @@ internal StringValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } - /// The GetStringValue method. - /// Get. + /// Get. public virtual async Task>> GetStringValueAsync() { ClientResult result = await GetStringValueAsync(null).ConfigureAwait(false); @@ -51,8 +50,7 @@ public virtual async Task>> GetStringValueAsy return ClientResult.FromValue(value, result.GetRawResponse()); } - /// The GetStringValue method. - /// Get. + /// Get. public virtual ClientResult> GetStringValue() { ClientResult result = GetStringValue(null); @@ -115,10 +113,9 @@ public virtual ClientResult GetStringValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The Put method. + /// Put. /// The where T is of type to use. /// is null. - /// Put. public virtual async Task PutAsync(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); @@ -128,10 +125,9 @@ public virtual async Task PutAsync(IEnumerable body) return result; } - /// The Put method. + /// Put. /// The where T is of type to use. /// is null. - /// Put. public virtual ClientResult Put(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs index 07e9b06f165..a3174a95a96 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs @@ -35,8 +35,7 @@ internal UnknownValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } - /// The GetUnknownValue method. - /// Get. + /// Get. public virtual async Task>> GetUnknownValueAsync() { ClientResult result = await GetUnknownValueAsync(null).ConfigureAwait(false); @@ -58,8 +57,7 @@ public virtual async Task>> GetUnknownVal return ClientResult.FromValue(value, result.GetRawResponse()); } - /// The GetUnknownValue method. - /// Get. + /// Get. public virtual ClientResult> GetUnknownValue() { ClientResult result = GetUnknownValue(null); @@ -129,10 +127,9 @@ public virtual ClientResult GetUnknownValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The Put method. + /// Put. /// The where T is of type to use. /// is null. - /// Put. public virtual async Task PutAsync(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); @@ -142,10 +139,9 @@ public virtual async Task PutAsync(IEnumerable body) return result; } - /// The Put method. + /// Put. /// The where T is of type to use. /// is null. - /// Put. public virtual ClientResult Put(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/BooleanValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/BooleanValue.cs index a8b51a65b95..3ae7d0167f6 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/BooleanValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/BooleanValue.cs @@ -35,8 +35,7 @@ internal BooleanValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } - /// The GetBooleanValue method. - /// Get. + /// Get. public virtual async Task>> GetBooleanValueAsync() { ClientResult result = await GetBooleanValueAsync(null).ConfigureAwait(false); @@ -51,8 +50,7 @@ public virtual async Task>> GetBo return ClientResult.FromValue(value, result.GetRawResponse()); } - /// The GetBooleanValue method. - /// Get. + /// Get. public virtual ClientResult> GetBooleanValue() { ClientResult result = GetBooleanValue(null); @@ -115,10 +113,9 @@ public virtual ClientResult GetBooleanValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// is null. - /// Put. public virtual async Task PutAsync(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); @@ -128,10 +125,9 @@ public virtual async Task PutAsync(IDictionary body) return result; } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// is null. - /// Put. public virtual ClientResult Put(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DatetimeValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DatetimeValue.cs index ae98292fc97..fe88a86246f 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DatetimeValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DatetimeValue.cs @@ -35,8 +35,7 @@ internal DatetimeValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } - /// The GetDatetimeValue method. - /// Get. + /// Get. public virtual async Task>> GetDatetimeValueAsync() { ClientResult result = await GetDatetimeValueAsync(null).ConfigureAwait(false); @@ -51,8 +50,7 @@ public virtual async Task The GetDatetimeValue method. - /// Get. + /// Get. public virtual ClientResult> GetDatetimeValue() { ClientResult result = GetDatetimeValue(null); @@ -115,10 +113,9 @@ public virtual ClientResult GetDatetimeValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// is null. - /// Put. public virtual async Task PutAsync(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); @@ -128,10 +125,9 @@ public virtual async Task PutAsync(IDictionary The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// is null. - /// Put. public virtual ClientResult Put(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DurationValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DurationValue.cs index 0870e1b37c7..0f112be4a0a 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DurationValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DurationValue.cs @@ -35,8 +35,7 @@ internal DurationValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } - /// The GetDurationValue method. - /// Get. + /// Get. public virtual async Task>> GetDurationValueAsync() { ClientResult result = await GetDurationValueAsync(null).ConfigureAwait(false); @@ -51,8 +50,7 @@ public virtual async Task>> G return ClientResult.FromValue(value, result.GetRawResponse()); } - /// The GetDurationValue method. - /// Get. + /// Get. public virtual ClientResult> GetDurationValue() { ClientResult result = GetDurationValue(null); @@ -115,10 +113,9 @@ public virtual ClientResult GetDurationValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// is null. - /// Put. public virtual async Task PutAsync(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); @@ -128,10 +125,9 @@ public virtual async Task PutAsync(IDictionary b return result; } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// is null. - /// Put. public virtual ClientResult Put(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Float32Value.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Float32Value.cs index 3c18acff450..21178561136 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Float32Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Float32Value.cs @@ -35,8 +35,7 @@ internal Float32Value(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } - /// The GetFloat32Value method. - /// Get. + /// Get. public virtual async Task>> GetFloat32ValueAsync() { ClientResult result = await GetFloat32ValueAsync(null).ConfigureAwait(false); @@ -51,8 +50,7 @@ public virtual async Task>> GetF return ClientResult.FromValue(value, result.GetRawResponse()); } - /// The GetFloat32Value method. - /// Get. + /// Get. public virtual ClientResult> GetFloat32Value() { ClientResult result = GetFloat32Value(null); @@ -115,10 +113,9 @@ public virtual ClientResult GetFloat32Value(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// is null. - /// Put. public virtual async Task PutAsync(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); @@ -128,10 +125,9 @@ public virtual async Task PutAsync(IDictionary body return result; } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// is null. - /// Put. public virtual ClientResult Put(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int32Value.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int32Value.cs index c4abc1ada6c..363cdd7a661 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int32Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int32Value.cs @@ -35,8 +35,7 @@ internal Int32Value(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } - /// The GetInt32Value method. - /// Get. + /// Get. public virtual async Task>> GetInt32ValueAsync() { ClientResult result = await GetInt32ValueAsync(null).ConfigureAwait(false); @@ -51,8 +50,7 @@ public virtual async Task>> GetInt return ClientResult.FromValue(value, result.GetRawResponse()); } - /// The GetInt32Value method. - /// Get. + /// Get. public virtual ClientResult> GetInt32Value() { ClientResult result = GetInt32Value(null); @@ -115,10 +113,9 @@ public virtual ClientResult GetInt32Value(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// is null. - /// Put. public virtual async Task PutAsync(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); @@ -128,10 +125,9 @@ public virtual async Task PutAsync(IDictionary body) return result; } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// is null. - /// Put. public virtual ClientResult Put(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int64Value.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int64Value.cs index 80d269566ff..8f5240e3b0c 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int64Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int64Value.cs @@ -35,8 +35,7 @@ internal Int64Value(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } - /// The GetInt64Value method. - /// Get. + /// Get. public virtual async Task>> GetInt64ValueAsync() { ClientResult result = await GetInt64ValueAsync(null).ConfigureAwait(false); @@ -51,8 +50,7 @@ public virtual async Task>> GetIn return ClientResult.FromValue(value, result.GetRawResponse()); } - /// The GetInt64Value method. - /// Get. + /// Get. public virtual ClientResult> GetInt64Value() { ClientResult result = GetInt64Value(null); @@ -115,10 +113,9 @@ public virtual ClientResult GetInt64Value(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// is null. - /// Put. public virtual async Task PutAsync(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); @@ -128,10 +125,9 @@ public virtual async Task PutAsync(IDictionary body) return result; } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// is null. - /// Put. public virtual ClientResult Put(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/ModelValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/ModelValue.cs index 4f7b1d6f386..fdeabc5394d 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/ModelValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/ModelValue.cs @@ -36,8 +36,7 @@ internal ModelValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } - /// The GetModelValue method. - /// Get. + /// Get. public virtual async Task>> GetModelValueAsync() { ClientResult result = await GetModelValueAsync(null).ConfigureAwait(false); @@ -52,8 +51,7 @@ public virtual async Task>> return ClientResult.FromValue(value, result.GetRawResponse()); } - /// The GetModelValue method. - /// Get. + /// Get. public virtual ClientResult> GetModelValue() { ClientResult result = GetModelValue(null); @@ -116,10 +114,9 @@ public virtual ClientResult GetModelValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// is null. - /// Put. public virtual async Task PutAsync(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); @@ -129,10 +126,9 @@ public virtual async Task PutAsync(IDictionary return result; } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// is null. - /// Put. public virtual ClientResult Put(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/NullableFloatValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/NullableFloatValue.cs index 2c8962b9834..9d38ba38d9e 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/NullableFloatValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/NullableFloatValue.cs @@ -35,8 +35,7 @@ internal NullableFloatValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } - /// The GetNullableFloatValue method. - /// Get. + /// Get. public virtual async Task>> GetNullableFloatValueAsync() { ClientResult result = await GetNullableFloatValueAsync(null).ConfigureAwait(false); @@ -58,8 +57,7 @@ internal NullableFloatValue(ClientPipeline pipeline, Uri endpoint) return ClientResult.FromValue(value, result.GetRawResponse()); } - /// The GetNullableFloatValue method. - /// Get. + /// Get. public virtual ClientResult> GetNullableFloatValue() { ClientResult result = GetNullableFloatValue(null); @@ -129,10 +127,9 @@ public virtual ClientResult GetNullableFloatValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type ? to use. /// is null. - /// Put. public virtual async Task PutAsync(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); @@ -142,10 +139,9 @@ public virtual async Task PutAsync(IDictionary bod return result; } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type ? to use. /// is null. - /// Put. public virtual ClientResult Put(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/RecursiveModelValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/RecursiveModelValue.cs index 51dd6c870cd..e55fd039a34 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/RecursiveModelValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/RecursiveModelValue.cs @@ -36,8 +36,7 @@ internal RecursiveModelValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } - /// The GetRecursiveModelValue method. - /// Get. + /// Get. public virtual async Task>> GetRecursiveModelValueAsync() { ClientResult result = await GetRecursiveModelValueAsync(null).ConfigureAwait(false); @@ -52,8 +51,7 @@ public virtual async Task>> return ClientResult.FromValue(value, result.GetRawResponse()); } - /// The GetRecursiveModelValue method. - /// Get. + /// Get. public virtual ClientResult> GetRecursiveModelValue() { ClientResult result = GetRecursiveModelValue(null); @@ -116,10 +114,9 @@ public virtual ClientResult GetRecursiveModelValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// is null. - /// Put. public virtual async Task PutAsync(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); @@ -129,10 +126,9 @@ public virtual async Task PutAsync(IDictionary return result; } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// is null. - /// Put. public virtual ClientResult Put(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/StringValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/StringValue.cs index 01b8eec8407..9047241b179 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/StringValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/StringValue.cs @@ -35,8 +35,7 @@ internal StringValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } - /// The GetStringValue method. - /// Get. + /// Get. public virtual async Task>> GetStringValueAsync() { ClientResult result = await GetStringValueAsync(null).ConfigureAwait(false); @@ -51,8 +50,7 @@ public virtual async Task>> Get return ClientResult.FromValue(value, result.GetRawResponse()); } - /// The GetStringValue method. - /// Get. + /// Get. public virtual ClientResult> GetStringValue() { ClientResult result = GetStringValue(null); @@ -115,10 +113,9 @@ public virtual ClientResult GetStringValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// is null. - /// Put. public virtual async Task PutAsync(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); @@ -128,10 +125,9 @@ public virtual async Task PutAsync(IDictionary bod return result; } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// is null. - /// Put. public virtual ClientResult Put(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/UnknownValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/UnknownValue.cs index 73ed89a3f44..40d4b76b4e0 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/UnknownValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/UnknownValue.cs @@ -35,8 +35,7 @@ internal UnknownValue(ClientPipeline pipeline, Uri endpoint) _endpoint = endpoint; } - /// The GetUnknownValue method. - /// Get. + /// Get. public virtual async Task>> GetUnknownValueAsync() { ClientResult result = await GetUnknownValueAsync(null).ConfigureAwait(false); @@ -58,8 +57,7 @@ public virtual async Task>> return ClientResult.FromValue(value, result.GetRawResponse()); } - /// The GetUnknownValue method. - /// Get. + /// Get. public virtual ClientResult> GetUnknownValue() { ClientResult result = GetUnknownValue(null); @@ -129,10 +127,9 @@ public virtual ClientResult GetUnknownValue(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// is null. - /// Put. public virtual async Task PutAsync(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); @@ -142,10 +139,9 @@ public virtual async Task PutAsync(IDictionary return result; } - /// The Put method. + /// Put. /// The where TKey is of type , where TValue is of type to use. /// is null. - /// Put. public virtual ClientResult Put(IDictionary body) { Argument.AssertNotNull(body, nameof(body)); From ccd50a7b581e445f33ed8dc9f1b29748cd65b34b Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Fri, 19 Apr 2024 10:59:11 +0800 Subject: [PATCH 16/19] update namespace according to our pattern --- test/CadlRanchProjectsNonAzure/type/array/tspconfig.yaml | 2 +- .../{_Type._Dictionary.sln => Scm._Type._Dictionary.sln} | 4 ++-- .../type/dictionary/src/Generated/BooleanValue.cs | 2 +- .../type/dictionary/src/Generated/Configuration.json | 4 ++-- .../type/dictionary/src/Generated/DatetimeValue.cs | 2 +- .../type/dictionary/src/Generated/DictionaryClient.cs | 2 +- .../dictionary/src/Generated/DictionaryClientOptions.cs | 2 +- .../type/dictionary/src/Generated/DurationValue.cs | 2 +- .../type/dictionary/src/Generated/Float32Value.cs | 2 +- .../type/dictionary/src/Generated/Int32Value.cs | 2 +- .../type/dictionary/src/Generated/Int64Value.cs | 2 +- .../type/dictionary/src/Generated/Internal/Argument.cs | 2 +- .../src/Generated/Internal/BinaryContentHelper.cs | 2 +- .../src/Generated/Internal/ChangeTrackingDictionary.cs | 2 +- .../dictionary/src/Generated/Internal/ChangeTrackingList.cs | 2 +- .../src/Generated/Internal/ClientPipelineExtensions.cs | 2 +- .../dictionary/src/Generated/Internal/ClientUriBuilder.cs | 2 +- .../type/dictionary/src/Generated/Internal/ErrorResult.cs | 2 +- .../src/Generated/Internal/ModelSerializationExtensions.cs | 2 +- .../type/dictionary/src/Generated/Internal/Optional.cs | 2 +- .../src/Generated/Internal/Utf8JsonBinaryContent.cs | 2 +- .../type/dictionary/src/Generated/ModelValue.cs | 4 ++-- .../src/Generated/Models/InnerModel.Serialization.cs | 2 +- .../type/dictionary/src/Generated/Models/InnerModel.cs | 2 +- .../type/dictionary/src/Generated/NullableFloatValue.cs | 2 +- .../type/dictionary/src/Generated/RecursiveModelValue.cs | 4 ++-- .../type/dictionary/src/Generated/StringValue.cs | 2 +- .../type/dictionary/src/Generated/UnknownValue.cs | 2 +- .../type/dictionary/src/Properties/AssemblyInfo.cs | 2 +- ...Type._Dictionary.csproj => Scm._Type._Dictionary.csproj} | 6 +++--- ...nary.Tests.csproj => Scm._Type._Dictionary.Tests.csproj} | 2 +- .../type/dictionary/tspconfig.yaml | 2 +- 32 files changed, 38 insertions(+), 38 deletions(-) rename test/CadlRanchProjectsNonAzure/type/dictionary/{_Type._Dictionary.sln => Scm._Type._Dictionary.sln} (90%) rename test/CadlRanchProjectsNonAzure/type/dictionary/src/{_Type._Dictionary.csproj => Scm._Type._Dictionary.csproj} (62%) rename test/CadlRanchProjectsNonAzure/type/dictionary/tests/{_Type._Dictionary.Tests.csproj => Scm._Type._Dictionary.Tests.csproj} (88%) diff --git a/test/CadlRanchProjectsNonAzure/type/array/tspconfig.yaml b/test/CadlRanchProjectsNonAzure/type/array/tspconfig.yaml index 9118fe567de..11a3e390ca0 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/tspconfig.yaml +++ b/test/CadlRanchProjectsNonAzure/type/array/tspconfig.yaml @@ -1,3 +1,3 @@ options: "@azure-tools/typespec-csharp": - namespace: _Type._Array + namespace: Scm._Type._Array diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/_Type._Dictionary.sln b/test/CadlRanchProjectsNonAzure/type/dictionary/Scm._Type._Dictionary.sln similarity index 90% rename from test/CadlRanchProjectsNonAzure/type/dictionary/_Type._Dictionary.sln rename to test/CadlRanchProjectsNonAzure/type/dictionary/Scm._Type._Dictionary.sln index c067512da4b..b3cfecfe7f7 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/_Type._Dictionary.sln +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/Scm._Type._Dictionary.sln @@ -2,9 +2,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29709.97 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_Type._Dictionary", "src\_Type._Dictionary.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scm._Type._Dictionary", "src\Scm._Type._Dictionary.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_Type._Dictionary.Tests", "tests\_Type._Dictionary.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scm._Type._Dictionary.Tests", "tests\Scm._Type._Dictionary.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/BooleanValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/BooleanValue.cs index 3ae7d0167f6..19131642eb8 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/BooleanValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/BooleanValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { // Data plane generated sub-client. /// Dictionary of boolean values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Configuration.json b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Configuration.json index db360878713..86e86ebb522 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Configuration.json +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Configuration.json @@ -1,7 +1,7 @@ { "output-folder": ".", - "namespace": "_Type._Dictionary", - "library-name": "_Type._Dictionary", + "namespace": "Scm._Type._Dictionary", + "library-name": "Scm._Type._Dictionary", "shared-source-folders": [ "../../../../../../artifacts/bin/AutoRest.CSharp/Debug/net7.0/Generator.Shared", "../../../../../../artifacts/bin/AutoRest.CSharp/Debug/net7.0/Azure.Core.Shared" diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DatetimeValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DatetimeValue.cs index fe88a86246f..bd9fb49f554 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DatetimeValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DatetimeValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { // Data plane generated sub-client. /// Dictionary of datetime values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClient.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClient.cs index a76c76b4eb2..bbf7bf62ded 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClient.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClient.cs @@ -6,7 +6,7 @@ using System.ClientModel.Primitives; using System.Threading; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { // Data plane generated client. /// The Dictionary service client. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClientOptions.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClientOptions.cs index e34a8ac9fcd..fdb77929aae 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClientOptions.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DictionaryClientOptions.cs @@ -4,7 +4,7 @@ using System.ClientModel.Primitives; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { /// Client options for DictionaryClient. public partial class DictionaryClientOptions : ClientPipelineOptions diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DurationValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DurationValue.cs index 0f112be4a0a..8b82340c3a4 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DurationValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/DurationValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { // Data plane generated sub-client. /// Dictionary of duration values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Float32Value.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Float32Value.cs index 21178561136..5cadbc76103 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Float32Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Float32Value.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { // Data plane generated sub-client. /// Dictionary of float values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int32Value.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int32Value.cs index 363cdd7a661..a7d73d6cbff 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int32Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int32Value.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { // Data plane generated sub-client. /// Dictionary of int32 values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int64Value.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int64Value.cs index 8f5240e3b0c..6033146dbf6 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int64Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Int64Value.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { // Data plane generated sub-client. /// Dictionary of int64 values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Argument.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Argument.cs index cb70bdce136..043b93d17c3 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Argument.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Argument.cs @@ -6,7 +6,7 @@ using System.Collections; using System.Collections.Generic; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { internal static class Argument { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/BinaryContentHelper.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/BinaryContentHelper.cs index 58c89671f76..210de26c43f 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/BinaryContentHelper.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/BinaryContentHelper.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; using System.Text.Json; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { internal static class BinaryContentHelper { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingDictionary.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingDictionary.cs index 083ecd92782..5ea4c9e7b42 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingDictionary.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -6,7 +6,7 @@ using System.Collections; using System.Collections.Generic; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingList.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingList.cs index 649c24aff0b..0e72c71e2a4 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingList.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ChangeTrackingList.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; using System.Linq; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { internal class ChangeTrackingList : IList, IReadOnlyList { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientPipelineExtensions.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientPipelineExtensions.cs index c1965985a3d..b5fcaef2d8b 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientPipelineExtensions.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientPipelineExtensions.cs @@ -6,7 +6,7 @@ using System.ClientModel.Primitives; using System.Threading.Tasks; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { internal static class ClientPipelineExtensions { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientUriBuilder.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientUriBuilder.cs index cc6ddca5e22..c0891489cc5 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientUriBuilder.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientUriBuilder.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Text; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { internal class ClientUriBuilder { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ErrorResult.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ErrorResult.cs index c56081417c5..97d864cfe24 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ErrorResult.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ErrorResult.cs @@ -5,7 +5,7 @@ using System.ClientModel; using System.ClientModel.Primitives; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { internal class ErrorResult : ClientResult { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ModelSerializationExtensions.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ModelSerializationExtensions.cs index 1d19345323e..1d2a93ec41c 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ModelSerializationExtensions.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ModelSerializationExtensions.cs @@ -10,7 +10,7 @@ using System.Text.Json; using System.Xml; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { internal static class ModelSerializationExtensions { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Optional.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Optional.cs index 1fd134b1e4f..b0feb02ce67 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Optional.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Optional.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Text.Json; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { internal static class Optional { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Utf8JsonBinaryContent.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Utf8JsonBinaryContent.cs index ebb3e3a009a..728fb2364fb 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Utf8JsonBinaryContent.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/Utf8JsonBinaryContent.cs @@ -8,7 +8,7 @@ using System.Threading; using System.Threading.Tasks; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { internal class Utf8JsonBinaryContent : BinaryContent { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/ModelValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/ModelValue.cs index fdeabc5394d..e0f7b4d5914 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/ModelValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/ModelValue.cs @@ -8,9 +8,9 @@ using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; -using _Type._Dictionary.Models; +using Scm._Type._Dictionary.Models; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { // Data plane generated sub-client. /// Dictionary of model values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.Serialization.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.Serialization.cs index 4c78c340650..2e5b788d002 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.Serialization.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; -namespace _Type._Dictionary.Models +namespace Scm._Type._Dictionary.Models { public partial class InnerModel : IJsonModel { diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.cs index ed93f06e4a0..71edfe9dce1 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Models/InnerModel.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; -namespace _Type._Dictionary.Models +namespace Scm._Type._Dictionary.Models { /// Dictionary inner model. public partial class InnerModel diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/NullableFloatValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/NullableFloatValue.cs index 9d38ba38d9e..e79f4b962e3 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/NullableFloatValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/NullableFloatValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { // Data plane generated sub-client. /// Dictionary of nullable float values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/RecursiveModelValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/RecursiveModelValue.cs index e55fd039a34..3b201eeeefd 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/RecursiveModelValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/RecursiveModelValue.cs @@ -8,9 +8,9 @@ using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; -using _Type._Dictionary.Models; +using Scm._Type._Dictionary.Models; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { // Data plane generated sub-client. /// Dictionary of model values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/StringValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/StringValue.cs index 9047241b179..debc67b43f6 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/StringValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/StringValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { // Data plane generated sub-client. /// Dictionary of string values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/UnknownValue.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/UnknownValue.cs index 40d4b76b4e0..0d46bb4e123 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/UnknownValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/UnknownValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace _Type._Dictionary +namespace Scm._Type._Dictionary { // Data plane generated sub-client. /// Dictionary of unknown values. diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Properties/AssemblyInfo.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Properties/AssemblyInfo.cs index 8411ac7041a..3b2c503e7bb 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Properties/AssemblyInfo.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Properties/AssemblyInfo.cs @@ -3,4 +3,4 @@ using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("_Type._Dictionary.Tests")] +[assembly: InternalsVisibleTo("Scm._Type._Dictionary.Tests")] diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/_Type._Dictionary.csproj b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Scm._Type._Dictionary.csproj similarity index 62% rename from test/CadlRanchProjectsNonAzure/type/dictionary/src/_Type._Dictionary.csproj rename to test/CadlRanchProjectsNonAzure/type/dictionary/src/Scm._Type._Dictionary.csproj index 703435ebbdd..e36fbaf84f1 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/_Type._Dictionary.csproj +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Scm._Type._Dictionary.csproj @@ -1,9 +1,9 @@ - This is the _Type._Dictionary client library for developing .NET applications with rich experience. - SDK Code Generation _Type._Dictionary + This is the Scm._Type._Dictionary client library for developing .NET applications with rich experience. + SDK Code Generation Scm._Type._Dictionary 1.0.0-beta.1 - _Type._Dictionary + Scm._Type._Dictionary netstandard2.0 latest true diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/tests/_Type._Dictionary.Tests.csproj b/test/CadlRanchProjectsNonAzure/type/dictionary/tests/Scm._Type._Dictionary.Tests.csproj similarity index 88% rename from test/CadlRanchProjectsNonAzure/type/dictionary/tests/_Type._Dictionary.Tests.csproj rename to test/CadlRanchProjectsNonAzure/type/dictionary/tests/Scm._Type._Dictionary.Tests.csproj index 4368c2dd6f2..2525966469b 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/tests/_Type._Dictionary.Tests.csproj +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/tests/Scm._Type._Dictionary.Tests.csproj @@ -6,7 +6,7 @@ - + diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/tspconfig.yaml b/test/CadlRanchProjectsNonAzure/type/dictionary/tspconfig.yaml index 58d3a423f3c..cff89ea7728 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/tspconfig.yaml +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/tspconfig.yaml @@ -1,3 +1,3 @@ options: "@azure-tools/typespec-csharp": - namespace: _Type._Dictionary + namespace: Scm._Type._Dictionary From bc8dfb184f75dda745a7deacca0a28e2b871efb5 Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Fri, 19 Apr 2024 11:11:39 +0800 Subject: [PATCH 17/19] regen --- .../src/Generated/UnbrandedTypeSpecClient.cs | 78 +++++++------------ 1 file changed, 26 insertions(+), 52 deletions(-) diff --git a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/UnbrandedTypeSpecClient.cs b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/UnbrandedTypeSpecClient.cs index e93f58d503a..4d33ce6bc42 100644 --- a/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/UnbrandedTypeSpecClient.cs +++ b/test/UnbrandedProjects/Unbranded-TypeSpec/src/Generated/UnbrandedTypeSpecClient.cs @@ -105,13 +105,12 @@ public virtual ClientResult SayHi(string headParameter, string queryParameter, s return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The HelloAgain method. + /// Return hi again. /// The to use. /// The to use. /// The to use. /// , or is null. /// is an empty string, and was expected to be non-empty. - /// Return hi again. public virtual async Task> HelloAgainAsync(string p2, string p1, RoundTripModel action) { Argument.AssertNotNullOrEmpty(p2, nameof(p2)); @@ -123,13 +122,12 @@ public virtual async Task> HelloAgainAsync(string p return ClientResult.FromValue(RoundTripModel.FromResponse(result.GetRawResponse()), result.GetRawResponse()); } - /// The HelloAgain method. + /// Return hi again. /// The to use. /// The to use. /// The to use. /// , or is null. /// is an empty string, and was expected to be non-empty. - /// Return hi again. public virtual ClientResult HelloAgain(string p2, string p1, RoundTripModel action) { Argument.AssertNotNullOrEmpty(p2, nameof(p2)); @@ -263,16 +261,14 @@ public virtual ClientResult NoContentType(string p2, string p1, BinaryContent co return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The HelloDemo2 method. - /// Return hi in demo2. + /// Return hi in demo2. public virtual async Task> HelloDemo2Async() { ClientResult result = await HelloDemo2Async(null).ConfigureAwait(false); return ClientResult.FromValue(Thing.FromResponse(result.GetRawResponse()), result.GetRawResponse()); } - /// The HelloDemo2 method. - /// Return hi in demo2. + /// Return hi in demo2. public virtual ClientResult HelloDemo2() { ClientResult result = HelloDemo2(null); @@ -327,10 +323,9 @@ public virtual ClientResult HelloDemo2(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The CreateLiteral method. + /// Create with literal value. /// The to use. /// is null. - /// Create with literal value. public virtual async Task> CreateLiteralAsync(Thing body) { Argument.AssertNotNull(body, nameof(body)); @@ -340,10 +335,9 @@ public virtual async Task> CreateLiteralAsync(Thing body) return ClientResult.FromValue(Thing.FromResponse(result.GetRawResponse()), result.GetRawResponse()); } - /// The CreateLiteral method. + /// Create with literal value. /// The to use. /// is null. - /// Create with literal value. public virtual ClientResult CreateLiteral(Thing body) { Argument.AssertNotNull(body, nameof(body)); @@ -409,16 +403,14 @@ public virtual ClientResult CreateLiteral(BinaryContent content, RequestOptions return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The HelloLiteral method. - /// Send literal parameters. + /// Send literal parameters. public virtual async Task> HelloLiteralAsync() { ClientResult result = await HelloLiteralAsync(null).ConfigureAwait(false); return ClientResult.FromValue(Thing.FromResponse(result.GetRawResponse()), result.GetRawResponse()); } - /// The HelloLiteral method. - /// Send literal parameters. + /// Send literal parameters. public virtual ClientResult HelloLiteral() { ClientResult result = HelloLiteral(null); @@ -473,18 +465,16 @@ public virtual ClientResult HelloLiteral(RequestOptions options) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The TopAction method. + /// top level method. /// The to use. - /// top level method. public virtual async Task> TopActionAsync(DateTimeOffset action) { ClientResult result = await TopActionAsync(action, null).ConfigureAwait(false); return ClientResult.FromValue(Thing.FromResponse(result.GetRawResponse()), result.GetRawResponse()); } - /// The TopAction method. + /// top level method. /// The to use. - /// top level method. public virtual ClientResult TopAction(DateTimeOffset action) { ClientResult result = TopAction(action, null); @@ -625,10 +615,9 @@ public virtual ClientResult PatchAction(BinaryContent content, RequestOptions op return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The AnonymousBody method. + /// body parameter without body decorator. /// A model with a few properties of literal types. /// is null. - /// body parameter without body decorator. public virtual async Task> AnonymousBodyAsync(Thing thing) { Argument.AssertNotNull(thing, nameof(thing)); @@ -638,10 +627,9 @@ public virtual async Task> AnonymousBodyAsync(Thing thing) return ClientResult.FromValue(Thing.FromResponse(result.GetRawResponse()), result.GetRawResponse()); } - /// The AnonymousBody method. + /// body parameter without body decorator. /// A model with a few properties of literal types. /// is null. - /// body parameter without body decorator. public virtual ClientResult AnonymousBody(Thing thing) { Argument.AssertNotNull(thing, nameof(thing)); @@ -707,10 +695,9 @@ public virtual ClientResult AnonymousBody(BinaryContent content, RequestOptions return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The FriendlyModel method. + /// Model can have its friendly name. /// this is not a friendly model but with a friendly name. /// is null. - /// Model can have its friendly name. public virtual async Task> FriendlyModelAsync(Friend friend) { Argument.AssertNotNull(friend, nameof(friend)); @@ -720,10 +707,9 @@ public virtual async Task> FriendlyModelAsync(Friend friend return ClientResult.FromValue(Friend.FromResponse(result.GetRawResponse()), result.GetRawResponse()); } - /// The FriendlyModel method. + /// Model can have its friendly name. /// this is not a friendly model but with a friendly name. /// is null. - /// Model can have its friendly name. public virtual ClientResult FriendlyModel(Friend friend) { Argument.AssertNotNull(friend, nameof(friend)); @@ -827,11 +813,10 @@ public virtual ClientResult AddTimeHeader(RequestOptions options = null) return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The StringFormat method. + /// parameter has string format. /// The to use. /// The to use. /// is null. - /// parameter has string format. public virtual async Task StringFormatAsync(Guid subscriptionId, ModelWithFormat body) { Argument.AssertNotNull(body, nameof(body)); @@ -841,11 +826,10 @@ public virtual async Task StringFormatAsync(Guid subscriptionId, M return result; } - /// The StringFormat method. + /// parameter has string format. /// The to use. /// The to use. /// is null. - /// parameter has string format. public virtual ClientResult StringFormat(Guid subscriptionId, ModelWithFormat body) { Argument.AssertNotNull(body, nameof(body)); @@ -913,10 +897,9 @@ public virtual ClientResult StringFormat(Guid subscriptionId, BinaryContent cont return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The ProjectedNameModel method. + /// Model can have its projected name. /// this is a model with a projected name. /// is null. - /// Model can have its projected name. public virtual async Task> ProjectedNameModelAsync(ProjectedModel projectedModel) { Argument.AssertNotNull(projectedModel, nameof(projectedModel)); @@ -926,10 +909,9 @@ public virtual async Task> ProjectedNameModelAsync( return ClientResult.FromValue(ProjectedModel.FromResponse(result.GetRawResponse()), result.GetRawResponse()); } - /// The ProjectedNameModel method. + /// Model can have its projected name. /// this is a model with a projected name. /// is null. - /// Model can have its projected name. public virtual ClientResult ProjectedNameModel(ProjectedModel projectedModel) { Argument.AssertNotNull(projectedModel, nameof(projectedModel)); @@ -995,16 +977,14 @@ public virtual ClientResult ProjectedNameModel(BinaryContent content, RequestOpt return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The ReturnsAnonymousModel method. - /// return anonymous model. + /// return anonymous model. public virtual async Task> ReturnsAnonymousModelAsync() { ClientResult result = await ReturnsAnonymousModelAsync(null).ConfigureAwait(false); return ClientResult.FromValue(ReturnsAnonymousModelResponse.FromResponse(result.GetRawResponse()), result.GetRawResponse()); } - /// The ReturnsAnonymousModel method. - /// return anonymous model. + /// return anonymous model. public virtual ClientResult ReturnsAnonymousModel() { ClientResult result = ReturnsAnonymousModel(null); @@ -1105,10 +1085,9 @@ public virtual ClientResult CreateUnknownValue(BinaryContent content, RequestOpt return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The InternalProtocol method. + /// When set protocol false and convenient true, then the protocol method should be internal. /// The to use. /// is null. - /// When set protocol false and convenient true, then the protocol method should be internal. public virtual async Task> InternalProtocolAsync(Thing body) { Argument.AssertNotNull(body, nameof(body)); @@ -1118,10 +1097,9 @@ public virtual async Task> InternalProtocolAsync(Thing body) return ClientResult.FromValue(Thing.FromResponse(result.GetRawResponse()), result.GetRawResponse()); } - /// The InternalProtocol method. + /// When set protocol false and convenient true, then the protocol method should be internal. /// The to use. /// is null. - /// When set protocol false and convenient true, then the protocol method should be internal. public virtual ClientResult InternalProtocol(Thing body) { Argument.AssertNotNull(body, nameof(body)); @@ -1177,16 +1155,14 @@ internal virtual ClientResult InternalProtocol(BinaryContent content, RequestOpt return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); } - /// The StillConvenientValue method. - /// When set protocol false and convenient true, the convenient method should be generated even it has the same signature as protocol one. + /// When set protocol false and convenient true, the convenient method should be generated even it has the same signature as protocol one. public virtual async Task StillConvenientValueAsync() { ClientResult result = await StillConvenientAsync(null).ConfigureAwait(false); return result; } - /// The StillConvenientValue method. - /// When set protocol false and convenient true, the convenient method should be generated even it has the same signature as protocol one. + /// When set protocol false and convenient true, the convenient method should be generated even it has the same signature as protocol one. public virtual ClientResult StillConvenientValue() { ClientResult result = StillConvenient(null); @@ -1283,10 +1259,9 @@ public virtual ClientResult HeadAsBoolean(string id, RequestOptions option return ClientResult.FromValue(result.Value, result.GetRawResponse()); } - /// The HandleArray method. + /// head as boolean. /// The where T is of type to use. /// is null. - /// head as boolean. public virtual async Task>> HandleArrayAsync(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); @@ -1304,10 +1279,9 @@ public virtual async Task>> HandleArrayAsync( return ClientResult.FromValue(value, result.GetRawResponse()); } - /// The HandleArray method. + /// head as boolean. /// The where T is of type to use. /// is null. - /// head as boolean. public virtual ClientResult> HandleArray(IEnumerable body) { Argument.AssertNotNull(body, nameof(body)); From b9a14375d0109d4652859910578253e8aa7697e4 Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Fri, 19 Apr 2024 13:51:43 +0800 Subject: [PATCH 18/19] regen type/array and fix test cases --- test/CadlRanchProjectsNonAzure.Tests/type-array.cs | 4 ++-- test/CadlRanchProjectsNonAzure.Tests/type-dictionary.cs | 4 ++-- .../type/array/{_Type._Array.sln => Scm._Type._Array.sln} | 4 ++-- .../type/array/src/Generated/ArrayClient.cs | 2 +- .../type/array/src/Generated/ArrayClientOptions.cs | 2 +- .../type/array/src/Generated/BooleanValue.cs | 2 +- .../type/array/src/Generated/Configuration.json | 4 ++-- .../type/array/src/Generated/DatetimeValue.cs | 2 +- .../type/array/src/Generated/DurationValue.cs | 2 +- .../type/array/src/Generated/Float32Value.cs | 2 +- .../type/array/src/Generated/Int32Value.cs | 2 +- .../type/array/src/Generated/Int64Value.cs | 2 +- .../type/array/src/Generated/Internal/Argument.cs | 2 +- .../array/src/Generated/Internal/BinaryContentHelper.cs | 2 +- .../src/Generated/Internal/ChangeTrackingDictionary.cs | 2 +- .../type/array/src/Generated/Internal/ChangeTrackingList.cs | 2 +- .../src/Generated/Internal/ClientPipelineExtensions.cs | 2 +- .../type/array/src/Generated/Internal/ClientUriBuilder.cs | 2 +- .../type/array/src/Generated/Internal/ErrorResult.cs | 2 +- .../src/Generated/Internal/ModelSerializationExtensions.cs | 2 +- .../type/array/src/Generated/Internal/Optional.cs | 2 +- .../array/src/Generated/Internal/Utf8JsonBinaryContent.cs | 2 +- .../type/array/src/Generated/ModelValue.cs | 4 ++-- .../array/src/Generated/Models/InnerModel.Serialization.cs | 2 +- .../type/array/src/Generated/Models/InnerModel.cs | 2 +- .../type/array/src/Generated/NullableFloatValue.cs | 2 +- .../type/array/src/Generated/StringValue.cs | 2 +- .../type/array/src/Generated/UnknownValue.cs | 2 +- .../type/array/src/Properties/AssemblyInfo.cs | 2 +- .../src/{_Type._Array.csproj => Scm._Type._Array.csproj} | 6 +++--- ...pe._Array.Tests.csproj => Scm._Type._Array.Tests.csproj} | 2 +- 31 files changed, 38 insertions(+), 38 deletions(-) rename test/CadlRanchProjectsNonAzure/type/array/{_Type._Array.sln => Scm._Type._Array.sln} (90%) rename test/CadlRanchProjectsNonAzure/type/array/src/{_Type._Array.csproj => Scm._Type._Array.csproj} (64%) rename test/CadlRanchProjectsNonAzure/type/array/tests/{_Type._Array.Tests.csproj => Scm._Type._Array.Tests.csproj} (89%) diff --git a/test/CadlRanchProjectsNonAzure.Tests/type-array.cs b/test/CadlRanchProjectsNonAzure.Tests/type-array.cs index fa95daf553e..e2484c432bd 100644 --- a/test/CadlRanchProjectsNonAzure.Tests/type-array.cs +++ b/test/CadlRanchProjectsNonAzure.Tests/type-array.cs @@ -9,8 +9,8 @@ using AutoRest.TestServer.Tests.Infrastructure; using Azure; using NUnit.Framework; -using _Type._Array; -using _Type._Array.Models; +using Scm._Type._Array; +using Scm._Type._Array.Models; namespace CadlRanchProjectsNonAzure.Tests { diff --git a/test/CadlRanchProjectsNonAzure.Tests/type-dictionary.cs b/test/CadlRanchProjectsNonAzure.Tests/type-dictionary.cs index 7c060cd8eb2..8b15552b937 100644 --- a/test/CadlRanchProjectsNonAzure.Tests/type-dictionary.cs +++ b/test/CadlRanchProjectsNonAzure.Tests/type-dictionary.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.Threading.Tasks; using System.Xml; -using _Type._Dictionary; -using _Type._Dictionary.Models; +using Scm._Type._Dictionary; +using Scm._Type._Dictionary.Models; using AutoRest.TestServer.Tests.Infrastructure; using NUnit.Framework; diff --git a/test/CadlRanchProjectsNonAzure/type/array/_Type._Array.sln b/test/CadlRanchProjectsNonAzure/type/array/Scm._Type._Array.sln similarity index 90% rename from test/CadlRanchProjectsNonAzure/type/array/_Type._Array.sln rename to test/CadlRanchProjectsNonAzure/type/array/Scm._Type._Array.sln index 1fccb1acbb5..294a4806cbe 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/_Type._Array.sln +++ b/test/CadlRanchProjectsNonAzure/type/array/Scm._Type._Array.sln @@ -2,9 +2,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29709.97 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_Type._Array", "src\_Type._Array.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scm._Type._Array", "src\Scm._Type._Array.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_Type._Array.Tests", "tests\_Type._Array.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scm._Type._Array.Tests", "tests\Scm._Type._Array.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClient.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClient.cs index dbefd73ce2a..6bd2a4a8d49 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClient.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClient.cs @@ -6,7 +6,7 @@ using System.ClientModel.Primitives; using System.Threading; -namespace _Type._Array +namespace Scm._Type._Array { // Data plane generated client. /// The Array service client. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClientOptions.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClientOptions.cs index ecc184a21ea..ea76049aacd 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClientOptions.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ArrayClientOptions.cs @@ -4,7 +4,7 @@ using System.ClientModel.Primitives; -namespace _Type._Array +namespace Scm._Type._Array { /// Client options for ArrayClient. public partial class ArrayClientOptions : ClientPipelineOptions diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs index f132c1b89f0..89771821a8b 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/BooleanValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace _Type._Array +namespace Scm._Type._Array { // Data plane generated sub-client. /// Array of boolean values. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Configuration.json b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Configuration.json index 707863e28ea..4fae699aa1d 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Configuration.json +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Configuration.json @@ -1,7 +1,7 @@ { "output-folder": ".", - "namespace": "_Type._Array", - "library-name": "_Type._Array", + "namespace": "Scm._Type._Array", + "library-name": "Scm._Type._Array", "shared-source-folders": [ "../../../../../../artifacts/bin/AutoRest.CSharp/Debug/net7.0/Generator.Shared", "../../../../../../artifacts/bin/AutoRest.CSharp/Debug/net7.0/Azure.Core.Shared" diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs index 0d06e54b590..3acdfe3dd45 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DatetimeValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace _Type._Array +namespace Scm._Type._Array { // Data plane generated sub-client. /// Array of datetime values. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs index 62a1abd6052..7e03dae0ea4 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/DurationValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace _Type._Array +namespace Scm._Type._Array { // Data plane generated sub-client. /// Array of duration values. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs index a71b66fbd8b..26700ce0991 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Float32Value.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace _Type._Array +namespace Scm._Type._Array { // Data plane generated sub-client. /// Array of float values. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs index 2f6c7527067..d053e778748 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int32Value.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace _Type._Array +namespace Scm._Type._Array { // Data plane generated sub-client. /// Array of int32 values. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs index 4322a73f546..edb033f45bd 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Int64Value.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace _Type._Array +namespace Scm._Type._Array { // Data plane generated sub-client. /// Array of int64 values. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Argument.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Argument.cs index 9aee3d8c359..e026b1aa424 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Argument.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Argument.cs @@ -6,7 +6,7 @@ using System.Collections; using System.Collections.Generic; -namespace _Type._Array +namespace Scm._Type._Array { internal static class Argument { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/BinaryContentHelper.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/BinaryContentHelper.cs index ea107679ff3..cf484039200 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/BinaryContentHelper.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/BinaryContentHelper.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; using System.Text.Json; -namespace _Type._Array +namespace Scm._Type._Array { internal static class BinaryContentHelper { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingDictionary.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingDictionary.cs index a3770b84a3f..28ce6525939 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingDictionary.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -6,7 +6,7 @@ using System.Collections; using System.Collections.Generic; -namespace _Type._Array +namespace Scm._Type._Array { internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingList.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingList.cs index 62041e056f4..5bc4841eb89 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingList.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ChangeTrackingList.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; using System.Linq; -namespace _Type._Array +namespace Scm._Type._Array { internal class ChangeTrackingList : IList, IReadOnlyList { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientPipelineExtensions.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientPipelineExtensions.cs index 146c15a816c..f0b5ed2d0d7 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientPipelineExtensions.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientPipelineExtensions.cs @@ -6,7 +6,7 @@ using System.ClientModel.Primitives; using System.Threading.Tasks; -namespace _Type._Array +namespace Scm._Type._Array { internal static class ClientPipelineExtensions { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientUriBuilder.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientUriBuilder.cs index e58c83db2f1..fea12094fb6 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientUriBuilder.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientUriBuilder.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Text; -namespace _Type._Array +namespace Scm._Type._Array { internal class ClientUriBuilder { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ErrorResult.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ErrorResult.cs index d6015a77e70..4db962b68e6 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ErrorResult.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ErrorResult.cs @@ -5,7 +5,7 @@ using System.ClientModel; using System.ClientModel.Primitives; -namespace _Type._Array +namespace Scm._Type._Array { internal class ErrorResult : ClientResult { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ModelSerializationExtensions.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ModelSerializationExtensions.cs index a3a1decfceb..4c52756a57c 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ModelSerializationExtensions.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ModelSerializationExtensions.cs @@ -10,7 +10,7 @@ using System.Text.Json; using System.Xml; -namespace _Type._Array +namespace Scm._Type._Array { internal static class ModelSerializationExtensions { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Optional.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Optional.cs index f2628e06995..460af01a14d 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Optional.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Optional.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Text.Json; -namespace _Type._Array +namespace Scm._Type._Array { internal static class Optional { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Utf8JsonBinaryContent.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Utf8JsonBinaryContent.cs index 7220afef8fd..71970f0014c 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Utf8JsonBinaryContent.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/Utf8JsonBinaryContent.cs @@ -8,7 +8,7 @@ using System.Threading; using System.Threading.Tasks; -namespace _Type._Array +namespace Scm._Type._Array { internal class Utf8JsonBinaryContent : BinaryContent { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs index a030fdf2805..1caa8d8bf14 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/ModelValue.cs @@ -8,9 +8,9 @@ using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; -using _Type._Array.Models; +using Scm._Type._Array.Models; -namespace _Type._Array +namespace Scm._Type._Array { // Data plane generated sub-client. /// Array of model values. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.Serialization.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.Serialization.cs index 83b03991e99..cf33223aa97 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.Serialization.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; -namespace _Type._Array.Models +namespace Scm._Type._Array.Models { public partial class InnerModel : IJsonModel { diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.cs index bcb04e00431..74225894d14 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Models/InnerModel.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; -namespace _Type._Array.Models +namespace Scm._Type._Array.Models { /// Array inner model. public partial class InnerModel diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs index 749406a3dc6..ddcca71dd99 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/NullableFloatValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace _Type._Array +namespace Scm._Type._Array { // Data plane generated sub-client. /// Array of nullable float values. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs index 170a89c0626..c3bbced4a7f 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/StringValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace _Type._Array +namespace Scm._Type._Array { // Data plane generated sub-client. /// Array of string values. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs index a3174a95a96..487592c81c8 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/UnknownValue.cs @@ -9,7 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; -namespace _Type._Array +namespace Scm._Type._Array { // Data plane generated sub-client. /// Array of unknown values. diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Properties/AssemblyInfo.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Properties/AssemblyInfo.cs index 3f0a9e70ed1..ce923003a20 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Properties/AssemblyInfo.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Properties/AssemblyInfo.cs @@ -3,4 +3,4 @@ using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("_Type._Array.Tests")] +[assembly: InternalsVisibleTo("Scm._Type._Array.Tests")] diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/_Type._Array.csproj b/test/CadlRanchProjectsNonAzure/type/array/src/Scm._Type._Array.csproj similarity index 64% rename from test/CadlRanchProjectsNonAzure/type/array/src/_Type._Array.csproj rename to test/CadlRanchProjectsNonAzure/type/array/src/Scm._Type._Array.csproj index cb52795d209..f6434b6be4d 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/_Type._Array.csproj +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Scm._Type._Array.csproj @@ -1,9 +1,9 @@ - This is the _Type._Array client library for developing .NET applications with rich experience. - SDK Code Generation _Type._Array + This is the Scm._Type._Array client library for developing .NET applications with rich experience. + SDK Code Generation Scm._Type._Array 1.0.0-beta.1 - _Type._Array + Scm._Type._Array netstandard2.0 latest true diff --git a/test/CadlRanchProjectsNonAzure/type/array/tests/_Type._Array.Tests.csproj b/test/CadlRanchProjectsNonAzure/type/array/tests/Scm._Type._Array.Tests.csproj similarity index 89% rename from test/CadlRanchProjectsNonAzure/type/array/tests/_Type._Array.Tests.csproj rename to test/CadlRanchProjectsNonAzure/type/array/tests/Scm._Type._Array.Tests.csproj index 73514c94a04..54960a3b155 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/tests/_Type._Array.Tests.csproj +++ b/test/CadlRanchProjectsNonAzure/type/array/tests/Scm._Type._Array.Tests.csproj @@ -6,7 +6,7 @@ - + From ecab64871a55440719aaa8d325d633945bcdadff Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Mon, 22 Apr 2024 15:19:39 +0800 Subject: [PATCH 19/19] regen --- .../type/array/src/Generated/Internal/ClientUriBuilder.cs | 5 ++--- .../dictionary/src/Generated/Internal/ClientUriBuilder.cs | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientUriBuilder.cs b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientUriBuilder.cs index fea12094fb6..2c56242eb67 100644 --- a/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientUriBuilder.cs +++ b/test/CadlRanchProjectsNonAzure/type/array/src/Generated/Internal/ClientUriBuilder.cs @@ -14,7 +14,6 @@ internal class ClientUriBuilder private UriBuilder _uriBuilder; private StringBuilder _pathBuilder; private StringBuilder _queryBuilder; - private const char PathSeparator = '/'; public ClientUriBuilder() { @@ -42,9 +41,9 @@ public void AppendPath(string value, bool escape) value = Uri.EscapeDataString(value); } - if (value[0] == PathSeparator) + if (PathBuilder.Length > 0 && PathBuilder[PathBuilder.Length - 1] == '/' && value[0] == '/') { - value = value.Substring(1); + PathBuilder.Remove(PathBuilder.Length - 1, 1); } PathBuilder.Append(value); diff --git a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientUriBuilder.cs b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientUriBuilder.cs index c0891489cc5..142c244b720 100644 --- a/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientUriBuilder.cs +++ b/test/CadlRanchProjectsNonAzure/type/dictionary/src/Generated/Internal/ClientUriBuilder.cs @@ -14,7 +14,6 @@ internal class ClientUriBuilder private UriBuilder _uriBuilder; private StringBuilder _pathBuilder; private StringBuilder _queryBuilder; - private const char PathSeparator = '/'; public ClientUriBuilder() { @@ -42,9 +41,9 @@ public void AppendPath(string value, bool escape) value = Uri.EscapeDataString(value); } - if (value[0] == PathSeparator) + if (PathBuilder.Length > 0 && PathBuilder[PathBuilder.Length - 1] == '/' && value[0] == '/') { - value = value.Substring(1); + PathBuilder.Remove(PathBuilder.Length - 1, 1); } PathBuilder.Append(value);