| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System.Collections.Generic; |
| | 9 | | using System.Text.Json; |
| | 10 | | using Azure.Core; |
| | 11 | |
|
| | 12 | | namespace Azure.Search.Documents.Indexes.Models |
| | 13 | | { |
| | 14 | | public partial class ShaperSkill : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 4 | 18 | | writer.WriteStartObject(); |
| 4 | 19 | | writer.WritePropertyName("@odata.type"); |
| 4 | 20 | | writer.WriteStringValue(ODataType); |
| 4 | 21 | | if (Optional.IsDefined(Name)) |
| | 22 | | { |
| 0 | 23 | | writer.WritePropertyName("name"); |
| 0 | 24 | | writer.WriteStringValue(Name); |
| | 25 | | } |
| 4 | 26 | | if (Optional.IsDefined(Description)) |
| | 27 | | { |
| 0 | 28 | | writer.WritePropertyName("description"); |
| 0 | 29 | | writer.WriteStringValue(Description); |
| | 30 | | } |
| 4 | 31 | | if (Optional.IsDefined(Context)) |
| | 32 | | { |
| 4 | 33 | | writer.WritePropertyName("context"); |
| 4 | 34 | | writer.WriteStringValue(Context); |
| | 35 | | } |
| 4 | 36 | | writer.WritePropertyName("inputs"); |
| 4 | 37 | | writer.WriteStartArray(); |
| 64 | 38 | | foreach (var item in Inputs) |
| | 39 | | { |
| 28 | 40 | | writer.WriteObjectValue(item); |
| | 41 | | } |
| 4 | 42 | | writer.WriteEndArray(); |
| 4 | 43 | | writer.WritePropertyName("outputs"); |
| 4 | 44 | | writer.WriteStartArray(); |
| 16 | 45 | | foreach (var item in Outputs) |
| | 46 | | { |
| 4 | 47 | | writer.WriteObjectValue(item); |
| | 48 | | } |
| 4 | 49 | | writer.WriteEndArray(); |
| 4 | 50 | | writer.WriteEndObject(); |
| 4 | 51 | | } |
| | 52 | |
|
| | 53 | | internal static ShaperSkill DeserializeShaperSkill(JsonElement element) |
| | 54 | | { |
| 6 | 55 | | string odataType = default; |
| 6 | 56 | | Optional<string> name = default; |
| 6 | 57 | | Optional<string> description = default; |
| 6 | 58 | | Optional<string> context = default; |
| 6 | 59 | | IList<InputFieldMappingEntry> inputs = default; |
| 6 | 60 | | IList<OutputFieldMappingEntry> outputs = default; |
| 84 | 61 | | foreach (var property in element.EnumerateObject()) |
| | 62 | | { |
| 36 | 63 | | if (property.NameEquals("@odata.type")) |
| | 64 | | { |
| 6 | 65 | | odataType = property.Value.GetString(); |
| 6 | 66 | | continue; |
| | 67 | | } |
| 30 | 68 | | if (property.NameEquals("name")) |
| | 69 | | { |
| 6 | 70 | | name = property.Value.GetString(); |
| 6 | 71 | | continue; |
| | 72 | | } |
| 24 | 73 | | if (property.NameEquals("description")) |
| | 74 | | { |
| 6 | 75 | | description = property.Value.GetString(); |
| 6 | 76 | | continue; |
| | 77 | | } |
| 18 | 78 | | if (property.NameEquals("context")) |
| | 79 | | { |
| 6 | 80 | | context = property.Value.GetString(); |
| 6 | 81 | | continue; |
| | 82 | | } |
| 12 | 83 | | if (property.NameEquals("inputs")) |
| | 84 | | { |
| 6 | 85 | | List<InputFieldMappingEntry> array = new List<InputFieldMappingEntry>(); |
| 96 | 86 | | foreach (var item in property.Value.EnumerateArray()) |
| | 87 | | { |
| 42 | 88 | | array.Add(InputFieldMappingEntry.DeserializeInputFieldMappingEntry(item)); |
| | 89 | | } |
| 6 | 90 | | inputs = array; |
| 6 | 91 | | continue; |
| | 92 | | } |
| 6 | 93 | | if (property.NameEquals("outputs")) |
| | 94 | | { |
| 6 | 95 | | List<OutputFieldMappingEntry> array = new List<OutputFieldMappingEntry>(); |
| 24 | 96 | | foreach (var item in property.Value.EnumerateArray()) |
| | 97 | | { |
| 6 | 98 | | array.Add(OutputFieldMappingEntry.DeserializeOutputFieldMappingEntry(item)); |
| | 99 | | } |
| 6 | 100 | | outputs = array; |
| | 101 | | continue; |
| | 102 | | } |
| | 103 | | } |
| 6 | 104 | | return new ShaperSkill(odataType, name.Value, description.Value, context.Value, inputs, outputs); |
| | 105 | | } |
| | 106 | | } |
| | 107 | | } |