-
Notifications
You must be signed in to change notification settings - Fork 4.5k
/
Skill.cs
144 lines (134 loc) · 5.27 KB
/
Skill.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// <auto-generated>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>
namespace Microsoft.Azure.Search.Models
{
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Abstract base class for skills.
/// <see
/// href="https://docs.microsoft.com/azure/search/cognitive-search-predefined-skills"
/// />
/// </summary>
public partial class Skill
{
/// <summary>
/// Initializes a new instance of the Skill class.
/// </summary>
public Skill()
{
CustomInit();
}
/// <summary>
/// Initializes a new instance of the Skill class.
/// </summary>
/// <param name="inputs">Inputs of the skills could be a column in the
/// source data set, or the output of an upstream skill.</param>
/// <param name="outputs">The output of a skill is either a field in a
/// search index, or a value that can be consumed as an input by
/// another skill.</param>
/// <param name="name">The name of the skill which uniquely identifies
/// it within the skillset. A skill with no name defined will be given
/// a default name of its 1-based index in the skills array, prefixed
/// with the character '#'.</param>
/// <param name="description">The description of the skill which
/// describes the inputs, outputs, and usage of the skill.</param>
/// <param name="context">Represents the level at which operations take
/// place, such as the document root or document content (for example,
/// /document or /document/content). The default is /document.</param>
public Skill(IList<InputFieldMappingEntry> inputs, IList<OutputFieldMappingEntry> outputs, string name = default(string), string description = default(string), string context = default(string))
{
Name = name;
Description = description;
Context = context;
Inputs = inputs;
Outputs = outputs;
CustomInit();
}
/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();
/// <summary>
/// Gets or sets the name of the skill which uniquely identifies it
/// within the skillset. A skill with no name defined will be given a
/// default name of its 1-based index in the skills array, prefixed
/// with the character '#'.
/// </summary>
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// Gets or sets the description of the skill which describes the
/// inputs, outputs, and usage of the skill.
/// </summary>
[JsonProperty(PropertyName = "description")]
public string Description { get; set; }
/// <summary>
/// Gets or sets represents the level at which operations take place,
/// such as the document root or document content (for example,
/// /document or /document/content). The default is /document.
/// </summary>
[JsonProperty(PropertyName = "context")]
public string Context { get; set; }
/// <summary>
/// Gets or sets inputs of the skills could be a column in the source
/// data set, or the output of an upstream skill.
/// </summary>
[JsonProperty(PropertyName = "inputs")]
public IList<InputFieldMappingEntry> Inputs { get; set; }
/// <summary>
/// Gets or sets the output of a skill is either a field in a search
/// index, or a value that can be consumed as an input by another
/// skill.
/// </summary>
[JsonProperty(PropertyName = "outputs")]
public IList<OutputFieldMappingEntry> Outputs { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (Inputs == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "Inputs");
}
if (Outputs == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "Outputs");
}
if (Inputs != null)
{
foreach (var element in Inputs)
{
if (element != null)
{
element.Validate();
}
}
}
if (Outputs != null)
{
foreach (var element1 in Outputs)
{
if (element1 != null)
{
element1.Validate();
}
}
}
}
}
}