| | 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 InputFieldMappingEntry : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 80 | 18 | | writer.WriteStartObject(); |
| 80 | 19 | | writer.WritePropertyName("name"); |
| 80 | 20 | | writer.WriteStringValue(Name); |
| 80 | 21 | | if (Optional.IsDefined(Source)) |
| | 22 | | { |
| 72 | 23 | | writer.WritePropertyName("source"); |
| 72 | 24 | | writer.WriteStringValue(Source); |
| | 25 | | } |
| 80 | 26 | | if (Optional.IsDefined(SourceContext)) |
| | 27 | | { |
| 8 | 28 | | writer.WritePropertyName("sourceContext"); |
| 8 | 29 | | writer.WriteStringValue(SourceContext); |
| | 30 | | } |
| 80 | 31 | | if (Optional.IsCollectionDefined(Inputs)) |
| | 32 | | { |
| 42 | 33 | | writer.WritePropertyName("inputs"); |
| 42 | 34 | | writer.WriteStartArray(); |
| 124 | 35 | | foreach (var item in Inputs) |
| | 36 | | { |
| 20 | 37 | | writer.WriteObjectValue(item); |
| | 38 | | } |
| 42 | 39 | | writer.WriteEndArray(); |
| | 40 | | } |
| 80 | 41 | | writer.WriteEndObject(); |
| 80 | 42 | | } |
| | 43 | |
|
| | 44 | | internal static InputFieldMappingEntry DeserializeInputFieldMappingEntry(JsonElement element) |
| | 45 | | { |
| 118 | 46 | | string name = default; |
| 118 | 47 | | Optional<string> source = default; |
| 118 | 48 | | Optional<string> sourceContext = default; |
| 118 | 49 | | Optional<IList<InputFieldMappingEntry>> inputs = default; |
| 1180 | 50 | | foreach (var property in element.EnumerateObject()) |
| | 51 | | { |
| 472 | 52 | | if (property.NameEquals("name")) |
| | 53 | | { |
| 118 | 54 | | name = property.Value.GetString(); |
| 118 | 55 | | continue; |
| | 56 | | } |
| 354 | 57 | | if (property.NameEquals("source")) |
| | 58 | | { |
| 118 | 59 | | source = property.Value.GetString(); |
| 118 | 60 | | continue; |
| | 61 | | } |
| 236 | 62 | | if (property.NameEquals("sourceContext")) |
| | 63 | | { |
| 118 | 64 | | sourceContext = property.Value.GetString(); |
| 118 | 65 | | continue; |
| | 66 | | } |
| 118 | 67 | | if (property.NameEquals("inputs")) |
| | 68 | | { |
| 118 | 69 | | List<InputFieldMappingEntry> array = new List<InputFieldMappingEntry>(); |
| 296 | 70 | | foreach (var item in property.Value.EnumerateArray()) |
| | 71 | | { |
| 30 | 72 | | array.Add(DeserializeInputFieldMappingEntry(item)); |
| | 73 | | } |
| 118 | 74 | | inputs = array; |
| | 75 | | continue; |
| | 76 | | } |
| | 77 | | } |
| 118 | 78 | | return new InputFieldMappingEntry(name, source.Value, sourceContext.Value, Optional.ToList(inputs)); |
| | 79 | | } |
| | 80 | | } |
| | 81 | | } |