| | 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 SynonymTokenFilter : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | writer.WritePropertyName("synonyms"); |
| 0 | 20 | | writer.WriteStartArray(); |
| 0 | 21 | | foreach (var item in Synonyms) |
| | 22 | | { |
| 0 | 23 | | writer.WriteStringValue(item); |
| | 24 | | } |
| 0 | 25 | | writer.WriteEndArray(); |
| 0 | 26 | | if (Optional.IsDefined(IgnoreCase)) |
| | 27 | | { |
| 0 | 28 | | writer.WritePropertyName("ignoreCase"); |
| 0 | 29 | | writer.WriteBooleanValue(IgnoreCase.Value); |
| | 30 | | } |
| 0 | 31 | | if (Optional.IsDefined(Expand)) |
| | 32 | | { |
| 0 | 33 | | writer.WritePropertyName("expand"); |
| 0 | 34 | | writer.WriteBooleanValue(Expand.Value); |
| | 35 | | } |
| 0 | 36 | | writer.WritePropertyName("@odata.type"); |
| 0 | 37 | | writer.WriteStringValue(ODataType); |
| 0 | 38 | | writer.WritePropertyName("name"); |
| 0 | 39 | | writer.WriteStringValue(Name); |
| 0 | 40 | | writer.WriteEndObject(); |
| 0 | 41 | | } |
| | 42 | |
|
| | 43 | | internal static SynonymTokenFilter DeserializeSynonymTokenFilter(JsonElement element) |
| | 44 | | { |
| 0 | 45 | | IList<string> synonyms = default; |
| 0 | 46 | | Optional<bool> ignoreCase = default; |
| 0 | 47 | | Optional<bool> expand = default; |
| 0 | 48 | | string odataType = default; |
| 0 | 49 | | string name = default; |
| 0 | 50 | | foreach (var property in element.EnumerateObject()) |
| | 51 | | { |
| 0 | 52 | | if (property.NameEquals("synonyms")) |
| | 53 | | { |
| 0 | 54 | | List<string> array = new List<string>(); |
| 0 | 55 | | foreach (var item in property.Value.EnumerateArray()) |
| | 56 | | { |
| 0 | 57 | | array.Add(item.GetString()); |
| | 58 | | } |
| 0 | 59 | | synonyms = array; |
| 0 | 60 | | continue; |
| | 61 | | } |
| 0 | 62 | | if (property.NameEquals("ignoreCase")) |
| | 63 | | { |
| 0 | 64 | | ignoreCase = property.Value.GetBoolean(); |
| 0 | 65 | | continue; |
| | 66 | | } |
| 0 | 67 | | if (property.NameEquals("expand")) |
| | 68 | | { |
| 0 | 69 | | expand = property.Value.GetBoolean(); |
| 0 | 70 | | continue; |
| | 71 | | } |
| 0 | 72 | | if (property.NameEquals("@odata.type")) |
| | 73 | | { |
| 0 | 74 | | odataType = property.Value.GetString(); |
| 0 | 75 | | continue; |
| | 76 | | } |
| 0 | 77 | | if (property.NameEquals("name")) |
| | 78 | | { |
| 0 | 79 | | name = property.Value.GetString(); |
| | 80 | | continue; |
| | 81 | | } |
| | 82 | | } |
| 0 | 83 | | return new SynonymTokenFilter(odataType, name, synonyms, Optional.ToNullable(ignoreCase), Optional.ToNullabl |
| | 84 | | } |
| | 85 | | } |
| | 86 | | } |