Skip to content

List's of custom scalar types no longer work as arguments with Jackson 2.10 #635

Closed
@alexsparrow

Description

@alexsparrow

Library Version
2.0.0-RC10

Describe the bug
As noted in #518, the behaviour of convertValue appears to have changed in Jackson 2.10 so that it no longer short-circuits when the input value is already of a suitable type.

For my use case, this causes an issue when a function on my TopLevelObject takes a list of non-primitive types e.g.

fun foo(ids: List<UUID>)

I have registered UUID as a scalar type using SchemaGeneratorHooks and defined a suitable Coercing for it.

With Jackson 2.9.X, this works as expected.

With Jackson 2.10.X, when I try to query this function, I get an exception like:

java.lang.ClassCastException: class java.lang.String cannot be cast to class java.util.UUID (java.lang.String and java.util.UUID are in module java.base of loader 'bootstrap')

I believe this is due to the usage of convertValue in FunctionDataFetcher.convertParameterValue. In Jackson 2.10.X the list will always go through a serialization/deserialization step, losing the type information.

To Reproduce
See above.

Expected behavior
Expect the List<UUID> to be forwarded as-is to my function.

Thanks for any help :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions