Skip to content

Commit a30ff1c

Browse files
authored
Remove ResponseContentPropertyNameFormat from ClientOptions (#37056)
* API Updates per Feedback * nits * pr fb * Update
1 parent fcb9742 commit a30ff1c

29 files changed

+133
-327
lines changed

sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationAnalysisClientLiveTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ public async Task AnalyzeConversation()
4040
Kind = "Conversation",
4141
};
4242

43-
Response response = await Client.AnalyzeConversationAsync(RequestContent.Create(data, PropertyNameFormat.CamelCase));
43+
Response response = await Client.AnalyzeConversationAsync(RequestContent.Create(data, JsonPropertyNames.CamelCase));
4444

4545
// assert - main object
4646
Assert.IsNotNull(response);
4747

4848
// deserialize
49-
dynamic conversationalTaskResult = response.Content.ToDynamicFromJson();
49+
dynamic conversationalTaskResult = response.Content.ToDynamicFromJson(JsonPropertyNames.CamelCase);
5050
Assert.IsNotNull(conversationalTaskResult);
5151

5252
// assert - prediction type
@@ -92,7 +92,7 @@ public async Task AnalyzeConversation_Orchestration_Conversation()
9292
Assert.IsNotNull(response);
9393

9494
// deserialize
95-
dynamic conversationalTaskResult = response.Content.ToDynamicFromJson();
95+
dynamic conversationalTaskResult = response.Content.ToDynamicFromJson(JsonPropertyNames.CamelCase);
9696
Assert.IsNotNull(conversationalTaskResult);
9797

9898
// assert - prediction type
@@ -149,7 +149,7 @@ public async Task AnalyzeConversation_Orchestration_Luis()
149149
Assert.IsNotNull(response);
150150

151151
// deserialize
152-
dynamic conversationalTaskResult = response.Content.ToDynamicFromJson();
152+
dynamic conversationalTaskResult = response.Content.ToDynamicFromJson(JsonPropertyNames.CamelCase);
153153
Assert.IsNotNull(conversationalTaskResult);
154154

155155
// assert - prediction type
@@ -201,7 +201,7 @@ public async Task AnalyzeConversation_Orchestration_QuestionAnswering()
201201
Assert.IsNotNull(response);
202202

203203
// deserialize
204-
dynamic conversationalTaskResult = response.Content.ToDynamicFromJson();
204+
dynamic conversationalTaskResult = response.Content.ToDynamicFromJson(JsonPropertyNames.CamelCase);
205205
Assert.IsNotNull(conversationalTaskResult);
206206

207207
// assert - prediction type
@@ -256,7 +256,7 @@ public async Task SupportsAadAuthentication()
256256

257257
Response response = await client.AnalyzeConversationAsync(RequestContent.Create(data));
258258

259-
dynamic conversationalTaskResult = response.Content.ToDynamicFromJson();
259+
dynamic conversationalTaskResult = response.Content.ToDynamicFromJson(JsonPropertyNames.CamelCase);
260260
Assert.That((string)conversationalTaskResult.Result.Prediction.TopIntent, Is.EqualTo("Send"));
261261
}
262262

@@ -322,7 +322,7 @@ public async Task AnalyzeConversation_ConversationSummarization()
322322

323323
Operation<BinaryData> analyzeConversationOperation = await Client.AnalyzeConversationsAsync(WaitUntil.Completed, RequestContent.Create(data));
324324

325-
dynamic jobResults = analyzeConversationOperation.Value.ToDynamicFromJson();
325+
dynamic jobResults = analyzeConversationOperation.Value.ToDynamicFromJson(JsonPropertyNames.CamelCase);
326326
Assert.NotNull(jobResults);
327327

328328
foreach (dynamic analyzeConversationSummarization in jobResults.Tasks.Items)

sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationAuthoringClientLiveTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using System.Threading.Tasks;
66
using Azure.AI.Language.Conversations.Authoring;
7+
using Azure.Core.Serialization;
78
using Azure.Core.TestFramework;
89
using NUnit.Framework;
910

@@ -59,7 +60,7 @@ public async Task SupportsAadAuthentication()
5960

6061
Response response = await client.GetProjectAsync(TestEnvironment.ProjectName);
6162

62-
dynamic project = response.Content.ToDynamicFromJson();
63+
dynamic project = response.Content.ToDynamicFromJson(JsonPropertyNames.CamelCase);
6364
Assert.That((string)project.ProjectKind, Is.EqualTo("Conversation"));
6465
}
6566
}

sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Infrastructure/ConversationAnalysisTestBase.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT License.
33

44
using System.Threading.Tasks;
5-
using Azure.Core.Serialization;
65
using Azure.Core.TestFramework;
76

87
namespace Azure.AI.Language.Conversations.Tests
@@ -45,8 +44,6 @@ public override async Task StartTestRecordingAsync()
4544
await base.StartTestRecordingAsync();
4645

4746
ConversationsClientOptions options = new ConversationsClientOptions(ServiceVersion);
48-
options.ProtocolMethods.ResponseContentPropertyNameFormat = PropertyNameFormat.CamelCase;
49-
5047
Client = CreateClient<TClient>(
5148
TestEnvironment.Endpoint,
5249
new AzureKeyCredential(TestEnvironment.ApiKey),

sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/tests/Azure.AI.Language.QuestionAnswering.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
<ItemGroup>
1414
<ProjectReference Include="$(AzureCoreTestFramework)" />
15+
<ProjectReference Include="..\..\..\core\Azure.Core\src\Azure.Core.csproj" />
1516
<ProjectReference Include="..\..\..\cognitiveservices\Knowledge.QnAMaker\src\Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.csproj" />
1617
<ProjectReference Include="..\src\Azure.AI.Language.QuestionAnswering.csproj" />
1718
</ItemGroup>

sdk/core/Azure.Core/api/Azure.Core.net461.cs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ protected AsyncPageable(System.Threading.CancellationToken cancellationToken) {
1818
public static partial class AzureCoreExtensions
1919
{
2020
public static dynamic ToDynamicFromJson(this System.BinaryData utf8Json) { throw null; }
21-
public static dynamic ToDynamicFromJson(this System.BinaryData utf8Json, Azure.Core.Serialization.PropertyNameFormat propertyNameFormat, string dateTimeFormat = "o") { throw null; }
21+
public static dynamic ToDynamicFromJson(this System.BinaryData utf8Json, Azure.Core.Serialization.JsonPropertyNames propertyNameFormat, string dateTimeFormat = "o") { throw null; }
2222
public static System.Threading.Tasks.ValueTask<T?> ToObjectAsync<T>(this System.BinaryData data, Azure.Core.Serialization.ObjectSerializer serializer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
2323
public static object? ToObjectFromJson(this System.BinaryData data) { throw null; }
2424
public static T? ToObject<T>(this System.BinaryData data, Azure.Core.Serialization.ObjectSerializer serializer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
@@ -380,7 +380,6 @@ protected ClientOptions() { }
380380
protected ClientOptions(Azure.Core.DiagnosticsOptions? diagnostics) { }
381381
public static Azure.Core.ClientOptions Default { get { throw null; } }
382382
public Azure.Core.DiagnosticsOptions Diagnostics { get { throw null; } }
383-
public Azure.Core.Serialization.ProtocolMethodOptions ProtocolMethods { get { throw null; } }
384383
public Azure.Core.RetryOptions Retry { get { throw null; } }
385384
public Azure.Core.Pipeline.HttpPipelinePolicy? RetryPolicy { get { throw null; } set { } }
386385
public Azure.Core.Pipeline.HttpPipelineTransport Transport { get { throw null; } set { } }
@@ -545,8 +544,8 @@ protected RequestContent() { }
545544
public static Azure.Core.RequestContent Create(byte[] bytes, int index, int length) { throw null; }
546545
public static Azure.Core.RequestContent Create(System.IO.Stream stream) { throw null; }
547546
public static Azure.Core.RequestContent Create(object serializable) { throw null; }
547+
public static Azure.Core.RequestContent Create(object serializable, Azure.Core.Serialization.JsonPropertyNames propertyNameFormat, string dateTimeFormat = "o") { throw null; }
548548
public static Azure.Core.RequestContent Create(object serializable, Azure.Core.Serialization.ObjectSerializer? serializer) { throw null; }
549-
public static Azure.Core.RequestContent Create(object serializable, Azure.Core.Serialization.PropertyNameFormat propertyNameFormat, string dateTimeFormat = "o") { throw null; }
550549
public static Azure.Core.RequestContent Create(System.ReadOnlyMemory<byte> bytes) { throw null; }
551550
public static Azure.Core.RequestContent Create(string content) { throw null; }
552551
public abstract void Dispose();
@@ -1122,6 +1121,11 @@ public override void Serialize(System.IO.Stream stream, object? value, System.Ty
11221121
public override System.Threading.Tasks.ValueTask SerializeAsync(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken) { throw null; }
11231122
public override System.Threading.Tasks.ValueTask<System.BinaryData> SerializeAsync(object? value, System.Type? inputType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
11241123
}
1124+
public enum JsonPropertyNames
1125+
{
1126+
UseExact = 0,
1127+
CamelCase = 1,
1128+
}
11251129
public abstract partial class ObjectSerializer
11261130
{
11271131
protected ObjectSerializer() { }
@@ -1132,17 +1136,6 @@ protected ObjectSerializer() { }
11321136
public abstract System.Threading.Tasks.ValueTask SerializeAsync(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken);
11331137
public virtual System.Threading.Tasks.ValueTask<System.BinaryData> SerializeAsync(object? value, System.Type? inputType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
11341138
}
1135-
public enum PropertyNameFormat
1136-
{
1137-
None = 0,
1138-
CamelCase = 1,
1139-
}
1140-
public partial class ProtocolMethodOptions
1141-
{
1142-
internal ProtocolMethodOptions() { }
1143-
public string ResponseContentDateTimeFormat { get { throw null; } set { } }
1144-
public Azure.Core.Serialization.PropertyNameFormat ResponseContentPropertyNameFormat { get { throw null; } set { } }
1145-
}
11461139
}
11471140
namespace Azure.Messaging
11481141
{

sdk/core/Azure.Core/api/Azure.Core.net5.0.cs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ protected AsyncPageable(System.Threading.CancellationToken cancellationToken) {
1818
public static partial class AzureCoreExtensions
1919
{
2020
public static dynamic ToDynamicFromJson(this System.BinaryData utf8Json) { throw null; }
21-
public static dynamic ToDynamicFromJson(this System.BinaryData utf8Json, Azure.Core.Serialization.PropertyNameFormat propertyNameFormat, string dateTimeFormat = "o") { throw null; }
21+
public static dynamic ToDynamicFromJson(this System.BinaryData utf8Json, Azure.Core.Serialization.JsonPropertyNames propertyNameFormat, string dateTimeFormat = "o") { throw null; }
2222
public static System.Threading.Tasks.ValueTask<T?> ToObjectAsync<T>(this System.BinaryData data, Azure.Core.Serialization.ObjectSerializer serializer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
2323
public static object? ToObjectFromJson(this System.BinaryData data) { throw null; }
2424
public static T? ToObject<T>(this System.BinaryData data, Azure.Core.Serialization.ObjectSerializer serializer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
@@ -380,7 +380,6 @@ protected ClientOptions() { }
380380
protected ClientOptions(Azure.Core.DiagnosticsOptions? diagnostics) { }
381381
public static Azure.Core.ClientOptions Default { get { throw null; } }
382382
public Azure.Core.DiagnosticsOptions Diagnostics { get { throw null; } }
383-
public Azure.Core.Serialization.ProtocolMethodOptions ProtocolMethods { get { throw null; } }
384383
public Azure.Core.RetryOptions Retry { get { throw null; } }
385384
public Azure.Core.Pipeline.HttpPipelinePolicy? RetryPolicy { get { throw null; } set { } }
386385
public Azure.Core.Pipeline.HttpPipelineTransport Transport { get { throw null; } set { } }
@@ -545,8 +544,8 @@ protected RequestContent() { }
545544
public static Azure.Core.RequestContent Create(byte[] bytes, int index, int length) { throw null; }
546545
public static Azure.Core.RequestContent Create(System.IO.Stream stream) { throw null; }
547546
public static Azure.Core.RequestContent Create(object serializable) { throw null; }
547+
public static Azure.Core.RequestContent Create(object serializable, Azure.Core.Serialization.JsonPropertyNames propertyNameFormat, string dateTimeFormat = "o") { throw null; }
548548
public static Azure.Core.RequestContent Create(object serializable, Azure.Core.Serialization.ObjectSerializer? serializer) { throw null; }
549-
public static Azure.Core.RequestContent Create(object serializable, Azure.Core.Serialization.PropertyNameFormat propertyNameFormat, string dateTimeFormat = "o") { throw null; }
550549
public static Azure.Core.RequestContent Create(System.ReadOnlyMemory<byte> bytes) { throw null; }
551550
public static Azure.Core.RequestContent Create(string content) { throw null; }
552551
public abstract void Dispose();
@@ -1122,6 +1121,11 @@ public override void Serialize(System.IO.Stream stream, object? value, System.Ty
11221121
public override System.Threading.Tasks.ValueTask SerializeAsync(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken) { throw null; }
11231122
public override System.Threading.Tasks.ValueTask<System.BinaryData> SerializeAsync(object? value, System.Type? inputType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
11241123
}
1124+
public enum JsonPropertyNames
1125+
{
1126+
UseExact = 0,
1127+
CamelCase = 1,
1128+
}
11251129
public abstract partial class ObjectSerializer
11261130
{
11271131
protected ObjectSerializer() { }
@@ -1132,17 +1136,6 @@ protected ObjectSerializer() { }
11321136
public abstract System.Threading.Tasks.ValueTask SerializeAsync(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken);
11331137
public virtual System.Threading.Tasks.ValueTask<System.BinaryData> SerializeAsync(object? value, System.Type? inputType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
11341138
}
1135-
public enum PropertyNameFormat
1136-
{
1137-
None = 0,
1138-
CamelCase = 1,
1139-
}
1140-
public partial class ProtocolMethodOptions
1141-
{
1142-
internal ProtocolMethodOptions() { }
1143-
public string ResponseContentDateTimeFormat { get { throw null; } set { } }
1144-
public Azure.Core.Serialization.PropertyNameFormat ResponseContentPropertyNameFormat { get { throw null; } set { } }
1145-
}
11461139
}
11471140
namespace Azure.Messaging
11481141
{

sdk/core/Azure.Core/api/Azure.Core.net6.0.cs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ protected AsyncPageable(System.Threading.CancellationToken cancellationToken) {
1818
public static partial class AzureCoreExtensions
1919
{
2020
public static dynamic ToDynamicFromJson(this System.BinaryData utf8Json) { throw null; }
21-
public static dynamic ToDynamicFromJson(this System.BinaryData utf8Json, Azure.Core.Serialization.PropertyNameFormat propertyNameFormat, string dateTimeFormat = "o") { throw null; }
21+
public static dynamic ToDynamicFromJson(this System.BinaryData utf8Json, Azure.Core.Serialization.JsonPropertyNames propertyNameFormat, string dateTimeFormat = "o") { throw null; }
2222
public static System.Threading.Tasks.ValueTask<T?> ToObjectAsync<T>(this System.BinaryData data, Azure.Core.Serialization.ObjectSerializer serializer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
2323
public static object? ToObjectFromJson(this System.BinaryData data) { throw null; }
2424
public static T? ToObject<T>(this System.BinaryData data, Azure.Core.Serialization.ObjectSerializer serializer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
@@ -380,7 +380,6 @@ protected ClientOptions() { }
380380
protected ClientOptions(Azure.Core.DiagnosticsOptions? diagnostics) { }
381381
public static Azure.Core.ClientOptions Default { get { throw null; } }
382382
public Azure.Core.DiagnosticsOptions Diagnostics { get { throw null; } }
383-
public Azure.Core.Serialization.ProtocolMethodOptions ProtocolMethods { get { throw null; } }
384383
public Azure.Core.RetryOptions Retry { get { throw null; } }
385384
public Azure.Core.Pipeline.HttpPipelinePolicy? RetryPolicy { get { throw null; } set { } }
386385
public Azure.Core.Pipeline.HttpPipelineTransport Transport { get { throw null; } set { } }
@@ -545,8 +544,8 @@ protected RequestContent() { }
545544
public static Azure.Core.RequestContent Create(byte[] bytes, int index, int length) { throw null; }
546545
public static Azure.Core.RequestContent Create(System.IO.Stream stream) { throw null; }
547546
public static Azure.Core.RequestContent Create(object serializable) { throw null; }
547+
public static Azure.Core.RequestContent Create(object serializable, Azure.Core.Serialization.JsonPropertyNames propertyNameFormat, string dateTimeFormat = "o") { throw null; }
548548
public static Azure.Core.RequestContent Create(object serializable, Azure.Core.Serialization.ObjectSerializer? serializer) { throw null; }
549-
public static Azure.Core.RequestContent Create(object serializable, Azure.Core.Serialization.PropertyNameFormat propertyNameFormat, string dateTimeFormat = "o") { throw null; }
550549
public static Azure.Core.RequestContent Create(System.ReadOnlyMemory<byte> bytes) { throw null; }
551550
public static Azure.Core.RequestContent Create(string content) { throw null; }
552551
public abstract void Dispose();
@@ -1122,6 +1121,11 @@ public override void Serialize(System.IO.Stream stream, object? value, System.Ty
11221121
public override System.Threading.Tasks.ValueTask SerializeAsync(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken) { throw null; }
11231122
public override System.Threading.Tasks.ValueTask<System.BinaryData> SerializeAsync(object? value, System.Type? inputType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
11241123
}
1124+
public enum JsonPropertyNames
1125+
{
1126+
UseExact = 0,
1127+
CamelCase = 1,
1128+
}
11251129
public abstract partial class ObjectSerializer
11261130
{
11271131
protected ObjectSerializer() { }
@@ -1132,17 +1136,6 @@ protected ObjectSerializer() { }
11321136
public abstract System.Threading.Tasks.ValueTask SerializeAsync(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken);
11331137
public virtual System.Threading.Tasks.ValueTask<System.BinaryData> SerializeAsync(object? value, System.Type? inputType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
11341138
}
1135-
public enum PropertyNameFormat
1136-
{
1137-
None = 0,
1138-
CamelCase = 1,
1139-
}
1140-
public partial class ProtocolMethodOptions
1141-
{
1142-
internal ProtocolMethodOptions() { }
1143-
public string ResponseContentDateTimeFormat { get { throw null; } set { } }
1144-
public Azure.Core.Serialization.PropertyNameFormat ResponseContentPropertyNameFormat { get { throw null; } set { } }
1145-
}
11461139
}
11471140
namespace Azure.Messaging
11481141
{

0 commit comments

Comments
 (0)