Closed rrramirez closed 5 months ago
@rrramirez thanks for providing the JSON required to root cause the issue, we will follow up!
@rrramirez -- we tested this on 0.0.10
of the SDK and found no reproduction. If it's valuable, I'm happy to hop on a call with you for 15 minutes to dive deeper.
Closing this since we cannot reproduce!
We are running into a deserialization issue with the new, as of 0.0.10, OneOfSerializer JsonConverter. We are fetching a list of employees using this endpoint (https://api.merge.dev/api/hris/v1/employees?expand=employments)
For further context, here is the employee record at
path $.results[0]
. This is all dummy test data and below is the exception we receive.An error occured deserializing the response.---> System.Text.Json.JsonException: The JSON value could not be converted to System.Nullable
1[OneOf.OneOf2[System.String,Merge.Client.Hris.Location]]. Path: $.results[0].home_location | LineNumber: 0 | BytePositionInLine: 1157.---> System.InvalidOperationException: Cannot skip tokens on partial JSON. Either get the whole payload and create a Utf8JsonReader instance where isFinalBlock is true or call TrySkip.at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_CannotSkipOnPartial()at Merge.Client.OneOfSerializer
1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)at System.Text.Json.Serialization.Converters.NullableConverter1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)at System.Text.Json.Serialization.Metadata.JsonPropertyInfo
1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)at System.Text.Json.Serialization.JsonConverter
1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)at System.Text.Json.Serialization.JsonCollectionConverter2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value)at System.Text.Json.Serialization.JsonConverter
1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)at System.Text.Json.Serialization.Converters.ObjectDefaultConverter
1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)at System.Text.Json.Serialization.JsonConverter
1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)--- End of inner exception stack trace`