I've got a working setup for a GraphQL API (Spring Boot 2, GraphQL Spring Boot Starter, GraphiQL).
Then I tried to introduce a custom scalar provided by the library graphql-java-extended-scalars (in this case the DateScalar for a member with the type java.time.LocalDate):
I declared the custom scalar and the type in the schema,
scalar Date
...
somedate: Date
...
I provided GraphQLScalarType as a Spring Bean (otherwise the server wouldn't start up):
@Bean
public GraphQLScalarType date() {
return ExtendedScalars.Date;
}
I executed a mutation query with a Date.
mutation {
createSomething(
something:{
...
somedate: "2018-07-20",
...
}
)
}
But unfortunately I get this exception,
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `java.time.LocalDate` (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
After some hours of research, I have no idea what could be wrong. It seems that the Scalar was not picked up despite provided in the configuration.
The GraphQLInputType looks like this,
@Data
public class Something implements GraphQLInputType {
...
private LocalDate somedate;
...
@Override
public String getName() {
return "Something";
}
}