scala - How to combine buildFromAst with a custom scalar (some sort of json type) -


i using schema.buildfromast(ast, builder) build graphql schema, idl on 2 thousand lines quite few layers of nesting.

i can handle fields 4 different resolvers no biggy there.

my problem 1 field has dynamic key, holds defined object.

a simplified data example be

{   "person": {     "name": "john",     "age": 3,     "uglyfield": [       {         "1234": {           "a" : "x",           "b" : "y",           "c" : "z"         },         "5678": {           "a" : "x",           "b" : "y",           "c" : "z"         },         "9101": {           "a" : "x",           "b" : "y",           "c" : "z"         }       }     ]   } } 

as can see uglyfield has objects dynamic unbound keys. best workaround @ moment define uglyfield string in schema , return "escaped" json when user requests field

type person {   name : string,   age : int,   uglyfield: string } 

which is... ugly , required user post processing on result.

on other hand found sangria author https://gist.github.com/olegilyenko/5b96f4b54f656aac226d3c4bc33fd2a6 defines custom json scalar.

i befuddled how combine graphql schema using buildfromast. tried importing jsontype implicit various places schema builder resolver etc. without success (invalid or incomplete schema, unknown type: json)

i somehow got inject json type schema build graphql idl cannot find way it.

type person {   name : string,   age : int,   uglyfield: json } 

any 1 has suggestions?


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -