< Summary

Class:Azure.Search.Documents.Indexes.Models.SplitSkill
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SplitSkill.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SplitSkill.Serialization.cs
Covered lines:88
Uncovered lines:9
Coverable lines:97
Total lines:211
Line coverage:90.7% (88 of 97)
Covered branches:43
Total branches:50
Branch coverage:86% (43 of 50)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-71.43%50%
.ctor(...)-100%50%
get_DefaultLanguageCode()-100%100%
get_TextSplitMode()-100%100%
get_MaximumPageLength()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-85.71%83.33%
DeserializeSplitSkill(...)-95.65%96.15%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SplitSkill.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 to split a string into chunks of text. </summary>
 14    public partial class SplitSkill : SearchIndexerSkill
 15    {
 16        /// <summary> Initializes a new instance of SplitSkill. </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. </
 220        public SplitSkill(IEnumerable<InputFieldMappingEntry> inputs, IEnumerable<OutputFieldMappingEntry> outputs) : ba
 21        {
 222            if (inputs == null)
 23            {
 024                throw new ArgumentNullException(nameof(inputs));
 25            }
 226            if (outputs == null)
 27            {
 028                throw new ArgumentNullException(nameof(outputs));
 29            }
 30
 231            ODataType = "#Microsoft.Skills.Text.SplitSkill";
 232        }
 33
 34        /// <summary> Initializes a new instance of SplitSkill. </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="textSplitMode"> A value indicating which split mode to perform. </param>
 43        /// <param name="maximumPageLength"> The desired maximum page length. Default is 10000. </param>
 644        internal SplitSkill(string oDataType, string name, string description, string context, IList<InputFieldMappingEn
 45        {
 646            DefaultLanguageCode = defaultLanguageCode;
 647            TextSplitMode = textSplitMode;
 648            MaximumPageLength = maximumPageLength;
 649            ODataType = oDataType ?? "#Microsoft.Skills.Text.SplitSkill";
 650        }
 51
 52        /// <summary> A value indicating which language code to use. Default is en. </summary>
 1653        public SplitSkillLanguage? DefaultLanguageCode { get; set; }
 54        /// <summary> A value indicating which split mode to perform. </summary>
 1655        public TextSplitMode? TextSplitMode { get; set; }
 56        /// <summary> The desired maximum page length. Default is 10000. </summary>
 2057        public int? MaximumPageLength { get; set; }
 58    }
 59}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SplitSkill.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 SplitSkill : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 418            writer.WriteStartObject();
 419            if (Optional.IsDefined(DefaultLanguageCode))
 20            {
 421                writer.WritePropertyName("defaultLanguageCode");
 422                writer.WriteStringValue(DefaultLanguageCode.Value.ToString());
 23            }
 424            if (Optional.IsDefined(TextSplitMode))
 25            {
 426                writer.WritePropertyName("textSplitMode");
 427                writer.WriteStringValue(TextSplitMode.Value.ToString());
 28            }
 429            if (Optional.IsDefined(MaximumPageLength))
 30            {
 431                if (MaximumPageLength != null)
 32                {
 433                    writer.WritePropertyName("maximumPageLength");
 434                    writer.WriteNumberValue(MaximumPageLength.Value);
 35                }
 36                else
 37                {
 038                    writer.WriteNull("maximumPageLength");
 39                }
 40            }
 441            writer.WritePropertyName("@odata.type");
 442            writer.WriteStringValue(ODataType);
 443            if (Optional.IsDefined(Name))
 44            {
 045                writer.WritePropertyName("name");
 046                writer.WriteStringValue(Name);
 47            }
 448            if (Optional.IsDefined(Description))
 49            {
 050                writer.WritePropertyName("description");
 051                writer.WriteStringValue(Description);
 52            }
 453            if (Optional.IsDefined(Context))
 54            {
 455                writer.WritePropertyName("context");
 456                writer.WriteStringValue(Context);
 57            }
 458            writer.WritePropertyName("inputs");
 459            writer.WriteStartArray();
 2460            foreach (var item in Inputs)
 61            {
 862                writer.WriteObjectValue(item);
 63            }
 464            writer.WriteEndArray();
 465            writer.WritePropertyName("outputs");
 466            writer.WriteStartArray();
 1667            foreach (var item in Outputs)
 68            {
 469                writer.WriteObjectValue(item);
 70            }
 471            writer.WriteEndArray();
 472            writer.WriteEndObject();
 473        }
 74
 75        internal static SplitSkill DeserializeSplitSkill(JsonElement element)
 76        {
 677            Optional<SplitSkillLanguage> defaultLanguageCode = default;
 678            Optional<TextSplitMode> textSplitMode = default;
 679            Optional<int?> maximumPageLength = default;
 680            string odataType = default;
 681            Optional<string> name = default;
 682            Optional<string> description = default;
 683            Optional<string> context = default;
 684            IList<InputFieldMappingEntry> inputs = default;
 685            IList<OutputFieldMappingEntry> outputs = default;
 12086            foreach (var property in element.EnumerateObject())
 87            {
 5488                if (property.NameEquals("defaultLanguageCode"))
 89                {
 690                    defaultLanguageCode = new SplitSkillLanguage(property.Value.GetString());
 691                    continue;
 92                }
 4893                if (property.NameEquals("textSplitMode"))
 94                {
 695                    textSplitMode = new TextSplitMode(property.Value.GetString());
 696                    continue;
 97                }
 4298                if (property.NameEquals("maximumPageLength"))
 99                {
 6100                    if (property.Value.ValueKind == JsonValueKind.Null)
 101                    {
 0102                        maximumPageLength = null;
 0103                        continue;
 104                    }
 6105                    maximumPageLength = property.Value.GetInt32();
 6106                    continue;
 107                }
 36108                if (property.NameEquals("@odata.type"))
 109                {
 6110                    odataType = property.Value.GetString();
 6111                    continue;
 112                }
 30113                if (property.NameEquals("name"))
 114                {
 6115                    name = property.Value.GetString();
 6116                    continue;
 117                }
 24118                if (property.NameEquals("description"))
 119                {
 6120                    description = property.Value.GetString();
 6121                    continue;
 122                }
 18123                if (property.NameEquals("context"))
 124                {
 6125                    context = property.Value.GetString();
 6126                    continue;
 127                }
 12128                if (property.NameEquals("inputs"))
 129                {
 6130                    List<InputFieldMappingEntry> array = new List<InputFieldMappingEntry>();
 36131                    foreach (var item in property.Value.EnumerateArray())
 132                    {
 12133                        array.Add(InputFieldMappingEntry.DeserializeInputFieldMappingEntry(item));
 134                    }
 6135                    inputs = array;
 6136                    continue;
 137                }
 6138                if (property.NameEquals("outputs"))
 139                {
 6140                    List<OutputFieldMappingEntry> array = new List<OutputFieldMappingEntry>();
 24141                    foreach (var item in property.Value.EnumerateArray())
 142                    {
 6143                        array.Add(OutputFieldMappingEntry.DeserializeOutputFieldMappingEntry(item));
 144                    }
 6145                    outputs = array;
 146                    continue;
 147                }
 148            }
 6149            return new SplitSkill(odataType, name.Value, description.Value, context.Value, inputs, outputs, Optional.ToN
 150        }
 151    }
 152}