Skip to content

Commit d9b1026

Browse files
authored
[FR] Move to 2.1 GA (#20967)
* oficially move to 2.1 GA * add 3.1.0 to readme
1 parent 2f3fb58 commit d9b1026

File tree

297 files changed

+96718
-53766
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

297 files changed

+96718
-53766
lines changed

sdk/formrecognizer/Azure.AI.FormRecognizer/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
By default the SDK targets latest supported service version.
99

1010
### Breaking changes
11+
- The client defaults to the latest supported service version, which currently is `2.1`.
1112
- Renamed `Id` for `Identity` in all the `StartRecognizeIdDocuments` functionalities. For example, the name of the method is now `StartRecognizeIdentityDocuments`.
1213
- Renamed the model `ReadingOrder` to `FormReadingOrder`.
1314
- The model `TextAppearance` now includes the properties `StyleName` and `StyleConfidence` that were part of the `TextStyle` object.
1415
- Removed the model `TextStyle`.
16+
- Renamed the method `AsCountryCode` to `AsCountryRegion`.
17+
- Removed type `FieldValueGender`.
18+
- Removed value `Gender` from the model `FieldValuetype`.
1519

1620
## 3.0.1 (2021-04-09)
1721

sdk/formrecognizer/Azure.AI.FormRecognizer/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ Install the Azure Form Recognizer client library for .NET with [NuGet][nuget]:
2020
dotnet add package Azure.AI.FormRecognizer
2121
```
2222

23-
> Note: This version of the client library defaults to the `v2.1-preview.3` version of the service.
23+
> Note: This version of the client library defaults to the `v2.1` version of the service.
2424
2525
This table shows the relationship between SDK versions and supported API versions of the service:
2626

2727
|SDK version|Supported API version of service
2828
|-|-
29-
|3.0.0 - Latest GA release | 2.0
30-
|3.1.0-beta.4 - Latest release (beta)| 2.0, 2.1-preview.3
29+
|3.0.0 | 2.0
30+
|3.0.1 | 2.0
31+
|3.1.0 | 2.0, 2.1
3132

3233
### Prerequisites
3334
* An [Azure subscription][azure_sub].

sdk/formrecognizer/Azure.AI.FormRecognizer/api/Azure.AI.FormRecognizer.netstandard2.0.cs

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ public FormRecognizerClient(System.Uri endpoint, Azure.Core.TokenCredential cred
4848
}
4949
public partial class FormRecognizerClientOptions : Azure.Core.ClientOptions
5050
{
51-
public FormRecognizerClientOptions(Azure.AI.FormRecognizer.FormRecognizerClientOptions.ServiceVersion version = Azure.AI.FormRecognizer.FormRecognizerClientOptions.ServiceVersion.V2_1_Preview_3) { }
51+
public FormRecognizerClientOptions(Azure.AI.FormRecognizer.FormRecognizerClientOptions.ServiceVersion version = Azure.AI.FormRecognizer.FormRecognizerClientOptions.ServiceVersion.V2_1) { }
5252
public Azure.AI.FormRecognizer.FormRecognizerClientOptions.ServiceVersion Version { get { throw null; } }
5353
public enum ServiceVersion
5454
{
5555
V2_0 = 1,
56-
V2_1_Preview_3 = 2,
56+
V2_1 = 2,
5757
}
5858
}
5959
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
@@ -246,37 +246,17 @@ public readonly partial struct FieldValue
246246
private readonly object _dummy;
247247
private readonly int _dummyPrimitive;
248248
public Azure.AI.FormRecognizer.Models.FieldValueType ValueType { get { throw null; } }
249-
public string AsCountryCode() { throw null; }
249+
public string AsCountryRegion() { throw null; }
250250
public System.DateTime AsDate() { throw null; }
251251
public System.Collections.Generic.IReadOnlyDictionary<string, Azure.AI.FormRecognizer.Models.FormField> AsDictionary() { throw null; }
252252
public float AsFloat() { throw null; }
253-
public Azure.AI.FormRecognizer.Models.FieldValueGender AsGender() { throw null; }
254253
public long AsInt64() { throw null; }
255254
public System.Collections.Generic.IReadOnlyList<Azure.AI.FormRecognizer.Models.FormField> AsList() { throw null; }
256255
public string AsPhoneNumber() { throw null; }
257256
public Azure.AI.FormRecognizer.Models.SelectionMarkState AsSelectionMarkState() { throw null; }
258257
public string AsString() { throw null; }
259258
public System.TimeSpan AsTime() { throw null; }
260259
}
261-
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
262-
public readonly partial struct FieldValueGender : System.IEquatable<Azure.AI.FormRecognizer.Models.FieldValueGender>
263-
{
264-
private readonly object _dummy;
265-
private readonly int _dummyPrimitive;
266-
public FieldValueGender(string value) { throw null; }
267-
public static Azure.AI.FormRecognizer.Models.FieldValueGender F { get { throw null; } }
268-
public static Azure.AI.FormRecognizer.Models.FieldValueGender M { get { throw null; } }
269-
public static Azure.AI.FormRecognizer.Models.FieldValueGender X { get { throw null; } }
270-
public bool Equals(Azure.AI.FormRecognizer.Models.FieldValueGender other) { throw null; }
271-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
272-
public override bool Equals(object obj) { throw null; }
273-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
274-
public override int GetHashCode() { throw null; }
275-
public static bool operator ==(Azure.AI.FormRecognizer.Models.FieldValueGender left, Azure.AI.FormRecognizer.Models.FieldValueGender right) { throw null; }
276-
public static implicit operator Azure.AI.FormRecognizer.Models.FieldValueGender (string value) { throw null; }
277-
public static bool operator !=(Azure.AI.FormRecognizer.Models.FieldValueGender left, Azure.AI.FormRecognizer.Models.FieldValueGender right) { throw null; }
278-
public override string ToString() { throw null; }
279-
}
280260
public enum FieldValueType
281261
{
282262
String = 0,
@@ -288,8 +268,7 @@ public enum FieldValueType
288268
List = 6,
289269
Dictionary = 7,
290270
SelectionMark = 8,
291-
Gender = 9,
292-
Country = 10,
271+
CountryRegion = 9,
293272
}
294273
public abstract partial class FormElement
295274
{
@@ -368,11 +347,10 @@ public static partial class FormRecognizerModelFactory
368347
public static Azure.AI.FormRecognizer.Training.CustomFormSubmodel CustomFormSubmodel(string formType, float? accuracy, System.Collections.Generic.IReadOnlyDictionary<string, Azure.AI.FormRecognizer.Training.CustomFormModelField> fields, string modelId) { throw null; }
369348
public static Azure.AI.FormRecognizer.Models.FieldBoundingBox FieldBoundingBox(System.Collections.Generic.IReadOnlyList<System.Drawing.PointF> points) { throw null; }
370349
public static Azure.AI.FormRecognizer.Models.FieldData FieldData(Azure.AI.FormRecognizer.Models.FieldBoundingBox boundingBox, int pageNumber, string text, System.Collections.Generic.IReadOnlyList<Azure.AI.FormRecognizer.Models.FormElement> fieldElements) { throw null; }
371-
public static Azure.AI.FormRecognizer.Models.FieldValue FieldValueWithCountryCodeValueType(string value) { throw null; }
350+
public static Azure.AI.FormRecognizer.Models.FieldValue FieldValueWithCountryRegionValueType(string value) { throw null; }
372351
public static Azure.AI.FormRecognizer.Models.FieldValue FieldValueWithDateValueType(System.DateTime value) { throw null; }
373352
public static Azure.AI.FormRecognizer.Models.FieldValue FieldValueWithDictionaryValueType(System.Collections.Generic.IReadOnlyDictionary<string, Azure.AI.FormRecognizer.Models.FormField> value) { throw null; }
374353
public static Azure.AI.FormRecognizer.Models.FieldValue FieldValueWithFloatValueType(float value) { throw null; }
375-
public static Azure.AI.FormRecognizer.Models.FieldValue FieldValueWithGenderValueType(Azure.AI.FormRecognizer.Models.FieldValueGender value) { throw null; }
376354
public static Azure.AI.FormRecognizer.Models.FieldValue FieldValueWithInt64ValueType(long value) { throw null; }
377355
public static Azure.AI.FormRecognizer.Models.FieldValue FieldValueWithListValueType(System.Collections.Generic.IReadOnlyList<Azure.AI.FormRecognizer.Models.FormField> value) { throw null; }
378356
public static Azure.AI.FormRecognizer.Models.FieldValue FieldValueWithPhoneNumberValueType(string value) { throw null; }

sdk/formrecognizer/Azure.AI.FormRecognizer/samples/Sample11_RecognizeIdentityDocuments.md

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ if (identityDocument.Fields.TryGetValue("Address", out FormField addressField))
4444
}
4545
}
4646

47-
if (identityDocument.Fields.TryGetValue("Country", out FormField countryField))
47+
if (identityDocument.Fields.TryGetValue("CountryRegion", out FormField countryRegionField))
4848
{
49-
if (countryField.Value.ValueType == FieldValueType.Country)
49+
if (countryRegionField.Value.ValueType == FieldValueType.CountryRegion)
5050
{
51-
string country = countryField.Value.AsCountryCode();
52-
Console.WriteLine($"Country: '{country}', with confidence {countryField.Confidence}");
51+
string countryRegion = countryRegionField.Value.AsCountryRegion();
52+
Console.WriteLine($"CountryRegion: '{countryRegion}', with confidence {countryRegionField.Confidence}");
5353
}
5454
}
5555

@@ -106,6 +106,15 @@ if (identityDocument.Fields.TryGetValue("Region", out FormField regionfield))
106106
Console.WriteLine($"Region: '{region}', with confidence {regionfield.Confidence}");
107107
}
108108
}
109+
110+
if (identityDocument.Fields.TryGetValue("Sex", out FormField sexfield))
111+
{
112+
if (sexfield.Value.ValueType == FieldValueType.String)
113+
{
114+
string sex = sexfield.Value.AsString();
115+
Console.WriteLine($"Sex: '{sex}', with confidence {sexfield.Confidence}");
116+
}
117+
}
109118
```
110119

111120
## Recognize identity documents from a given file
@@ -137,12 +146,12 @@ if (identityDocument.Fields.TryGetValue("Address", out FormField addressField))
137146
}
138147
}
139148

140-
if (identityDocument.Fields.TryGetValue("Country", out FormField countryField))
149+
if (identityDocument.Fields.TryGetValue("CountryRegion", out FormField countryRegionField))
141150
{
142-
if (countryField.Value.ValueType == FieldValueType.Country)
151+
if (countryRegionField.Value.ValueType == FieldValueType.CountryRegion)
143152
{
144-
string country = countryField.Value.AsCountryCode();
145-
Console.WriteLine($"Country: '{country}', with confidence {countryField.Confidence}");
153+
string countryRegion = countryRegionField.Value.AsCountryRegion();
154+
Console.WriteLine($"CountryRegion: '{countryRegion}', with confidence {countryRegionField.Confidence}");
146155
}
147156
}
148157

@@ -199,6 +208,15 @@ if (identityDocument.Fields.TryGetValue("Region", out FormField regionfield))
199208
Console.WriteLine($"Region: '{region}', with confidence {regionfield.Confidence}");
200209
}
201210
}
211+
212+
if (identityDocument.Fields.TryGetValue("Sex", out FormField sexfield))
213+
{
214+
if (sexfield.Value.ValueType == FieldValueType.String)
215+
{
216+
string sex = sexfield.Value.AsString();
217+
Console.WriteLine($"Sex: '{sex}', with confidence {sexfield.Confidence}");
218+
}
219+
}
202220
```
203221

204222
To see the full example source files, see:

sdk/formrecognizer/Azure.AI.FormRecognizer/src/CustomFormModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ internal CustomFormModel(
6969
/// An optional, user-defined name to associate with your model.
7070
/// </summary>
7171
/// <remarks>
72-
/// This property only has value for <see cref="FormRecognizerClientOptions.ServiceVersion.V2_1_Preview_3"/> and up.
72+
/// This property only has value for <see cref="FormRecognizerClientOptions.ServiceVersion.V2_1"/> and up.
7373
/// </remarks>
7474
public string ModelName { get; }
7575

7676
/// <summary>
7777
/// Properties of a model, such as whether the model is a composed model or not.
7878
/// </summary>
7979
/// <remarks>
80-
/// This property only has value for <see cref="FormRecognizerClientOptions.ServiceVersion.V2_1_Preview_3"/> and up.
80+
/// This property only has value for <see cref="FormRecognizerClientOptions.ServiceVersion.V2_1"/> and up.
8181
/// </remarks>
8282
[CodeGenMember("Attributes")]
8383
public CustomFormModelProperties Properties { get; }

sdk/formrecognizer/Azure.AI.FormRecognizer/src/CustomFormModelInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ internal CustomFormModelInfo(string modelId, CustomFormModelStatus status, DateT
3838
/// An optional, user-defined name to associate with your model.
3939
/// </summary>
4040
/// <remarks>
41-
/// This property only has value for <see cref="FormRecognizerClientOptions.ServiceVersion.V2_1_Preview_3"/> and up.
41+
/// This property only has value for <see cref="FormRecognizerClientOptions.ServiceVersion.V2_1"/> and up.
4242
/// </remarks>
4343
public string ModelName { get; }
4444

4545
/// <summary>
4646
/// Properties of a model, such as whether the model is a composed model or not.
4747
/// </summary>
4848
/// <remarks>
49-
/// This property only has value for <see cref="FormRecognizerClientOptions.ServiceVersion.V2_1_Preview_3"/> and up.
49+
/// This property only has value for <see cref="FormRecognizerClientOptions.ServiceVersion.V2_1"/> and up.
5050
/// </remarks>
5151
[CodeGenMember("Attributes")]
5252
public CustomFormModelProperties Properties { get; }

sdk/formrecognizer/Azure.AI.FormRecognizer/src/CustomFormSubmodel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ internal CustomFormSubmodel(string formType, float? accuracy, IReadOnlyDictionar
2929
/// The unique identifier of the submodel.
3030
/// </summary>
3131
/// <remarks>
32-
/// This property only has value for <see cref="FormRecognizerClientOptions.ServiceVersion.V2_1_Preview_3"/> and up.
32+
/// This property only has value for <see cref="FormRecognizerClientOptions.ServiceVersion.V2_1"/> and up.
3333
/// </remarks>
3434
public string ModelId { get; }
3535

sdk/formrecognizer/Azure.AI.FormRecognizer/src/FieldValue.cs

Lines changed: 6 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ internal FieldValue(FieldValueType type)
4444
internal FieldValue(string value, FieldValueType type)
4545
: this()
4646
{
47-
if (type != FieldValueType.String && type != FieldValueType.PhoneNumber && type != FieldValueType.Country)
47+
if (type != FieldValueType.String && type != FieldValueType.PhoneNumber && type != FieldValueType.CountryRegion)
4848
{
4949
throw new ArgumentException($"Specified {nameof(type)} does not support string value ({type}).");
5050
}
@@ -137,18 +137,6 @@ internal FieldValue(SelectionMarkState value)
137137
ValueSelectionMark = value;
138138
}
139139

140-
/// <summary>
141-
/// Initializes a new instance of the <see cref="FieldValue"/> structure. This constructor
142-
/// is intended to be used for mocking only.
143-
/// </summary>
144-
/// <param name="value">The actual field value.</param>
145-
internal FieldValue(FieldValueGender value)
146-
: this()
147-
{
148-
ValueType = FieldValueType.Gender;
149-
ValueGender = value;
150-
}
151-
152140
/// <summary>
153141
/// The data type of the field value.
154142
/// </summary>
@@ -204,12 +192,6 @@ internal FieldValue(FieldValueGender value)
204192
/// </summary>
205193
private SelectionMarkState ValueSelectionMark { get; }
206194

207-
/// <summary>
208-
/// The <see cref="FieldValueGender"/> value of this instance. Values are usually extracted from
209-
/// <see cref="_fieldValue"/>, so this property is exclusively used for mocking.
210-
/// </summary>
211-
private FieldValueGender ValueGender { get; }
212-
213195
/// <summary>
214196
/// Gets the value of the field as a <see cref="string"/>.
215197
/// </summary>
@@ -432,7 +414,7 @@ public IReadOnlyDictionary<string, FormField> AsDictionary()
432414
/// <returns>The value of the field converted to <see cref="SelectionMarkState"/>.</returns>
433415
/// <exception cref="InvalidOperationException">Thrown when <see cref="ValueType"/> is not <see cref="FieldValueType.SelectionMark"/>.</exception>
434416
/// <remarks>
435-
/// This method is only available for <see cref="FormRecognizerClientOptions.ServiceVersion.V2_1_Preview_3"/> and up.
417+
/// This method is only available for <see cref="FormRecognizerClientOptions.ServiceVersion.V2_1"/> and up.
436418
/// </remarks>
437419
public SelectionMarkState AsSelectionMarkState()
438420
{
@@ -459,13 +441,10 @@ public SelectionMarkState AsSelectionMarkState()
459441
/// Gets the value of the field as an ISO 3166-1 alpha-3 country code <see cref="string"/>.
460442
/// </summary>
461443
/// <returns>The value of the field converted to an ISO 3166-1 alpha-3 country code <see cref="string"/>.</returns>
462-
/// <exception cref="InvalidOperationException">Thrown when <see cref="ValueType"/> is not <see cref="FieldValueType.Country"/>.</exception>
463-
/// <remarks>
464-
/// This method is only available for <see cref="FormRecognizerClientOptions.ServiceVersion.V2_1_Preview_3"/> and up.
465-
/// </remarks>
466-
public string AsCountryCode()
444+
/// <exception cref="InvalidOperationException">Thrown when <see cref="ValueType"/> is not <see cref="FieldValueType.CountryRegion"/>.</exception>
445+
public string AsCountryRegion()
467446
{
468-
if (ValueType != FieldValueType.Country)
447+
if (ValueType != FieldValueType.CountryRegion)
469448
{
470449
throw new InvalidOperationException($"Cannot get field as country code. Field value's type is {ValueType}.");
471450
}
@@ -476,33 +455,7 @@ public string AsCountryCode()
476455
return ValueString;
477456
}
478457

479-
return _fieldValue.ValueCountry;
480-
}
481-
482-
/// <summary>
483-
/// Gets the value of the field as a <see cref="FieldValueGender"/>.
484-
/// </summary>
485-
/// <returns>The value of the field converted to a <see cref="FieldValueGender"/>.</returns>
486-
/// <exception cref="InvalidOperationException">Thrown when <see cref="ValueType"/> is not <see cref="FieldValueType.Gender"/>.</exception>
487-
public FieldValueGender AsGender()
488-
{
489-
if (ValueType != FieldValueType.Gender)
490-
{
491-
throw new InvalidOperationException($"Cannot get field as gender. Field value's type is {ValueType}.");
492-
}
493-
494-
// Use when mocking
495-
if (_fieldValue == null)
496-
{
497-
return ValueGender;
498-
}
499-
500-
if (!_fieldValue.ValueGender.HasValue)
501-
{
502-
throw new InvalidOperationException($"Value was extracted from the form, but cannot be normalized to {nameof(FieldValueType.Gender)} type. Consider accessing the `ValueData.text` property for a textual representation of the value.");
503-
}
504-
505-
return _fieldValue.ValueGender.Value;
458+
return _fieldValue.ValueCountryRegion;
506459
}
507460
}
508461
}

sdk/formrecognizer/Azure.AI.FormRecognizer/src/FieldValueType.cs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,24 +61,13 @@ public enum FieldValueType
6161
/// Used for <see cref="SelectionMarkState"/> type.
6262
/// </summary>
6363
/// <remarks>
64-
/// This property only has value for <see cref="FormRecognizerClientOptions.ServiceVersion.V2_1_Preview_3"/> and up.
64+
/// This property only has value for <see cref="FormRecognizerClientOptions.ServiceVersion.V2_1"/> and up.
6565
/// </remarks>
6666
SelectionMark,
6767

68-
/// <summary>
69-
/// Used for <see cref="FieldValueGender"/> type.
70-
/// </summary>
71-
/// <remarks>
72-
/// This property only has value for <see cref="FormRecognizerClientOptions.ServiceVersion.V2_1_Preview_3"/> and up.
73-
/// </remarks>
74-
Gender,
75-
7668
/// <summary>
7769
/// Used for <see cref="string"/> type with an ISO 3166-1 alpha-3 country code.
7870
/// </summary>
79-
/// <remarks>
80-
/// This property only has value for <see cref="FormRecognizerClientOptions.ServiceVersion.V2_1_Preview_3"/> and up.
81-
/// </remarks>
82-
Country
71+
CountryRegion
8372
}
8473
}

0 commit comments

Comments
 (0)