< Summary

Class:Azure.Search.Documents.Indexes.Models.OcrSkill
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\OcrSkill.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\OcrSkill.Serialization.cs
Covered lines:0
Uncovered lines:83
Coverable lines:83
Total lines:184
Line coverage:0% (0 of 83)
Covered branches:0
Total branches:42
Branch coverage:0% (0 of 42)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%0%
get_DefaultLanguageCode()-0%100%
get_ShouldDetectOrientation()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeOcrSkill(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\OcrSkill.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Collections.Generic;
 10
 11namespace Azure.Search.Documents.Indexes.Models
 12{
 13    /// <summary> A skill that extracts text from image files. </summary>
 14    public partial class OcrSkill : SearchIndexerSkill
 15    {
 16        /// <summary> Initializes a new instance of OcrSkill. </summary>
 17        /// <param name="inputs"> Inputs of the skills could be a column in the source data set, or the output of an ups
 18        /// <param name="outputs"> The output of a skill is either a field in a search index, or a value that can be con
 19        /// <exception cref="ArgumentNullException"> <paramref name="inputs"/> or <paramref name="outputs"/> is null. </
 020        public OcrSkill(IEnumerable<InputFieldMappingEntry> inputs, IEnumerable<OutputFieldMappingEntry> outputs) : base
 21        {
 022            if (inputs == null)
 23            {
 024                throw new ArgumentNullException(nameof(inputs));
 25            }
 026            if (outputs == null)
 27            {
 028                throw new ArgumentNullException(nameof(outputs));
 29            }
 30
 031            ODataType = "#Microsoft.Skills.Vision.OcrSkill";
 032        }
 33
 34        /// <summary> Initializes a new instance of OcrSkill. </summary>
 35        /// <param name="oDataType"> Identifies the concrete type of the skill. </param>
 36        /// <param name="name"> The name of the skill which uniquely identifies it within the skillset. A skill with no 
 37        /// <param name="description"> The description of the skill which describes the inputs, outputs, and usage of th
 38        /// <param name="context"> Represents the level at which operations take place, such as the document root or doc
 39        /// <param name="inputs"> Inputs of the skills could be a column in the source data set, or the output of an ups
 40        /// <param name="outputs"> The output of a skill is either a field in a search index, or a value that can be con
 41        /// <param name="defaultLanguageCode"> A value indicating which language code to use. Default is en. </param>
 42        /// <param name="shouldDetectOrientation"> A value indicating to turn orientation detection on or not. Default i
 043        internal OcrSkill(string oDataType, string name, string description, string context, IList<InputFieldMappingEntr
 44        {
 045            DefaultLanguageCode = defaultLanguageCode;
 046            ShouldDetectOrientation = shouldDetectOrientation;
 047            ODataType = oDataType ?? "#Microsoft.Skills.Vision.OcrSkill";
 048        }
 49
 50        /// <summary> A value indicating which language code to use. Default is en. </summary>
 051        public OcrSkillLanguage? DefaultLanguageCode { get; set; }
 52        /// <summary> A value indicating to turn orientation detection on or not. Default is false. </summary>
 053        public bool? ShouldDetectOrientation { get; set; }
 54    }
 55}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\OcrSkill.Serialization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.Search.Documents.Indexes.Models
 13{
 14    public partial class OcrSkill : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (Optional.IsDefined(DefaultLanguageCode))
 20            {
 021                writer.WritePropertyName("defaultLanguageCode");
 022                writer.WriteStringValue(DefaultLanguageCode.Value.ToString());
 23            }
 024            if (Optional.IsDefined(ShouldDetectOrientation))
 25            {
 026                writer.WritePropertyName("detectOrientation");
 027                writer.WriteBooleanValue(ShouldDetectOrientation.Value);
 28            }
 029            writer.WritePropertyName("@odata.type");
 030            writer.WriteStringValue(ODataType);
 031            if (Optional.IsDefined(Name))
 32            {
 033                writer.WritePropertyName("name");
 034                writer.WriteStringValue(Name);
 35            }
 036            if (Optional.IsDefined(Description))
 37            {
 038                writer.WritePropertyName("description");
 039                writer.WriteStringValue(Description);
 40            }
 041            if (Optional.IsDefined(Context))
 42            {
 043                writer.WritePropertyName("context");
 044                writer.WriteStringValue(Context);
 45            }
 046            writer.WritePropertyName("inputs");
 047            writer.WriteStartArray();
 048            foreach (var item in Inputs)
 49            {
 050                writer.WriteObjectValue(item);
 51            }
 052            writer.WriteEndArray();
 053            writer.WritePropertyName("outputs");
 054            writer.WriteStartArray();
 055            foreach (var item in Outputs)
 56            {
 057                writer.WriteObjectValue(item);
 58            }
 059            writer.WriteEndArray();
 060            writer.WriteEndObject();
 061        }
 62
 63        internal static OcrSkill DeserializeOcrSkill(JsonElement element)
 64        {
 065            Optional<OcrSkillLanguage> defaultLanguageCode = default;
 066            Optional<bool> detectOrientation = default;
 067            string odataType = default;
 068            Optional<string> name = default;
 069            Optional<string> description = default;
 070            Optional<string> context = default;
 071            IList<InputFieldMappingEntry> inputs = default;
 072            IList<OutputFieldMappingEntry> outputs = default;
 073            foreach (var property in element.EnumerateObject())
 74            {
 075                if (property.NameEquals("defaultLanguageCode"))
 76                {
 077                    defaultLanguageCode = new OcrSkillLanguage(property.Value.GetString());
 078                    continue;
 79                }
 080                if (property.NameEquals("detectOrientation"))
 81                {
 082                    detectOrientation = property.Value.GetBoolean();
 083                    continue;
 84                }
 085                if (property.NameEquals("@odata.type"))
 86                {
 087                    odataType = property.Value.GetString();
 088                    continue;
 89                }
 090                if (property.NameEquals("name"))
 91                {
 092                    name = property.Value.GetString();
 093                    continue;
 94                }
 095                if (property.NameEquals("description"))
 96                {
 097                    description = property.Value.GetString();
 098                    continue;
 99                }
 0100                if (property.NameEquals("context"))
 101                {
 0102                    context = property.Value.GetString();
 0103                    continue;
 104                }
 0105                if (property.NameEquals("inputs"))
 106                {
 0107                    List<InputFieldMappingEntry> array = new List<InputFieldMappingEntry>();
 0108                    foreach (var item in property.Value.EnumerateArray())
 109                    {
 0110                        array.Add(InputFieldMappingEntry.DeserializeInputFieldMappingEntry(item));
 111                    }
 0112                    inputs = array;
 0113                    continue;
 114                }
 0115                if (property.NameEquals("outputs"))
 116                {
 0117                    List<OutputFieldMappingEntry> array = new List<OutputFieldMappingEntry>();
 0118                    foreach (var item in property.Value.EnumerateArray())
 119                    {
 0120                        array.Add(OutputFieldMappingEntry.DeserializeOutputFieldMappingEntry(item));
 121                    }
 0122                    outputs = array;
 123                    continue;
 124                }
 125            }
 0126            return new OcrSkill(odataType, name.Value, description.Value, context.Value, inputs, outputs, Optional.ToNul
 127        }
 128    }
 129}