Skip to content

Inconsistent MapConverter array return values between NewtonSoft and SystemText Json Serializers #223

@BillBaird

Description

@BillBaird

If a GraphQL errors collection contains extensions where a map value is an array, the NewtonSoft MapConverter returns an IEnumerable<object>, where the SystemTextJson MapConverter returns a List<object>. These should both work the same way.

While both MapConverter implementations of ReadArray() return an IEnumerable<object>, the calling methods differ in that the NewtonSoft implementation of ReadToken simply passes the IEnumerable along, while the SystemTextJson implementation of ReadValue calls ToList() on the result of ReadArray().

I suggest these behave consistently (I would vote for adding ToList() to the NewtonSoft MapConverter implementation), although either way can work.

An example that can be used to reproduce would be as simple as

"extensions": {
        "codes": [
          "some code"
        ]
}

and deserializing using both the NewtonSoft and SystemTextJson MapConverters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions