diff --git a/sdk/core/Azure.Core.Expressions.DataFactory/api/Azure.Core.Expressions.DataFactory.net8.0.cs b/sdk/core/Azure.Core.Expressions.DataFactory/api/Azure.Core.Expressions.DataFactory.net8.0.cs index ddd00bb62f8e..e59aebd019a6 100644 --- a/sdk/core/Azure.Core.Expressions.DataFactory/api/Azure.Core.Expressions.DataFactory.net8.0.cs +++ b/sdk/core/Azure.Core.Expressions.DataFactory/api/Azure.Core.Expressions.DataFactory.net8.0.cs @@ -44,19 +44,29 @@ internal DataFactoryElement() { } System.BinaryData System.ClientModel.Primitives.IPersistableModel>.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } public override string? ToString() { throw null; } } - public partial class DataFactoryKeyVaultSecret : Azure.Core.Expressions.DataFactory.DataFactorySecret + public partial class DataFactoryKeyVaultSecret : Azure.Core.Expressions.DataFactory.DataFactorySecret, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DataFactoryKeyVaultSecret(Azure.Core.Expressions.DataFactory.DataFactoryLinkedServiceReference store, Azure.Core.Expressions.DataFactory.DataFactoryElement secretName) { } public Azure.Core.Expressions.DataFactory.DataFactoryElement SecretName { get { throw null; } set { } } public Azure.Core.Expressions.DataFactory.DataFactoryElement SecretVersion { get { throw null; } set { } } public Azure.Core.Expressions.DataFactory.DataFactoryLinkedServiceReference Store { get { throw null; } set { } } + Azure.Core.Expressions.DataFactory.DataFactoryKeyVaultSecret? System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Core.Expressions.DataFactory.DataFactoryKeyVaultSecret? System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class DataFactoryLinkedServiceReference + public partial class DataFactoryLinkedServiceReference : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DataFactoryLinkedServiceReference(Azure.Core.Expressions.DataFactory.DataFactoryLinkedServiceReferenceKind referenceKind, string referenceName) { } public System.Collections.Generic.IDictionary Parameters { get { throw null; } } public Azure.Core.Expressions.DataFactory.DataFactoryLinkedServiceReferenceKind ReferenceKind { get { throw null; } set { } } public string? ReferenceName { get { throw null; } set { } } + Azure.Core.Expressions.DataFactory.DataFactoryLinkedServiceReference? System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Core.Expressions.DataFactory.DataFactoryLinkedServiceReference? System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct DataFactoryLinkedServiceReferenceKind : System.IEquatable @@ -75,14 +85,24 @@ public DataFactoryLinkedServiceReference(Azure.Core.Expressions.DataFactory.Data public static bool operator !=(Azure.Core.Expressions.DataFactory.DataFactoryLinkedServiceReferenceKind left, Azure.Core.Expressions.DataFactory.DataFactoryLinkedServiceReferenceKind right) { throw null; } public override string ToString() { throw null; } } - public abstract partial class DataFactorySecret + public abstract partial class DataFactorySecret : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { protected DataFactorySecret() { } + Azure.Core.Expressions.DataFactory.DataFactorySecret? System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Core.Expressions.DataFactory.DataFactorySecret? System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class DataFactorySecretString : Azure.Core.Expressions.DataFactory.DataFactorySecret + public partial class DataFactorySecretString : Azure.Core.Expressions.DataFactory.DataFactorySecret, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DataFactorySecretString(string value) { } public string? Value { get { throw null; } set { } } public static implicit operator Azure.Core.Expressions.DataFactory.DataFactorySecretString (string literal) { throw null; } + Azure.Core.Expressions.DataFactory.DataFactorySecretString? System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Core.Expressions.DataFactory.DataFactorySecretString? System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } } diff --git a/sdk/core/Azure.Core.Expressions.DataFactory/api/Azure.Core.Expressions.DataFactory.netstandard2.0.cs b/sdk/core/Azure.Core.Expressions.DataFactory/api/Azure.Core.Expressions.DataFactory.netstandard2.0.cs index ddd00bb62f8e..e59aebd019a6 100644 --- a/sdk/core/Azure.Core.Expressions.DataFactory/api/Azure.Core.Expressions.DataFactory.netstandard2.0.cs +++ b/sdk/core/Azure.Core.Expressions.DataFactory/api/Azure.Core.Expressions.DataFactory.netstandard2.0.cs @@ -44,19 +44,29 @@ internal DataFactoryElement() { } System.BinaryData System.ClientModel.Primitives.IPersistableModel>.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } public override string? ToString() { throw null; } } - public partial class DataFactoryKeyVaultSecret : Azure.Core.Expressions.DataFactory.DataFactorySecret + public partial class DataFactoryKeyVaultSecret : Azure.Core.Expressions.DataFactory.DataFactorySecret, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DataFactoryKeyVaultSecret(Azure.Core.Expressions.DataFactory.DataFactoryLinkedServiceReference store, Azure.Core.Expressions.DataFactory.DataFactoryElement secretName) { } public Azure.Core.Expressions.DataFactory.DataFactoryElement SecretName { get { throw null; } set { } } public Azure.Core.Expressions.DataFactory.DataFactoryElement SecretVersion { get { throw null; } set { } } public Azure.Core.Expressions.DataFactory.DataFactoryLinkedServiceReference Store { get { throw null; } set { } } + Azure.Core.Expressions.DataFactory.DataFactoryKeyVaultSecret? System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Core.Expressions.DataFactory.DataFactoryKeyVaultSecret? System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class DataFactoryLinkedServiceReference + public partial class DataFactoryLinkedServiceReference : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DataFactoryLinkedServiceReference(Azure.Core.Expressions.DataFactory.DataFactoryLinkedServiceReferenceKind referenceKind, string referenceName) { } public System.Collections.Generic.IDictionary Parameters { get { throw null; } } public Azure.Core.Expressions.DataFactory.DataFactoryLinkedServiceReferenceKind ReferenceKind { get { throw null; } set { } } public string? ReferenceName { get { throw null; } set { } } + Azure.Core.Expressions.DataFactory.DataFactoryLinkedServiceReference? System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Core.Expressions.DataFactory.DataFactoryLinkedServiceReference? System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct DataFactoryLinkedServiceReferenceKind : System.IEquatable @@ -75,14 +85,24 @@ public DataFactoryLinkedServiceReference(Azure.Core.Expressions.DataFactory.Data public static bool operator !=(Azure.Core.Expressions.DataFactory.DataFactoryLinkedServiceReferenceKind left, Azure.Core.Expressions.DataFactory.DataFactoryLinkedServiceReferenceKind right) { throw null; } public override string ToString() { throw null; } } - public abstract partial class DataFactorySecret + public abstract partial class DataFactorySecret : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { protected DataFactorySecret() { } + Azure.Core.Expressions.DataFactory.DataFactorySecret? System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Core.Expressions.DataFactory.DataFactorySecret? System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class DataFactorySecretString : Azure.Core.Expressions.DataFactory.DataFactorySecret + public partial class DataFactorySecretString : Azure.Core.Expressions.DataFactory.DataFactorySecret, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DataFactorySecretString(string value) { } public string? Value { get { throw null; } set { } } public static implicit operator Azure.Core.Expressions.DataFactory.DataFactorySecretString (string literal) { throw null; } + Azure.Core.Expressions.DataFactory.DataFactorySecretString? System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Core.Expressions.DataFactory.DataFactorySecretString? System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } } diff --git a/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactoryKeyVaultSecret.Serialization.cs b/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactoryKeyVaultSecret.Serialization.cs index 4dcae95d4f29..27e6a2f73119 100644 --- a/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactoryKeyVaultSecret.Serialization.cs +++ b/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactoryKeyVaultSecret.Serialization.cs @@ -9,7 +9,7 @@ namespace Azure.Core.Expressions.DataFactory { [JsonConverter(typeof(DataFactoryKeyVaultSecretConverter))] - public partial class DataFactoryKeyVaultSecret : IUtf8JsonSerializable + public partial class DataFactoryKeyVaultSecret : IUtf8JsonSerializable, IJsonModel { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -29,6 +29,54 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } + 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(DataFactoryKeyVaultSecret)} does not support writing '{format}' format."); + } + + ((IUtf8JsonSerializable)this).Write(writer); + } + + DataFactoryKeyVaultSecret? 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(DataFactoryKeyVaultSecret)} does not support reading '{format}' format."); + } + + using var document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureKeyVaultSecretReference(document.RootElement); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataFactoryKeyVaultSecret)} does not support writing '{format}' format."); + } + + return ModelReaderWriter.Write(this, options, DataFactoryContext.Default); + } + + DataFactoryKeyVaultSecret? IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataFactoryKeyVaultSecret)} does not support reading '{format}' format."); + } + + using var document = JsonDocument.Parse(data); + return DeserializeAzureKeyVaultSecretReference(document.RootElement); + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + internal static DataFactoryKeyVaultSecret? DeserializeAzureKeyVaultSecretReference(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -66,12 +114,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) continue; } } - return new DataFactoryKeyVaultSecret(type, store, secretName, secretVersion); + return new DataFactoryKeyVaultSecret(type!, store!, secretName!, secretVersion!); } - internal partial class DataFactoryKeyVaultSecretConverter : JsonConverter + internal partial class DataFactoryKeyVaultSecretConverter : JsonConverter { - public override void Write(Utf8JsonWriter writer, DataFactoryKeyVaultSecret? model, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, DataFactoryKeyVaultSecret model, JsonSerializerOptions options) { (model as IUtf8JsonSerializable)?.Write(writer); } diff --git a/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactoryKeyVaultSecret.cs b/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactoryKeyVaultSecret.cs index 11392f7976b4..d0f369233a54 100644 --- a/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactoryKeyVaultSecret.cs +++ b/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactoryKeyVaultSecret.cs @@ -13,6 +13,10 @@ namespace Azure.Core.Expressions.DataFactory [PropertyReferenceType(new string[0], new[]{ nameof(SecretBaseType)})] public partial class DataFactoryKeyVaultSecret : DataFactorySecret { + /// Initializes a new instance of DataFactoryKeyVaultSecret. + internal DataFactoryKeyVaultSecret() + { + } /// Initializes a new instance of AzureKeyVaultSecretReference. /// The Azure Key Vault linked service reference. /// The name of the secret in Azure Key Vault. Type: string (or Expression with resultType string). diff --git a/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactoryLinkedServiceReference.Serialization.cs b/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactoryLinkedServiceReference.Serialization.cs index 6eb043516847..1d6e62118ace 100644 --- a/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactoryLinkedServiceReference.Serialization.cs +++ b/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactoryLinkedServiceReference.Serialization.cs @@ -3,13 +3,14 @@ using System; using System.Collections.Generic; +using System.ClientModel.Primitives; using System.Text.Json; using System.Text.Json.Serialization; namespace Azure.Core.Expressions.DataFactory { [JsonConverter(typeof(DataFactoryLinkedServiceReferenceConverter))] - public partial class DataFactoryLinkedServiceReference : IUtf8JsonSerializable + public partial class DataFactoryLinkedServiceReference : IUtf8JsonSerializable, IJsonModel { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -41,6 +42,54 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } + 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(DataFactoryLinkedServiceReference)} does not support writing '{format}' format."); + } + + ((IUtf8JsonSerializable)this).Write(writer); + } + + DataFactoryLinkedServiceReference? 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(DataFactoryLinkedServiceReference)} does not support reading '{format}' format."); + } + + using var document = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryLinkedServiceReference(document.RootElement); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataFactoryLinkedServiceReference)} does not support writing '{format}' format."); + } + + return ModelReaderWriter.Write(this, options, DataFactoryContext.Default); + } + + DataFactoryLinkedServiceReference? IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataFactoryLinkedServiceReference)} does not support reading '{format}' format."); + } + + using var document = JsonDocument.Parse(data); + return DeserializeDataFactoryLinkedServiceReference(document.RootElement); + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + internal static DataFactoryLinkedServiceReference? DeserializeDataFactoryLinkedServiceReference(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -87,9 +136,9 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) return new DataFactoryLinkedServiceReference(kind, referenceName, Optional.ToDictionary(parameters)); } - internal partial class DataFactoryLinkedServiceReferenceConverter : JsonConverter + internal partial class DataFactoryLinkedServiceReferenceConverter : JsonConverter { - public override void Write(Utf8JsonWriter writer, DataFactoryLinkedServiceReference? model, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, DataFactoryLinkedServiceReference model, JsonSerializerOptions options) { (model as IUtf8JsonSerializable)?.Write(writer); } diff --git a/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactoryLinkedServiceReference.cs b/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactoryLinkedServiceReference.cs index e20bd0f11dfe..80797585e035 100644 --- a/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactoryLinkedServiceReference.cs +++ b/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactoryLinkedServiceReference.cs @@ -11,6 +11,11 @@ namespace Azure.Core.Expressions.DataFactory [PropertyReferenceType] public partial class DataFactoryLinkedServiceReference { + /// Initializes a new instance of DataFactoryLinkedServiceReference. + internal DataFactoryLinkedServiceReference() + { + Parameters = new ChangeTrackingDictionary(); + } /// Initializes a new instance of DataFactoryLinkedServiceReference. /// Linked service reference type. /// Reference LinkedService name. diff --git a/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactorySecret.Serialization.cs b/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactorySecret.Serialization.cs index c48dd274b84a..a1650783629f 100644 --- a/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactorySecret.Serialization.cs +++ b/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactorySecret.Serialization.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.ClientModel.Primitives; using System.Text.Json; using System.Text.Json.Serialization; using Azure.Core; @@ -9,7 +10,8 @@ namespace Azure.Core.Expressions.DataFactory { [JsonConverter(typeof(DataFactorySecretBaseDefinitionConverter))] - public partial class DataFactorySecret : IUtf8JsonSerializable + [PersistableModelProxy(typeof(UnknownSecret))] + public partial class DataFactorySecret : IUtf8JsonSerializable, IJsonModel { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -19,6 +21,54 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } + 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(DataFactorySecret)} does not support writing '{format}' format."); + } + + ((IUtf8JsonSerializable)this).Write(writer); + } + + DataFactorySecret? 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(DataFactorySecret)} does not support reading '{format}' format."); + } + + using var document = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactorySecretBaseDefinition(document.RootElement); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataFactorySecret)} does not support writing '{format}' format."); + } + + return ModelReaderWriter.Write(this, options, DataFactoryContext.Default); + } + + DataFactorySecret? IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataFactorySecret)} does not support reading '{format}' format."); + } + + using var document = JsonDocument.Parse(data); + return DeserializeDataFactorySecretBaseDefinition(document.RootElement); + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + internal static DataFactorySecret? DeserializeDataFactorySecretBaseDefinition(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -36,9 +86,9 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) return UnknownSecret.DeserializeUnknownSecretBase(element); } - internal partial class DataFactorySecretBaseDefinitionConverter : JsonConverter + internal partial class DataFactorySecretBaseDefinitionConverter : JsonConverter { - public override void Write(Utf8JsonWriter writer, DataFactorySecret? model, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, DataFactorySecret model, JsonSerializerOptions options) { (model as IUtf8JsonSerializable)?.Write(writer); } diff --git a/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactorySecretString.Serialization.cs b/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactorySecretString.Serialization.cs index 203749c15099..2e901a3e7d11 100644 --- a/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactorySecretString.Serialization.cs +++ b/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactorySecretString.Serialization.cs @@ -2,13 +2,14 @@ // Licensed under the MIT License. using System; +using System.ClientModel.Primitives; using System.Text.Json; using System.Text.Json.Serialization; namespace Azure.Core.Expressions.DataFactory { [JsonConverter(typeof(DataFactorySecretStringConverter))] - public partial class DataFactorySecretString : IUtf8JsonSerializable + public partial class DataFactorySecretString : IUtf8JsonSerializable, IJsonModel { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -20,6 +21,54 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } + 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(DataFactorySecretString)} does not support writing '{format}' format."); + } + + ((IUtf8JsonSerializable)this).Write(writer); + } + + DataFactorySecretString? 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(DataFactorySecretString)} does not support reading '{format}' format."); + } + + using var document = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactorySecretString(document.RootElement); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataFactorySecretString)} does not support writing '{format}' format."); + } + + return ModelReaderWriter.Write(this, options, DataFactoryContext.Default); + } + + DataFactorySecretString? IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataFactorySecretString)} does not support reading '{format}' format."); + } + + using var document = JsonDocument.Parse(data); + return DeserializeDataFactorySecretString(document.RootElement); + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + internal static DataFactorySecretString? DeserializeDataFactorySecretString(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -44,9 +93,9 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) return new DataFactorySecretString(type, value); } - internal partial class DataFactorySecretStringConverter : JsonConverter + internal partial class DataFactorySecretStringConverter : JsonConverter { - public override void Write(Utf8JsonWriter writer, DataFactorySecretString? model, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, DataFactorySecretString model, JsonSerializerOptions options) { (model as IUtf8JsonSerializable)?.Write(writer); } diff --git a/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactorySecretString.cs b/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactorySecretString.cs index e8b86104a44c..8994f856820f 100644 --- a/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactorySecretString.cs +++ b/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactorySecretString.cs @@ -9,6 +9,10 @@ namespace Azure.Core.Expressions.DataFactory [PropertyReferenceType(new string[0], new[]{ nameof(SecretBaseType)})] public partial class DataFactorySecretString : DataFactorySecret { + /// Initializes a new instance of DataFactorySecretString. + internal DataFactorySecretString() + { + } /// Initializes a new instance of DataFactorySecretString. /// Value of secure string. /// is null. diff --git a/sdk/core/Azure.Core.Expressions.DataFactory/src/UnknownSecret.cs b/sdk/core/Azure.Core.Expressions.DataFactory/src/UnknownSecret.cs index e1fdbc3580ca..a426b08f4721 100644 --- a/sdk/core/Azure.Core.Expressions.DataFactory/src/UnknownSecret.cs +++ b/sdk/core/Azure.Core.Expressions.DataFactory/src/UnknownSecret.cs @@ -6,6 +6,10 @@ namespace Azure.Core.Expressions.DataFactory /// The UnknownSecretBase. internal partial class UnknownSecret : DataFactorySecret { + /// Initializes a new instance of UnknownSecret. + internal UnknownSecret() + { + } /// Initializes a new instance of UnknownSecretBase. /// Type of the secret. internal UnknownSecret(string? secretBaseType) : base(secretBaseType) diff --git a/sdk/core/Azure.Core.Expressions.DataFactory/tests/IJsonModelImplementationTests.cs b/sdk/core/Azure.Core.Expressions.DataFactory/tests/IJsonModelImplementationTests.cs new file mode 100644 index 000000000000..0a4a4ca40fed --- /dev/null +++ b/sdk/core/Azure.Core.Expressions.DataFactory/tests/IJsonModelImplementationTests.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using NUnit.Framework; + +namespace Azure.Core.Expressions.DataFactory.Tests +{ + public class IJsonModelImplementationTests + { + [Test] + public void DataFactoryKeyVaultSecret_ImplementsIJsonModel() + { + // Arrange + var store = new DataFactoryLinkedServiceReference(DataFactoryLinkedServiceReferenceKind.LinkedServiceReference, "testLinkedService"); + var secretName = DataFactoryElement.FromLiteral("testSecret"); + var keyVaultSecret = new DataFactoryKeyVaultSecret(store, secretName); + + // Act & Assert - Test IJsonModel interface + Assert.IsInstanceOf>(keyVaultSecret); + Assert.IsInstanceOf>(keyVaultSecret); + + // Test serialization + var options = new ModelReaderWriterOptions("W"); + var binaryData = ((IPersistableModel)keyVaultSecret).Write(options); + Assert.IsNotNull(binaryData); + + // Test deserialization + var deserializedSecret = ModelReaderWriter.Read(binaryData, options); + Assert.IsNotNull(deserializedSecret); + Assert.AreEqual(keyVaultSecret.Store.ReferenceName, deserializedSecret.Store.ReferenceName); + } + + [Test] + public void DataFactoryLinkedServiceReference_ImplementsIJsonModel() + { + // Arrange + var linkedServiceRef = new DataFactoryLinkedServiceReference(DataFactoryLinkedServiceReferenceKind.LinkedServiceReference, "testLinkedService"); + + // Act & Assert - Test IJsonModel interface + Assert.IsInstanceOf>(linkedServiceRef); + Assert.IsInstanceOf>(linkedServiceRef); + + // Test serialization + var options = new ModelReaderWriterOptions("W"); + var binaryData = ((IPersistableModel)linkedServiceRef).Write(options); + Assert.IsNotNull(binaryData); + + // Test deserialization + var deserializedRef = ModelReaderWriter.Read(binaryData, options); + Assert.IsNotNull(deserializedRef); + Assert.AreEqual(linkedServiceRef.ReferenceName, deserializedRef.ReferenceName); + Assert.AreEqual(linkedServiceRef.ReferenceKind, deserializedRef.ReferenceKind); + } + + [Test] + public void DataFactorySecretString_ImplementsIJsonModel() + { + // Arrange + var secretString = new DataFactorySecretString("testSecret"); + + // Act & Assert - Test IJsonModel interface + Assert.IsInstanceOf>(secretString); + Assert.IsInstanceOf>(secretString); + + // Test serialization + var options = new ModelReaderWriterOptions("W"); + var binaryData = ((IPersistableModel)secretString).Write(options); + Assert.IsNotNull(binaryData); + + // Test deserialization + var deserializedSecret = ModelReaderWriter.Read(binaryData, options); + Assert.IsNotNull(deserializedSecret); + Assert.AreEqual(secretString.Value, deserializedSecret.Value); + } + + [Test] + public void DataFactorySecret_ImplementsIJsonModel() + { + // Arrange + DataFactorySecret secret = new DataFactorySecretString("testSecret"); + + // Act & Assert - Test IJsonModel interface + Assert.IsInstanceOf>(secret); + Assert.IsInstanceOf>(secret); + + // Test serialization + var options = new ModelReaderWriterOptions("W"); + var binaryData = ((IPersistableModel)secret).Write(options); + Assert.IsNotNull(binaryData); + + // Test deserialization + var deserializedSecret = ModelReaderWriter.Read(binaryData, options); + Assert.IsNotNull(deserializedSecret); + Assert.IsInstanceOf(deserializedSecret); + Assert.AreEqual(((DataFactorySecretString)secret).Value, ((DataFactorySecretString)deserializedSecret).Value); + } + + [Test] + public void IJsonModel_Write_Method_Works() + { + // Arrange + var secretString = new DataFactorySecretString("testSecret"); + var options = new ModelReaderWriterOptions("W"); + + // Act + using var stream = new System.IO.MemoryStream(); + using var writer = new Utf8JsonWriter(stream); + + ((IJsonModel)secretString).Write(writer, options); + writer.Flush(); + + // Assert + stream.Position = 0; + using var document = JsonDocument.Parse(stream); + var root = document.RootElement; + + Assert.IsTrue(root.TryGetProperty("value", out var valueProperty)); + Assert.AreEqual("testSecret", valueProperty.GetString()); + Assert.IsTrue(root.TryGetProperty("type", out var typeProperty)); + Assert.AreEqual("SecureString", typeProperty.GetString()); + } + + [Test] + public void IJsonModel_Create_Method_Works() + { + // Arrange + var json = """{"value":"testSecret","type":"SecureString"}"""; + var options = new ModelReaderWriterOptions("W"); + + var jsonBytes = System.Text.Encoding.UTF8.GetBytes(json); + var reader = new Utf8JsonReader(jsonBytes); + + // Act + var secretString = ((IJsonModel)new DataFactorySecretString("dummy")).Create(ref reader, options); + + // Assert + Assert.IsNotNull(secretString); + Assert.AreEqual("testSecret", secretString.Value); + } + + [Test] + public void GetFormatFromOptions_ReturnsJsonFormat() + { + // Arrange + var secretString = new DataFactorySecretString("testSecret"); + var options = new ModelReaderWriterOptions("W"); + + // Act + var format = ((IPersistableModel)secretString).GetFormatFromOptions(options); + + // Assert + Assert.AreEqual("J", format); + } + + [Test] + public void IJsonModel_ThrowsFormatException_ForUnsupportedFormat() + { + // Arrange + var secretString = new DataFactorySecretString("testSecret"); + var options = new ModelReaderWriterOptions("X"); // Unsupported format + + // Act & Assert + Assert.Throws(() => + ((IPersistableModel)secretString).Write(options)); + } + } +} \ No newline at end of file diff --git a/sdk/core/Azure.Core.Expressions.DataFactory/tests/compatibility/ExpectedAotWarnings.txt b/sdk/core/Azure.Core.Expressions.DataFactory/tests/compatibility/ExpectedAotWarnings.txt new file mode 100644 index 000000000000..a6dcab3af951 --- /dev/null +++ b/sdk/core/Azure.Core.Expressions.DataFactory/tests/compatibility/ExpectedAotWarnings.txt @@ -0,0 +1,16 @@ +.*Azure\.Core\.Expressions\.DataFactory.src.DataFactoryElement\.Serialization\.cs\(\d*\): Trim analysis warning IL2026: Azure\.Core\.Expressions\.DataFactory\.DataFactoryElement`1\.GetGenericSerializationMethod\(Type,String\): Using member 'System\.Text\.Json\.Serialization\.JsonConverter\.ConfigureJsonTypeInfoUsingReflection\(JsonTypeInfo,JsonSerializerOptions\)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code\. JSON serialization and deserialization might require types that cannot be statically analyzed\. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved\. +.*Azure\.Core\.Expressions\.DataFactory.src.DataFactoryElement\.Serialization\.cs\(\d*\): AOT analysis warning IL3050: Azure\.Core\.Expressions\.DataFactory\.DataFactoryElement`1\.GetGenericSerializationMethod\(Type,String\): Using member 'System\.Text\.Json\.Serialization\.JsonConverter\.ConfigureJsonTypeInfoUsingReflection\(JsonTypeInfo,JsonSerializerOptions\)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling\. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation\. Use System\.Text\.Json source generation for native AOT applications\. +.*Azure\.Core\.Expressions\.DataFactory.src.DataFactoryElement\.Serialization\.cs\(\d*\): AOT analysis warning IL3050: Azure\.Core\.Expressions\.DataFactory\.DataFactoryElement`1\.GetGenericSerializationMethod\(Type,String\): Using member 'System\.Reflection\.MethodInfo\.MakeGenericMethod\(Type\[\]\)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling\. The native code for this instantiation might not be available at runtime\. +.*Azure\.Core\.Expressions\.DataFactory.src.DataFactoryElement\.Serialization\.cs\(\d*\): Trim analysis warning IL2060: Azure\.Core\.Expressions\.DataFactory\.DataFactoryElement`1\.GetGenericSerializationMethod\(Type,String\): Call to 'System\.Reflection\.MethodInfo\.MakeGenericMethod\(Type\[\]\)' can not be statically analyzed\. It's not possible to guarantee the availability of requirements of the generic method\. +.*Azure\.Core\.Expressions\.DataFactory.src.DataFactoryElementJsonConverter\.cs\(\d*\): Trim analysis warning IL2026: Azure\.Core\.Expressions\.DataFactory\.DataFactoryElementJsonConverter\.GetGenericSerializationMethod\(Type,String\): Using member 'System\.Text\.Json\.Serialization\.JsonConverter\.ConfigureJsonTypeInfoUsingReflection\(JsonTypeInfo,JsonSerializerOptions\)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code\. JSON serialization and deserialization might require types that cannot be statically analyzed\. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved\. +.*Azure\.Core\.Expressions\.DataFactory.src.DataFactoryElementJsonConverter\.cs\(\d*\): AOT analysis warning IL3050: Azure\.Core\.Expressions\.DataFactory\.DataFactoryElementJsonConverter\.GetGenericSerializationMethod\(Type,String\): Using member 'System\.Text\.Json\.Serialization\.JsonConverter\.ConfigureJsonTypeInfoUsingReflection\(JsonTypeInfo,JsonSerializerOptions\)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling\. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation\. Use System\.Text\.Json source generation for native AOT applications\. +.*Azure\.Core\.Expressions\.DataFactory.src.DataFactoryElementJsonConverter\.cs\(\d*\): AOT analysis warning IL3050: Azure\.Core\.Expressions\.DataFactory\.DataFactoryElementJsonConverter\.GetGenericSerializationMethod\(Type,String\): Using member 'System\.Reflection\.MethodInfo\.MakeGenericMethod\(Type\[\]\)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling\. The native code for this instantiation might not be available at runtime\. +.*Azure\.Core\.Expressions\.DataFactory.src.DataFactoryElementJsonConverter\.cs\(\d*\): Trim analysis warning IL2060: Azure\.Core\.Expressions\.DataFactory\.DataFactoryElementJsonConverter\.GetGenericSerializationMethod\(Type,String\): Call to 'System\.Reflection\.MethodInfo\.MakeGenericMethod\(Type\[\]\)' can not be statically analyzed\. It's not possible to guarantee the availability of requirements of the generic method\. +.*Azure\.Core\.Expressions\.DataFactory.src.DataFactoryElementJsonConverter\.cs\(\d*\): Trim analysis warning IL2026: Azure\.Core\.Expressions\.DataFactory\.DataFactoryElementJsonConverter\.SerializeGenericList.*\(Utf8JsonWriter,DataFactoryElement`1.*\): Using member 'System\.Text\.Json\.JsonSerializer\.Serialize.*\(Utf8JsonWriter,T,JsonSerializerOptions\)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code\. JSON serialization and deserialization might require types that cannot be statically analyzed\. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved\. +.*Azure\.Core\.Expressions\.DataFactory.src.DataFactoryElementJsonConverter\.cs\(\d*\): AOT analysis warning IL3050: Azure\.Core\.Expressions\.DataFactory\.DataFactoryElementJsonConverter\.SerializeGenericList.*\(Utf8JsonWriter,DataFactoryElement`1.*\): Using member 'System\.Text\.Json\.JsonSerializer\.Serialize.*\(Utf8JsonWriter,T,JsonSerializerOptions\)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling\. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation\. Use System\.Text\.Json source generation for native AOT applications\. +.*Azure\.Core\.Expressions\.DataFactory.src.DataFactoryElementJsonConverter\.cs\(\d*\): Trim analysis warning IL2026: Azure\.Core\.Expressions\.DataFactory\.DataFactoryElementJsonConverter\.DeserializeGenericList\(JsonElement\): Using member 'System\.Text\.Json\.JsonSerializer\.Deserialize\(String,JsonSerializerOptions\)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code\. JSON serialization and deserialization might require types that cannot be statically analyzed\. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved\. +.*Azure\.Core\.Expressions\.DataFactory.src.DataFactoryElementJsonConverter\.cs\(\d*\): AOT analysis warning IL3050: Azure\.Core\.Expressions\.DataFactory\.DataFactoryElementJsonConverter\.DeserializeGenericList\(JsonElement\): Using member 'System\.Text\.Json\.JsonSerializer\.Deserialize\(String,JsonSerializerOptions\)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling\. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation\. Use System\.Text\.Json source generation for native AOT applications\. +.*Azure\.Core\.Expressions\.DataFactory.src.DataFactoryKeyVaultSecret\.Serialization\.cs\(\d*\): Trim analysis warning IL2026: Azure\.Core\.Expressions\.DataFactory\.DataFactoryKeyVaultSecret\.DeserializeAzureKeyVaultSecretReference\(JsonElement\): Using member 'System\.Text\.Json\.JsonSerializer\.Deserialize.*>\(String,JsonSerializerOptions\)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code\. JSON serialization and deserialization might require types that cannot be statically analyzed\. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved\. +.*Azure\.Core\.Expressions\.DataFactory.src.DataFactoryKeyVaultSecret\.Serialization\.cs\(\d*\): AOT analysis warning IL3050: Azure\.Core\.Expressions\.DataFactory\.DataFactoryKeyVaultSecret\.DeserializeAzureKeyVaultSecretReference\(JsonElement\): Using member 'System\.Text\.Json\.JsonSerializer\.Deserialize.*>\(String,JsonSerializerOptions\)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling\. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation\. Use System\.Text\.Json source generation for native AOT applications\. +.*Azure\.Core\.Expressions\.DataFactory.src.DataFactoryKeyVaultSecret\.Serialization\.cs\(\d*\): Trim analysis warning IL2026: Azure\.Core\.Expressions\.DataFactory\.DataFactoryKeyVaultSecret\.DeserializeAzureKeyVaultSecretReference\(JsonElement\): Using member 'System\.Text\.Json\.JsonSerializer\.Deserialize`1>\(String,JsonSerializerOptions\)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code\. JSON serialization and deserialization might require types that cannot be statically analyzed\. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved\. +.*Azure\.Core\.Expressions\.DataFactory.src.DataFactoryKeyVaultSecret\.Serialization\.cs\(\d*\): AOT analysis warning IL3050: Azure\.Core\.Expressions\.DataFactory\.DataFactoryKeyVaultSecret\.DeserializeAzureKeyVaultSecretReference\(JsonElement\): Using member 'System\.Text\.Json\.JsonSerializer\.Deserialize>\(String,JsonSerializerOptions\)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling\. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation\. Use System\.Text\.Json source generation for native AOT applications\. \ No newline at end of file diff --git a/sdk/core/ci.yml b/sdk/core/ci.yml index ed41e4b14428..e8a8d2a57287 100644 --- a/sdk/core/ci.yml +++ b/sdk/core/ci.yml @@ -70,6 +70,8 @@ extends: AOTTestInputs: - ArtifactName: Azure.Core ExpectedWarningsFilepath: /Azure.Core/tests/compatibility/ExpectedAotWarnings.txt + - ArtifactName: Azure.Core.Expressions.DataFactory + ExpectedWarningsFilepath: /Azure.Core.Expressions.DataFactory/tests/compatibility/ExpectedAotWarnings.txt - ArtifactName: System.ClientModel ExpectedWarningsFilepath: None