diff --git a/sdk/core/Azure.Core/api/Azure.Core.net461.cs b/sdk/core/Azure.Core/api/Azure.Core.net461.cs index a3218d50be79..31a30fc73652 100644 --- a/sdk/core/Azure.Core/api/Azure.Core.net461.cs +++ b/sdk/core/Azure.Core/api/Azure.Core.net461.cs @@ -270,8 +270,8 @@ protected Response() { } public partial class SerializableOptions { public SerializableOptions() { } - public bool HandleAdditionalProperties { get { throw null; } set { } } - public bool IncludeReadOnlyProperties { get { throw null; } set { } } + public bool IgnoreAdditionalProperties { get { throw null; } set { } } + public bool IgnoreReadOnlyProperties { get { throw null; } set { } } public bool PrettyPrint { get { throw null; } set { } } } public partial class SyncAsyncEventArgs : System.EventArgs diff --git a/sdk/core/Azure.Core/api/Azure.Core.net5.0.cs b/sdk/core/Azure.Core/api/Azure.Core.net5.0.cs index d135442d4127..740b36f28cb1 100644 --- a/sdk/core/Azure.Core/api/Azure.Core.net5.0.cs +++ b/sdk/core/Azure.Core/api/Azure.Core.net5.0.cs @@ -270,8 +270,8 @@ protected Response() { } public partial class SerializableOptions { public SerializableOptions() { } - public bool HandleAdditionalProperties { get { throw null; } set { } } - public bool IncludeReadOnlyProperties { get { throw null; } set { } } + public bool IgnoreAdditionalProperties { get { throw null; } set { } } + public bool IgnoreReadOnlyProperties { get { throw null; } set { } } public bool PrettyPrint { get { throw null; } set { } } } public partial class SyncAsyncEventArgs : System.EventArgs diff --git a/sdk/core/Azure.Core/api/Azure.Core.net6.0.cs b/sdk/core/Azure.Core/api/Azure.Core.net6.0.cs index d135442d4127..740b36f28cb1 100644 --- a/sdk/core/Azure.Core/api/Azure.Core.net6.0.cs +++ b/sdk/core/Azure.Core/api/Azure.Core.net6.0.cs @@ -270,8 +270,8 @@ protected Response() { } public partial class SerializableOptions { public SerializableOptions() { } - public bool HandleAdditionalProperties { get { throw null; } set { } } - public bool IncludeReadOnlyProperties { get { throw null; } set { } } + public bool IgnoreAdditionalProperties { get { throw null; } set { } } + public bool IgnoreReadOnlyProperties { get { throw null; } set { } } public bool PrettyPrint { get { throw null; } set { } } } public partial class SyncAsyncEventArgs : System.EventArgs diff --git a/sdk/core/Azure.Core/api/Azure.Core.netcoreapp2.1.cs b/sdk/core/Azure.Core/api/Azure.Core.netcoreapp2.1.cs index a3218d50be79..31a30fc73652 100644 --- a/sdk/core/Azure.Core/api/Azure.Core.netcoreapp2.1.cs +++ b/sdk/core/Azure.Core/api/Azure.Core.netcoreapp2.1.cs @@ -270,8 +270,8 @@ protected Response() { } public partial class SerializableOptions { public SerializableOptions() { } - public bool HandleAdditionalProperties { get { throw null; } set { } } - public bool IncludeReadOnlyProperties { get { throw null; } set { } } + public bool IgnoreAdditionalProperties { get { throw null; } set { } } + public bool IgnoreReadOnlyProperties { get { throw null; } set { } } public bool PrettyPrint { get { throw null; } set { } } } public partial class SyncAsyncEventArgs : System.EventArgs diff --git a/sdk/core/Azure.Core/api/Azure.Core.netstandard2.0.cs b/sdk/core/Azure.Core/api/Azure.Core.netstandard2.0.cs index a3218d50be79..31a30fc73652 100644 --- a/sdk/core/Azure.Core/api/Azure.Core.netstandard2.0.cs +++ b/sdk/core/Azure.Core/api/Azure.Core.netstandard2.0.cs @@ -270,8 +270,8 @@ protected Response() { } public partial class SerializableOptions { public SerializableOptions() { } - public bool HandleAdditionalProperties { get { throw null; } set { } } - public bool IncludeReadOnlyProperties { get { throw null; } set { } } + public bool IgnoreAdditionalProperties { get { throw null; } set { } } + public bool IgnoreReadOnlyProperties { get { throw null; } set { } } public bool PrettyPrint { get { throw null; } set { } } } public partial class SyncAsyncEventArgs : System.EventArgs diff --git a/sdk/core/Azure.Core/src/SerializableOptions.cs b/sdk/core/Azure.Core/src/SerializableOptions.cs index 61f2419d7843..cd00da019dca 100644 --- a/sdk/core/Azure.Core/src/SerializableOptions.cs +++ b/sdk/core/Azure.Core/src/SerializableOptions.cs @@ -4,23 +4,23 @@ namespace Azure { /// - /// TODO + /// Provides the client options for serializing models. /// public class SerializableOptions { /// - /// TODO + /// Bool that determines if ReadOnlyProperties will be serialized. Default is false. /// - public bool IncludeReadOnlyProperties { get; set; } = true; + public bool IgnoreReadOnlyProperties { get; set; } /// - /// TODO + /// Bool that determines if AdditionalProperties will be serialized. Default is false. /// - public bool HandleAdditionalProperties { get; set; } = true; + public bool IgnoreAdditionalProperties { get; set; } /// - /// TODO + /// Bool that determines if Json will be PrettyPrinted. Default is false. /// - public bool PrettyPrint { get; set; } = false; + public bool PrettyPrint { get; set; } } } diff --git a/sdk/core/Azure.Core/tests/ModelSerializationTests/Animal.cs b/sdk/core/Azure.Core/tests/ModelSerializationTests/Animal.cs index 907e2918fe1d..187d3073a486 100644 --- a/sdk/core/Azure.Core/tests/ModelSerializationTests/Animal.cs +++ b/sdk/core/Azure.Core/tests/ModelSerializationTests/Animal.cs @@ -47,7 +47,7 @@ internal Animal(string name) void IUtf8JsonSerializable.Write(Utf8JsonWriter writer, SerializableOptions options) { writer.WriteStartObject(); - if (options.IncludeReadOnlyProperties) + if (options.IgnoreReadOnlyProperties) { writer.WritePropertyName("latinName"u8); writer.WriteStringValue(LatinName); @@ -59,7 +59,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer, SerializableOptions opti writer.WritePropertyName("weight"u8); writer.WriteNumberValue(Weight); - if (options.HandleAdditionalProperties) + if (options.IgnoreAdditionalProperties) { //write out the raw data foreach (var property in RawData) @@ -106,7 +106,7 @@ internal static Animal DeserializeAnimal(JsonElement element, SerializableOption continue; } - if (options.HandleAdditionalProperties) + if (options.IgnoreAdditionalProperties) { //this means it's an unknown property we got rawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); diff --git a/sdk/core/Azure.Core/tests/ModelSerializationTests/CatReadOnlyProperty.cs b/sdk/core/Azure.Core/tests/ModelSerializationTests/CatReadOnlyProperty.cs index 4f7152db6921..c8431b5b56ea 100644 --- a/sdk/core/Azure.Core/tests/ModelSerializationTests/CatReadOnlyProperty.cs +++ b/sdk/core/Azure.Core/tests/ModelSerializationTests/CatReadOnlyProperty.cs @@ -28,7 +28,7 @@ internal CatReadOnlyProperty(double weight, string latinName, string name, bool void IUtf8JsonSerializable.Write(Utf8JsonWriter writer, SerializableOptions options) { writer.WriteStartObject(); - if (options.IncludeReadOnlyProperties) + if (options.IgnoreReadOnlyProperties) { writer.WritePropertyName("latinName"u8); writer.WriteStringValue(LatinName); @@ -42,7 +42,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer, SerializableOptions opti writer.WritePropertyName("hasWhiskers"u8); writer.WriteBooleanValue(HasWhiskers); - if (options.HandleAdditionalProperties) + if (options.IgnoreAdditionalProperties) { //write out the raw data foreach (var property in RawData) @@ -95,7 +95,7 @@ internal static CatReadOnlyProperty DeserializeCatReadOnlyProperty(JsonElement e continue; } - if (options.HandleAdditionalProperties) + if (options.IgnoreAdditionalProperties) { //this means its an unknown property we got rawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); diff --git a/sdk/core/Azure.Core/tests/ModelSerializationTests/DogListProperty.cs b/sdk/core/Azure.Core/tests/ModelSerializationTests/DogListProperty.cs index 6dfae6392b9b..bd5bed7f0ba4 100644 --- a/sdk/core/Azure.Core/tests/ModelSerializationTests/DogListProperty.cs +++ b/sdk/core/Azure.Core/tests/ModelSerializationTests/DogListProperty.cs @@ -32,7 +32,7 @@ public DogListProperty() void IUtf8JsonSerializable.Write(Utf8JsonWriter writer, SerializableOptions options) { writer.WriteStartObject(); - if (options.IncludeReadOnlyProperties) + if (options.IgnoreReadOnlyProperties) { writer.WritePropertyName("latinName"u8); writer.WriteStringValue(LatinName); @@ -52,7 +52,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer, SerializableOptions opti } writer.WriteEndArray(); - if (options.HandleAdditionalProperties) + if (options.IgnoreAdditionalProperties) { //write out the raw data foreach (var property in RawData) @@ -107,7 +107,7 @@ internal static DogListProperty DeserializeDogListProperty(JsonElement element, } continue; } - if (options.HandleAdditionalProperties) + if (options.IgnoreAdditionalProperties) { //this means its an unknown property we got rawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); diff --git a/sdk/core/Azure.Core/tests/ModelSerializationTests/ListPropertyTests.cs b/sdk/core/Azure.Core/tests/ModelSerializationTests/ListPropertyTests.cs index 9b17adad84b0..864dc0e8f38a 100644 --- a/sdk/core/Azure.Core/tests/ModelSerializationTests/ListPropertyTests.cs +++ b/sdk/core/Azure.Core/tests/ModelSerializationTests/ListPropertyTests.cs @@ -14,7 +14,7 @@ namespace Azure.Core.Tests.ModelSerializationTests { public class ListPropertyTests { - private readonly SerializableOptions _wireOptions = new SerializableOptions { IncludeReadOnlyProperties = false }; + private readonly SerializableOptions _wireOptions = new SerializableOptions { IgnoreReadOnlyProperties = false }; private readonly SerializableOptions _objectOptions = new SerializableOptions(); [TestCase(true, true)] @@ -43,7 +43,7 @@ public void CanRoundTripFutureVersionWithoutLoss(bool includeReadonly, bool hand expectedSerialized.Append("}"); var expectedSerializedString = expectedSerialized.ToString(); - SerializableOptions options = new SerializableOptions() { IncludeReadOnlyProperties = includeReadonly, HandleAdditionalProperties = handleUnknown }; + SerializableOptions options = new SerializableOptions() { IgnoreReadOnlyProperties = includeReadonly, IgnoreAdditionalProperties = handleUnknown }; var model = new DogListProperty(); model.TryDeserialize(new MemoryStream(Encoding.UTF8.GetBytes(serviceResponse)), out long bytesConsumed, options: options); @@ -106,7 +106,6 @@ public void PrettyPrint() var expectedJson = """ { - "latinName": "Animalia", "name": "Doggo", "isHungry": false, "weight": 1.1, diff --git a/sdk/core/Azure.Core/tests/ModelSerializationTests/ReadOnlyPropertyTests.cs b/sdk/core/Azure.Core/tests/ModelSerializationTests/ReadOnlyPropertyTests.cs index 5aba9069c5cb..16e297226161 100644 --- a/sdk/core/Azure.Core/tests/ModelSerializationTests/ReadOnlyPropertyTests.cs +++ b/sdk/core/Azure.Core/tests/ModelSerializationTests/ReadOnlyPropertyTests.cs @@ -14,7 +14,7 @@ namespace Azure.Core.Tests.ModelSerializationTests { public class ReadOnlyPropertyTests { - private readonly SerializableOptions _wireOptions = new SerializableOptions { IncludeReadOnlyProperties = false }; + private readonly SerializableOptions _wireOptions = new SerializableOptions { IgnoreReadOnlyProperties = false }; private readonly SerializableOptions _objectOptions = new SerializableOptions(); [TestCase(true, true)] @@ -41,7 +41,7 @@ public void CanRoundTripFutureVersionWithoutLoss(bool includeReadonly, bool hand expectedSerialized.Append("}"); var expectedSerializedString = expectedSerialized.ToString(); - SerializableOptions options = new SerializableOptions() { IncludeReadOnlyProperties = includeReadonly, HandleAdditionalProperties = handleUnknown }; + SerializableOptions options = new SerializableOptions() { IgnoreReadOnlyProperties = includeReadonly, IgnoreAdditionalProperties = handleUnknown }; var model = new Animal(); model.TryDeserialize(new MemoryStream(Encoding.UTF8.GetBytes(serviceResponse)), out long bytesConsumed, options: options); @@ -102,7 +102,6 @@ public void PrettyPrint() var expectedJson = """ { - "latinName": "Felis catus", "name": "Catto", "isHungry": true, "weight": 3.2,