graphql

orestis 2019-02-22T06:05:30.012300Z

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.

hlship 2019-02-22T23:35:25.016300Z

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.

hlship 2019-02-22T23:36:06.016500Z

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.

hlship 2019-02-22T23:37:39.016700Z

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.

orestis 2019-02-22T06:06:27.013400Z

But honestly itโ€™s not that big a deal, since usually the conversion function is just a function, calling it manually is fine.

orestis 2019-02-22T06:07:22.014800Z

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.

2019-02-22T10:19:08.015300Z

yeah, so you would say that a big cond for implementation of that node interface is not so strange

hlship 2019-02-22T22:18:01.016200Z

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.

๐Ÿ‘ 1