diff --git a/sdk/translation/Azure.AI.Translation.Document/CHANGELOG.md b/sdk/translation/Azure.AI.Translation.Document/CHANGELOG.md index cfecdd4e791b7..65463f191b7a8 100644 --- a/sdk/translation/Azure.AI.Translation.Document/CHANGELOG.md +++ b/sdk/translation/Azure.AI.Translation.Document/CHANGELOG.md @@ -3,6 +3,8 @@ ### Features Added +- Exposed `JsonModelWriteCore` for model serialization procedure. + ### Breaking Changes ### Bugs Fixed diff --git a/sdk/translation/Azure.AI.Translation.Document/api/Azure.AI.Translation.Document.netstandard2.0.cs b/sdk/translation/Azure.AI.Translation.Document/api/Azure.AI.Translation.Document.netstandard2.0.cs index 664582e23538a..0487c1e06f9f0 100644 --- a/sdk/translation/Azure.AI.Translation.Document/api/Azure.AI.Translation.Document.netstandard2.0.cs +++ b/sdk/translation/Azure.AI.Translation.Document/api/Azure.AI.Translation.Document.netstandard2.0.cs @@ -23,6 +23,7 @@ internal DocumentStatusResult() { } public System.Uri TranslatedDocumentUri { get { throw null; } } public string TranslatedToLanguageCode { get { throw null; } } public float TranslationProgressPercentage { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Translation.Document.DocumentStatusResult 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.AI.Translation.Document.DocumentStatusResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -35,8 +36,9 @@ public DocumentTranslateContent(Azure.AI.Translation.Document.MultipartFormFileD public DocumentTranslateContent(Azure.AI.Translation.Document.MultipartFormFileData document, System.Collections.Generic.IList glossaries) { } public Azure.AI.Translation.Document.MultipartFormFileData MultipartDocument { get { throw null; } } public System.Collections.Generic.IList MultipartGlossary { get { throw null; } } - void global::System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Translation.Document.DocumentTranslateContent 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.AI.Translation.Document.DocumentTranslateContent 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; } @@ -122,6 +124,7 @@ internal DocumentTranslationFileFormat() { } public string Format { get { throw null; } } public System.Collections.Generic.IReadOnlyList FormatVersions { get { throw null; } } public string Type { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Translation.Document.DocumentTranslationFileFormat 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.AI.Translation.Document.DocumentTranslationFileFormat System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -136,6 +139,7 @@ public DocumentTranslationInput(System.Uri sourceUri, System.Uri targetUri, stri public Azure.AI.Translation.Document.StorageInputUriKind? StorageUriKind { get { throw null; } set { } } public System.Collections.Generic.IList Targets { get { throw null; } } public void AddTarget(System.Uri targetUri, string languageCode, Azure.AI.Translation.Document.TranslationGlossary glossary = null, string categoryId = null) { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Translation.Document.DocumentTranslationInput 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.AI.Translation.Document.DocumentTranslationInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -271,6 +275,7 @@ public partial class StartTranslationDetails : System.ClientModel.Primitives.IJs { public StartTranslationDetails(System.Collections.Generic.IEnumerable inputs) { } public System.Collections.Generic.IList Inputs { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Translation.Document.StartTranslationDetails 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.AI.Translation.Document.StartTranslationDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -286,6 +291,7 @@ public partial class SupportedFileFormats : System.ClientModel.Primitives.IJsonM { internal SupportedFileFormats() { } public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Translation.Document.SupportedFileFormats 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.AI.Translation.Document.SupportedFileFormats System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -308,6 +314,7 @@ public TranslationGlossary(System.Uri glossaryUri, string format) { } public string Format { get { throw null; } } public string FormatVersion { get { throw null; } set { } } public System.Uri GlossaryUri { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Translation.Document.TranslationGlossary 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.AI.Translation.Document.TranslationGlossary System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -322,6 +329,7 @@ public TranslationSource(System.Uri sourceUri, string languageCode = null, strin public string Prefix { get { throw null; } set { } } public System.Uri SourceUri { get { throw null; } } public string Suffix { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Translation.Document.TranslationSource 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.AI.Translation.Document.TranslationSource System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -343,6 +351,7 @@ internal TranslationStatusResult() { } public System.DateTimeOffset LastModified { get { throw null; } } public Azure.AI.Translation.Document.DocumentTranslationStatus Status { get { throw null; } } public long TotalCharactersCharged { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Translation.Document.TranslationStatusResult 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.AI.Translation.Document.TranslationStatusResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -356,6 +365,7 @@ public TranslationTarget(System.Uri targetUri, string languageCode) { } public System.Collections.Generic.IList Glossaries { get { throw null; } } public string LanguageCode { get { throw null; } } public System.Uri TargetUri { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Translation.Document.TranslationTarget 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.AI.Translation.Document.TranslationTarget System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } diff --git a/sdk/translation/Azure.AI.Translation.Document/src/DocumentTranslateContent.Serialization.cs b/sdk/translation/Azure.AI.Translation.Document/src/DocumentTranslateContent.Serialization.cs index c66c5bc33f89d..3a165a3a57f8b 100644 --- a/sdk/translation/Azure.AI.Translation.Document/src/DocumentTranslateContent.Serialization.cs +++ b/sdk/translation/Azure.AI.Translation.Document/src/DocumentTranslateContent.Serialization.cs @@ -27,15 +27,15 @@ internal virtual MultipartFormDataRequestContent ToMultipartRequestContent() return content; } - void global::System.ClientModel.Primitives.IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(DocumentTranslateContent)} does not support writing '{format}' format."); } - - writer.WriteStartObject(); writer.WritePropertyName("document"u8); #if NET6_0_OR_GREATER writer.WriteRawValue(global::System.BinaryData.FromStream(Document)); @@ -82,7 +82,6 @@ internal virtual MultipartFormDataRequestContent ToMultipartRequestContent() #endif } } - writer.WriteEndObject(); } internal static DocumentTranslateContent DeserializeDocumentTranslateContent(JsonElement element, ModelReaderWriterOptions options = null) diff --git a/sdk/translation/Azure.AI.Translation.Document/src/Generated/DocumentFilter.Serialization.cs b/sdk/translation/Azure.AI.Translation.Document/src/Generated/DocumentFilter.Serialization.cs index 6cf63ba4fa904..ec48a6cb110ae 100644 --- a/sdk/translation/Azure.AI.Translation.Document/src/Generated/DocumentFilter.Serialization.cs +++ b/sdk/translation/Azure.AI.Translation.Document/src/Generated/DocumentFilter.Serialization.cs @@ -18,6 +18,15 @@ internal partial class DocumentFilter : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOp throw new FormatException($"The model {nameof(DocumentFilter)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(Prefix)) { writer.WritePropertyName("prefix"u8); @@ -51,7 +59,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOp #endif } } - writer.WriteEndObject(); } DocumentFilter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/translation/Azure.AI.Translation.Document/src/Generated/DocumentStatusResult.Serialization.cs b/sdk/translation/Azure.AI.Translation.Document/src/Generated/DocumentStatusResult.Serialization.cs index b86f5dd40c523..4dc36aa9d1417 100644 --- a/sdk/translation/Azure.AI.Translation.Document/src/Generated/DocumentStatusResult.Serialization.cs +++ b/sdk/translation/Azure.AI.Translation.Document/src/Generated/DocumentStatusResult.Serialization.cs @@ -18,6 +18,15 @@ public partial class DocumentStatusResult : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr throw new FormatException($"The model {nameof(DocumentStatusResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(TranslatedDocumentUri)) { writer.WritePropertyName("path"u8); @@ -67,7 +75,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr #endif } } - writer.WriteEndObject(); } DocumentStatusResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/translation/Azure.AI.Translation.Document/src/Generated/DocumentTranslateContent.Serialization.cs b/sdk/translation/Azure.AI.Translation.Document/src/Generated/DocumentTranslateContent.Serialization.cs index b0d980dda6307..c8e344cf84ee0 100644 --- a/sdk/translation/Azure.AI.Translation.Document/src/Generated/DocumentTranslateContent.Serialization.cs +++ b/sdk/translation/Azure.AI.Translation.Document/src/Generated/DocumentTranslateContent.Serialization.cs @@ -17,6 +17,13 @@ public partial class DocumentTranslateContent : IUtf8JsonSerializable, IJsonMode { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + DocumentTranslateContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; diff --git a/sdk/translation/Azure.AI.Translation.Document/src/Generated/DocumentTranslationFileFormat.Serialization.cs b/sdk/translation/Azure.AI.Translation.Document/src/Generated/DocumentTranslationFileFormat.Serialization.cs index 0a0f6a63ad3cc..848738e63eb44 100644 --- a/sdk/translation/Azure.AI.Translation.Document/src/Generated/DocumentTranslationFileFormat.Serialization.cs +++ b/sdk/translation/Azure.AI.Translation.Document/src/Generated/DocumentTranslationFileFormat.Serialization.cs @@ -18,6 +18,15 @@ public partial class DocumentTranslationFileFormat : IUtf8JsonSerializable, IJso void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode throw new FormatException($"The model {nameof(DocumentTranslationFileFormat)} does not support writing '{format}' format."); } - writer.WriteStartObject(); writer.WritePropertyName("format"u8); writer.WriteStringValue(Format); writer.WritePropertyName("fileExtensions"u8); @@ -77,7 +85,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode #endif } } - writer.WriteEndObject(); } DocumentTranslationFileFormat IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/translation/Azure.AI.Translation.Document/src/Generated/DocumentTranslationInput.Serialization.cs b/sdk/translation/Azure.AI.Translation.Document/src/Generated/DocumentTranslationInput.Serialization.cs index 6b2a34493ea93..760b68da84c36 100644 --- a/sdk/translation/Azure.AI.Translation.Document/src/Generated/DocumentTranslationInput.Serialization.cs +++ b/sdk/translation/Azure.AI.Translation.Document/src/Generated/DocumentTranslationInput.Serialization.cs @@ -18,6 +18,15 @@ public partial class DocumentTranslationInput : IUtf8JsonSerializable, IJsonMode void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead throw new FormatException($"The model {nameof(DocumentTranslationInput)} does not support writing '{format}' format."); } - writer.WriteStartObject(); writer.WritePropertyName("source"u8); writer.WriteObjectValue(Source, options); writer.WritePropertyName("targets"u8); @@ -55,7 +63,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead #endif } } - writer.WriteEndObject(); } DocumentTranslationInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/translation/Azure.AI.Translation.Document/src/Generated/StartTranslationDetails.Serialization.cs b/sdk/translation/Azure.AI.Translation.Document/src/Generated/StartTranslationDetails.Serialization.cs index 0e0cde37b6ce1..d6c773d5ed7ad 100644 --- a/sdk/translation/Azure.AI.Translation.Document/src/Generated/StartTranslationDetails.Serialization.cs +++ b/sdk/translation/Azure.AI.Translation.Document/src/Generated/StartTranslationDetails.Serialization.cs @@ -18,6 +18,15 @@ public partial class StartTranslationDetails : IUtf8JsonSerializable, IJsonModel void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade throw new FormatException($"The model {nameof(StartTranslationDetails)} does not support writing '{format}' format."); } - writer.WriteStartObject(); writer.WritePropertyName("inputs"u8); writer.WriteStartArray(); foreach (var item in Inputs) @@ -48,7 +56,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade #endif } } - writer.WriteEndObject(); } StartTranslationDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/translation/Azure.AI.Translation.Document/src/Generated/StatusSummary.Serialization.cs b/sdk/translation/Azure.AI.Translation.Document/src/Generated/StatusSummary.Serialization.cs index c5d7cb49178e3..67a7dddfaaf2a 100644 --- a/sdk/translation/Azure.AI.Translation.Document/src/Generated/StatusSummary.Serialization.cs +++ b/sdk/translation/Azure.AI.Translation.Document/src/Generated/StatusSummary.Serialization.cs @@ -18,6 +18,15 @@ internal partial class StatusSummary : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpt throw new FormatException($"The model {nameof(StatusSummary)} does not support writing '{format}' format."); } - writer.WriteStartObject(); writer.WritePropertyName("total"u8); writer.WriteNumberValue(Total); writer.WritePropertyName("failed"u8); @@ -55,7 +63,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpt #endif } } - writer.WriteEndObject(); } StatusSummary IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/translation/Azure.AI.Translation.Document/src/Generated/SupportedFileFormats.Serialization.cs b/sdk/translation/Azure.AI.Translation.Document/src/Generated/SupportedFileFormats.Serialization.cs index 29840a486129a..325560f8e7d95 100644 --- a/sdk/translation/Azure.AI.Translation.Document/src/Generated/SupportedFileFormats.Serialization.cs +++ b/sdk/translation/Azure.AI.Translation.Document/src/Generated/SupportedFileFormats.Serialization.cs @@ -18,6 +18,15 @@ public partial class SupportedFileFormats : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr throw new FormatException($"The model {nameof(SupportedFileFormats)} does not support writing '{format}' format."); } - writer.WriteStartObject(); writer.WritePropertyName("value"u8); writer.WriteStartArray(); foreach (var item in Value) @@ -48,7 +56,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr #endif } } - writer.WriteEndObject(); } SupportedFileFormats IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/translation/Azure.AI.Translation.Document/src/Generated/TranslationGlossary.Serialization.cs b/sdk/translation/Azure.AI.Translation.Document/src/Generated/TranslationGlossary.Serialization.cs index 0279b4b263944..791aa60020f38 100644 --- a/sdk/translation/Azure.AI.Translation.Document/src/Generated/TranslationGlossary.Serialization.cs +++ b/sdk/translation/Azure.AI.Translation.Document/src/Generated/TranslationGlossary.Serialization.cs @@ -18,6 +18,15 @@ public partial class TranslationGlossary : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri throw new FormatException($"The model {nameof(TranslationGlossary)} does not support writing '{format}' format."); } - writer.WriteStartObject(); writer.WritePropertyName("glossaryUrl"u8); writer.WriteStringValue(GlossaryUri.AbsoluteUri); writer.WritePropertyName("format"u8); @@ -55,7 +63,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri #endif } } - writer.WriteEndObject(); } TranslationGlossary IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/translation/Azure.AI.Translation.Document/src/Generated/TranslationSource.Serialization.cs b/sdk/translation/Azure.AI.Translation.Document/src/Generated/TranslationSource.Serialization.cs index 3f5b579942d45..71dda577ef040 100644 --- a/sdk/translation/Azure.AI.Translation.Document/src/Generated/TranslationSource.Serialization.cs +++ b/sdk/translation/Azure.AI.Translation.Document/src/Generated/TranslationSource.Serialization.cs @@ -18,6 +18,15 @@ public partial class TranslationSource : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite throw new FormatException($"The model {nameof(TranslationSource)} does not support writing '{format}' format."); } - writer.WriteStartObject(); writer.WritePropertyName("sourceUrl"u8); writer.WriteStringValue(SourceUri.AbsoluteUri); if (Optional.IsDefined(Filter)) @@ -58,7 +66,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite #endif } } - writer.WriteEndObject(); } TranslationSource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/translation/Azure.AI.Translation.Document/src/Generated/TranslationStatusResult.Serialization.cs b/sdk/translation/Azure.AI.Translation.Document/src/Generated/TranslationStatusResult.Serialization.cs index c61c6f4e11826..8dd2d5c95956d 100644 --- a/sdk/translation/Azure.AI.Translation.Document/src/Generated/TranslationStatusResult.Serialization.cs +++ b/sdk/translation/Azure.AI.Translation.Document/src/Generated/TranslationStatusResult.Serialization.cs @@ -18,6 +18,15 @@ public partial class TranslationStatusResult : IUtf8JsonSerializable, IJsonModel void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade throw new FormatException($"The model {nameof(TranslationStatusResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); writer.WritePropertyName("createdDateTimeUtc"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade #endif } } - writer.WriteEndObject(); } TranslationStatusResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/translation/Azure.AI.Translation.Document/src/Generated/TranslationTarget.Serialization.cs b/sdk/translation/Azure.AI.Translation.Document/src/Generated/TranslationTarget.Serialization.cs index 1ef904d5793d0..b46ede0132b4a 100644 --- a/sdk/translation/Azure.AI.Translation.Document/src/Generated/TranslationTarget.Serialization.cs +++ b/sdk/translation/Azure.AI.Translation.Document/src/Generated/TranslationTarget.Serialization.cs @@ -18,6 +18,15 @@ public partial class TranslationTarget : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite throw new FormatException($"The model {nameof(TranslationTarget)} does not support writing '{format}' format."); } - writer.WriteStartObject(); writer.WritePropertyName("targetUrl"u8); writer.WriteStringValue(TargetUri.AbsoluteUri); if (Optional.IsDefined(CategoryId)) @@ -65,7 +73,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite #endif } } - writer.WriteEndObject(); } TranslationTarget IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/translation/Azure.AI.Translation.Document/tsp-location.yaml b/sdk/translation/Azure.AI.Translation.Document/tsp-location.yaml index 7690921cc02fb..e1850c1d74911 100644 --- a/sdk/translation/Azure.AI.Translation.Document/tsp-location.yaml +++ b/sdk/translation/Azure.AI.Translation.Document/tsp-location.yaml @@ -1,3 +1,3 @@ directory: specification/translation/Azure.AI.DocumentTranslation -commit: 4bf64653380a8582fa070b62ae46b86f2455932e +commit: 80c8a6361fa365cae7072bcb3fabbbcf93fdc4ae repo: Azure/azure-rest-api-specs