| | 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.Text.Json; |
| | 9 | | using Azure.Core; |
| | 10 | |
|
| | 11 | | namespace Azure.Search.Documents.Indexes.Models |
| | 12 | | { |
| | 13 | | public partial class LexicalTokenizer : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 0 | 17 | | writer.WriteStartObject(); |
| 0 | 18 | | writer.WritePropertyName("@odata.type"); |
| 0 | 19 | | writer.WriteStringValue(ODataType); |
| 0 | 20 | | writer.WritePropertyName("name"); |
| 0 | 21 | | writer.WriteStringValue(Name); |
| 0 | 22 | | writer.WriteEndObject(); |
| 0 | 23 | | } |
| | 24 | |
|
| | 25 | | internal static LexicalTokenizer DeserializeLexicalTokenizer(JsonElement element) |
| | 26 | | { |
| 8 | 27 | | if (element.TryGetProperty("@odata.type", out JsonElement discriminator)) |
| | 28 | | { |
| 8 | 29 | | switch (discriminator.GetString()) |
| | 30 | | { |
| 0 | 31 | | case "#Microsoft.Azure.Search.ClassicTokenizer": return ClassicTokenizer.DeserializeClassicTokenizer |
| 0 | 32 | | case "#Microsoft.Azure.Search.EdgeNGramTokenizer": return EdgeNGramTokenizer.DeserializeEdgeNGramTok |
| 1 | 33 | | case "#Microsoft.Azure.Search.KeywordTokenizer": return KeywordTokenizer.DeserializeKeywordTokenizer |
| 1 | 34 | | case "#Microsoft.Azure.Search.KeywordTokenizerV2": return KeywordTokenizer.DeserializeKeywordTokeniz |
| 0 | 35 | | case "#Microsoft.Azure.Search.MicrosoftLanguageStemmingTokenizer": return MicrosoftLanguageStemmingT |
| 0 | 36 | | case "#Microsoft.Azure.Search.MicrosoftLanguageTokenizer": return MicrosoftLanguageTokenizer.Deseria |
| 0 | 37 | | case "#Microsoft.Azure.Search.NGramTokenizer": return NGramTokenizer.DeserializeNGramTokenizer(eleme |
| 1 | 38 | | case "#Microsoft.Azure.Search.PathHierarchyTokenizerV2": return PathHierarchyTokenizer.DeserializePa |
| 3 | 39 | | case "#Microsoft.Azure.Search.PatternTokenizer": return PatternTokenizer.DeserializePatternTokenizer |
| 1 | 40 | | case "#Microsoft.Azure.Search.StandardTokenizer": return LuceneStandardTokenizer.DeserializeLuceneSt |
| 1 | 41 | | case "#Microsoft.Azure.Search.StandardTokenizerV2": return LuceneStandardTokenizer.DeserializeLucene |
| 0 | 42 | | case "#Microsoft.Azure.Search.UaxUrlEmailTokenizer": return UaxUrlEmailTokenizer.DeserializeUaxUrlEm |
| | 43 | | } |
| | 44 | | } |
| 0 | 45 | | string odataType = default; |
| 0 | 46 | | string name = default; |
| 0 | 47 | | foreach (var property in element.EnumerateObject()) |
| | 48 | | { |
| 0 | 49 | | if (property.NameEquals("@odata.type")) |
| | 50 | | { |
| 0 | 51 | | odataType = property.Value.GetString(); |
| 0 | 52 | | continue; |
| | 53 | | } |
| 0 | 54 | | if (property.NameEquals("name")) |
| | 55 | | { |
| 0 | 56 | | name = property.Value.GetString(); |
| | 57 | | continue; |
| | 58 | | } |
| | 59 | | } |
| 0 | 60 | | return new LexicalTokenizer(odataType, name); |
| | 61 | | } |
| | 62 | | } |
| | 63 | | } |