diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/CHANGELOG.md b/sdk/formrecognizer/Azure.AI.FormRecognizer/CHANGELOG.md index aa7c94dea339..fcf809fb9539 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/CHANGELOG.md +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/CHANGELOG.md @@ -10,6 +10,8 @@ By default the SDK targets latest supported service version. ### Breaking changes - Renamed `Id` for `Identity` in all the `StartRecognizeIdDocuments` functionalities. For example, the name of the method is now `StartRecognizeIdentityDocuments`. - Renamed the model `ReadingOrder` to `FormReadingOrder`. +- The model `TextAppearance` now includes the properties `StyleName` and `StyleConfidence` that were part of the `TextStyle` object. +- Removed the model `TextStyle`. ## 3.0.1 (2021-04-09) diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/api/Azure.AI.FormRecognizer.netstandard2.0.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/api/Azure.AI.FormRecognizer.netstandard2.0.cs index 95ce048a10a9..fe948dfc0403 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/api/Azure.AI.FormRecognizer.netstandard2.0.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/api/Azure.AI.FormRecognizer.netstandard2.0.cs @@ -399,8 +399,7 @@ public static partial class FormRecognizerModelFactory public static Azure.AI.FormRecognizer.Models.RecognizedForm RecognizedForm(string formType, Azure.AI.FormRecognizer.Models.FormPageRange pageRange, System.Collections.Generic.IReadOnlyDictionary fields, System.Collections.Generic.IReadOnlyList pages) { throw null; } public static Azure.AI.FormRecognizer.Models.RecognizedForm RecognizedForm(string formType, Azure.AI.FormRecognizer.Models.FormPageRange pageRange, System.Collections.Generic.IReadOnlyDictionary fields, System.Collections.Generic.IReadOnlyList pages, string modelId, float? formTypeConfidence) { throw null; } public static Azure.AI.FormRecognizer.Models.RecognizedFormCollection RecognizedFormCollection(System.Collections.Generic.IList list) { throw null; } - public static Azure.AI.FormRecognizer.Models.TextAppearance TextAppearance(Azure.AI.FormRecognizer.Models.TextStyle style) { throw null; } - public static Azure.AI.FormRecognizer.Models.TextStyle TextStyle(Azure.AI.FormRecognizer.Models.TextStyleName name, float confidence) { throw null; } + public static Azure.AI.FormRecognizer.Models.TextAppearance TextAppearance(Azure.AI.FormRecognizer.Models.TextStyleName styleName, float styleConfidence) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static Azure.AI.FormRecognizer.Training.TrainingDocumentInfo TrainingDocumentInfo(string name, int pageCount, System.Collections.Generic.IEnumerable errors, Azure.AI.FormRecognizer.Training.TrainingStatus status) { throw null; } public static Azure.AI.FormRecognizer.Training.TrainingDocumentInfo TrainingDocumentInfo(string name, int pageCount, System.Collections.Generic.IEnumerable errors, Azure.AI.FormRecognizer.Training.TrainingStatus status, string modelId) { throw null; } @@ -548,13 +547,8 @@ public enum SelectionMarkState public partial class TextAppearance { internal TextAppearance() { } - public Azure.AI.FormRecognizer.Models.TextStyle Style { get { throw null; } } - } - public partial class TextStyle - { - internal TextStyle() { } - public float Confidence { get { throw null; } } - public Azure.AI.FormRecognizer.Models.TextStyleName Name { get { throw null; } } + public float StyleConfidence { get { throw null; } } + public Azure.AI.FormRecognizer.Models.TextStyleName StyleName { get { throw null; } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct TextStyleName : System.IEquatable diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormRecognizerModelFactory.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormRecognizerModelFactory.cs index f9fd26ba335f..9f584e9f3814 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormRecognizerModelFactory.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormRecognizerModelFactory.cs @@ -478,19 +478,11 @@ public static RecognizedFormCollection RecognizedFormCollection(IList /// Initializes a new instance of the class. /// - /// An object representing the style of the text line. + /// The text line style name. + /// Measures the degree of certainty of the recognition result. /// A new instance for mocking. - public static TextAppearance TextAppearance(TextStyle style) => - style == null ? new TextAppearance() : new TextAppearance(style); - - /// - /// Initializes a new instance of the class. - /// - /// The text line style name. - /// Measures the degree of certainty of the recognition result. - /// A new instance for mocking. - public static TextStyle TextStyle(TextStyleName name, float confidence) => - new TextStyle(name, confidence); + public static TextAppearance TextAppearance(TextStyleName styleName, float styleConfidence) => + new TextAppearance(styleName, styleConfidence); /// /// Initializes a new instance of the class. diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/TextStyle.Serialization.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/Style.Serialization.cs similarity index 83% rename from sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/TextStyle.Serialization.cs rename to sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/Style.Serialization.cs index e60800c356b7..159c79c20312 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/TextStyle.Serialization.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/Style.Serialization.cs @@ -10,9 +10,9 @@ namespace Azure.AI.FormRecognizer.Models { - public partial class TextStyle + internal partial class Style { - internal static TextStyle DeserializeTextStyle(JsonElement element) + internal static Style DeserializeStyle(JsonElement element) { TextStyleName name = default; float confidence = default; @@ -29,7 +29,7 @@ internal static TextStyle DeserializeTextStyle(JsonElement element) continue; } } - return new TextStyle(name, confidence); + return new Style(name, confidence); } } } diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/TextStyle.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/Style.cs similarity index 81% rename from sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/TextStyle.cs rename to sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/Style.cs index 3f1cf4cb6e8f..d0bf39aaecc9 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/TextStyle.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/Style.cs @@ -8,12 +8,12 @@ namespace Azure.AI.FormRecognizer.Models { /// An object representing the style of the text line. - public partial class TextStyle + internal partial class Style { - /// Initializes a new instance of TextStyle. + /// Initializes a new instance of Style. /// The text line style name, including handwriting and other. /// The confidence of text line style. - internal TextStyle(TextStyleName name, float confidence) + internal Style(TextStyleName name, float confidence) { Name = name; Confidence = confidence; diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/TextAppearance.Serialization.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/TextAppearance.Serialization.cs index cced7b074593..2af1452be723 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/TextAppearance.Serialization.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/TextAppearance.Serialization.cs @@ -14,12 +14,12 @@ public partial class TextAppearance { internal static TextAppearance DeserializeTextAppearance(JsonElement element) { - TextStyle style = default; + Style style = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("style")) { - style = TextStyle.DeserializeTextStyle(property.Value); + style = FormRecognizer.Models.Style.DeserializeStyle(property.Value); continue; } } diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/TextAppearance.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/TextAppearance.cs index 0246c992e053..02a579238acb 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/TextAppearance.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/TextAppearance.cs @@ -15,7 +15,7 @@ public partial class TextAppearance /// Initializes a new instance of TextAppearance. /// An object representing the style of the text line. /// is null. - internal TextAppearance(TextStyle style) + internal TextAppearance(Style style) { if (style == null) { @@ -24,8 +24,5 @@ internal TextAppearance(TextStyle style) Style = style; } - - /// An object representing the style of the text line. - public TextStyle Style { get; } } } diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/TextAppearance.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/TextAppearance.cs index 3a18d530360e..baa919d66aea 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/TextAppearance.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/TextAppearance.cs @@ -12,8 +12,24 @@ public partial class TextAppearance /// Initializes a new instance of . This constructor /// is intended to be used for mocking only. /// - internal TextAppearance() + internal TextAppearance(TextStyleName styleName, float styleConfidence) { + Style = new Style(styleName, styleConfidence); } + + /// + /// An object representing the style of the text line. + /// + internal Style Style { get; } + + /// + /// The text line style name, including handwriting and other. + /// + public TextStyleName StyleName => Style.Name; + + /// + /// The confidence of text line style. + /// + public float StyleConfidence => Style.Confidence; } } diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/TextStyle.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/TextStyle.cs deleted file mode 100644 index 13a1a5a3d0b4..000000000000 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/TextStyle.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.AI.FormRecognizer.Models -{ - [CodeGenModel("Style")] - public partial class TextStyle - { - } -} diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/Models/FormRecognizerModelFactoryTests.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/Models/FormRecognizerModelFactoryTests.cs index 3a88b7ae8e65..3944761461ef 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/Models/FormRecognizerModelFactoryTests.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/Models/FormRecognizerModelFactoryTests.cs @@ -436,7 +436,7 @@ public void FormRecognizerModelFactoryCanInstantiateFormLine() var pageNumber = 389; var text = "Bhaskara"; var words = new List() { formWord }; - var appearance = new TextAppearance(); + var appearance = new TextAppearance(default, default); var formLine = FormRecognizerModelFactory.FormLine(boundingBox, pageNumber, text, words, appearance); @@ -644,24 +644,14 @@ public void FormRecognizerModelFactoryCanInstantiateRecognizedFormCollection() [Test] public void FormRecognizerModelFactoryCanInstantiateTextAppearance() - { - var style = new TextStyle(default, default); - - var textAppearance = FormRecognizerModelFactory.TextAppearance(style); - - Assert.AreEqual(style, textAppearance.Style); - } - - [Test] - public void FormRecognizerModelFactoryCanInstantiateTextStyle() { var name = TextStyleName.Handwriting; var confidence = 0.299792f; - var textStyle = FormRecognizerModelFactory.TextStyle(name, confidence); + var textAppearance = FormRecognizerModelFactory.TextAppearance(name, confidence); - Assert.AreEqual(name, textStyle.Name); - Assert.AreEqual(confidence, textStyle.Confidence); + Assert.AreEqual(name, textAppearance.StyleName); + Assert.AreEqual(confidence, textAppearance.StyleConfidence); } [Test]