-
How do I add custom json scalar value for one of the attributes(copy) inside a type. this project https://github.com/graphql-java/graphql-java-extended-scalars supports extended scalar types. I was wondering how to incorporate that. Do you guys expose RunTimeWiring? or if I create a RunTimeWiring bean in a config file, do you pick it up? The copy attribute value returning from the process code is a basically a List<Map<String,Object>>. I have no need to drill down into the values under copy from a query perspective. I just want to return the value as a json value as it would in restAPI. Following is my code below. Let me know if I'm missing something, because I'm brand new to graphql and just started today. Moving a service from REST api into this. Please look at the attention comments inside the code where I'm in need of help. I'm unable to highlight inside code. Here's my Resolver
Here's my schema
Here's my GraphQL model POJO
Also if you have another way to solve this problem, please let me know. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Nevermind I figured out the problem myself. I had to just add the following bean inside a configuration file
ExtendedScalars is taken from this project --> https://github.com/graphql-java/graphql-java-extended-scalars Then make the following changes to the .graphqls file
Changes to graphql pojo
And everything worked. For those who stumbled upon the same problem, but with a different data type, just create your own GraphQLScalarType bean. You can look at how this guy has created a GraphQLScalarType for date and do a similar thing for your own data type. You can create as many beans of GraphQLScalarType and they will be automatically pulled in during autoconfiguration and used for parsing your schema. |
Beta Was this translation helpful? Give feedback.
Nevermind I figured out the problem myself.
I had to just add the following bean inside a configuration file
ExtendedScalars is taken from this project --> https://github.com/graphql-java/graphql-java-extended-scalars
Then make the following changes to the .graphqls file
Changes to graphql pojo