I was wondering if it would be possible to specify a conversion function on the graphql function, and then have Lacinia execute it on every resolver that returns it.
In a much earlier Lacinia, there was the idea of a resolver-transformer, but that ended up being silly, as you can just wrap your existing functions however you like before passing them into Lacinia with the schema.
One thing you can look into are scalars, since you would have the ability in the scalar's serialize function to do all kinds of interesting things.
I've been pushing, on our team, to have additional scalars for things like Currency (an Int, as number of pennies), a CustomerId (a String, with a particular regexp pattern) etc. The parse/serialize would often be trivial, but it's another place to push some global input validations, and (importantly to me) a good place to put some documentation.
But honestly itโs not that big a deal, since usually the conversion function is just a function, calling it manually is fine.
Plus, having a graphql endpoint means basically you are building a graph-relational mapper. Best to hand roll one for your domain than rely on too much magic.
yeah, so you would say that a big cond
for implementation of that node interface is not so strange
v0.33.0-alpha-1 is up on clojars; adds support for extend type
in SDL, and reworks a lot of exceptions. More consistent use of the Object/field
syntax.