Skip to content

Commit

Permalink
Fix Stringified converters
Browse files Browse the repository at this point in the history
  • Loading branch information
flobernd committed Oct 5, 2023
1 parent 71ae273 commit 5867c5b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Elastic.Clients.Elasticsearch/Serialization/Stringified.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

namespace Elastic.Clients.Elasticsearch.Serialization;

internal sealed class StringifiedLongConverter : JsonConverter<long?>
internal sealed class StringifiedLongConverter : JsonConverter<long>
{
public override long? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => ReadStringifiedLong(ref reader);
public override long Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => ReadStringifiedLong(ref reader);

public override void Write(Utf8JsonWriter writer, long? value, JsonSerializerOptions options) => writer.WriteNumberValue(value.Value);
public override void Write(Utf8JsonWriter writer, long value, JsonSerializerOptions options) => writer.WriteNumberValue(value);

public static long ReadStringifiedLong(ref Utf8JsonReader reader)
{
Expand All @@ -35,11 +35,11 @@ public static long ReadStringifiedLong(ref Utf8JsonReader reader)
}
}

internal sealed class StringifiedIntegerConverter : JsonConverter<int?>
internal sealed class StringifiedIntegerConverter : JsonConverter<int>
{
public override int? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => ReadStringifiedInteger(ref reader);
public override int Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => ReadStringifiedInteger(ref reader);

public override void Write(Utf8JsonWriter writer, int? value, JsonSerializerOptions options) => writer.WriteNumberValue(value.Value);
public override void Write(Utf8JsonWriter writer, int value, JsonSerializerOptions options) => writer.WriteNumberValue(value);

public static int ReadStringifiedInteger(ref Utf8JsonReader reader)
{
Expand All @@ -62,11 +62,11 @@ public static int ReadStringifiedInteger(ref Utf8JsonReader reader)
}
}

internal sealed class StringifiedBoolConverter : JsonConverter<bool?>
internal sealed class StringifiedBoolConverter : JsonConverter<bool>
{
public override bool? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => ReadStringifiedBool(ref reader);
public override bool Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => ReadStringifiedBool(ref reader);

public override void Write(Utf8JsonWriter writer, bool? value, JsonSerializerOptions options) => writer.WriteBooleanValue(value.Value);
public override void Write(Utf8JsonWriter writer, bool value, JsonSerializerOptions options) => writer.WriteBooleanValue(value);

public static bool ReadStringifiedBool(ref Utf8JsonReader reader)
{
Expand All @@ -87,4 +87,4 @@ public static bool ReadStringifiedBool(ref Utf8JsonReader reader)

return reader.GetBoolean();
}
}
}

0 comments on commit 5867c5b

Please sign in to comment.