From 5d451da6090a261dbae1633bd3f8bb49eb7c6874 Mon Sep 17 00:00:00 2001 From: Florian Bernd Date: Mon, 25 Mar 2024 10:33:40 +0100 Subject: [PATCH] Revert #8018 --- .../Core/Infer/Fields/FieldsConverter.cs | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/Elastic.Clients.Elasticsearch.Shared/Core/Infer/Fields/FieldsConverter.cs b/src/Elastic.Clients.Elasticsearch.Shared/Core/Infer/Fields/FieldsConverter.cs index 3c7b65ca352..1788f8d1e1a 100644 --- a/src/Elastic.Clients.Elasticsearch.Shared/Core/Infer/Fields/FieldsConverter.cs +++ b/src/Elastic.Clients.Elasticsearch.Shared/Core/Infer/Fields/FieldsConverter.cs @@ -22,8 +22,7 @@ internal sealed class FieldsConverter : JsonConverter Fields fields = reader.GetString(); return fields; } - - if (reader.TokenType == JsonTokenType.StartArray) + else if (reader.TokenType == JsonTokenType.StartArray) { var fields = new List(); while (reader.Read() && reader.TokenType != JsonTokenType.EndArray) @@ -46,19 +45,6 @@ public override void Write(Utf8JsonWriter writer, Fields value, JsonSerializerOp return; } - if (value.ListOfFields.Count == 0) - { - writer.WriteStartObject(); - writer.WriteEndObject(); - return; - } - - if (value.ListOfFields.Count == 1) - { - JsonSerializer.Serialize(writer, value.ListOfFields[0], options); - return; - } - writer.WriteStartArray(); foreach (var field in value.ListOfFields) {