scala - Sangria-graphql: error when passing in derivedInputObjectType as an mutation argument -
i have following case class option fields:
case class businessuserrow(id: string, firstname: option[string], lastname: option[string], email: option[string])
i trying create inputtype object business user object
val businessuserinputtype = deriveinputobjecttype[businessuserrow]( inputobjecttypename("input"), inputobjecttypedescription("a business user") )
and want pass businessinputobject argument addbusinessuser mutation
val businessuserinputarg = argument("input", businessuserinputtype) val mutation = objecttype("mutation", fields[repocontext, unit]( field("addbusinessuser", businessusertype, arguments = businessuserinputarg :: nil, resolve = c ⇒ c.ctx.businessuserrepo.create(c.arg(businessuserinputarg)))))
but following compilation error:
type dao.tables.businessuserrow @@ sangria.marshalling.frominput.inputobjectresult cannot used input. please consider defining implicit instance of `frominput` it. [error] val businessuserinputarg = argument("input", businessuserinputtype)
but fields in businessrow scalar values. don't understand causing issue.is there not seeing?
in order deserialize input in businessuserrow
case class, need provide instance of frominput[businessuserrow]
type class. can find more docs on here:
http://sangria-graphql.org/learn/#frominput-type-class
so if are, instance, using spray-json, need define jsonformat
businessuserrow
Comments
Post a Comment