https://lacinia.readthedocs.io/en/latest/directives.html
is there any update on directive
topic?
Iโm trying to use directives for authentication purpose. Has anybody ever tried this using lacinia?
Well kinda, we have a @possibleTypes
directive (like GH also has) and we have a function that wraps a lacinia resolver fn and checks those types / if all is right calls the actual resolver.. But there is nothing automatic here, you really need to remember to wrap your resolver
So like this:
(defn with-possible-type-check
[resolver-fn]
(fn [ctx args val]
(if (possible-types-correct? ctx args val)
(resolver-fn ctx args val)
(resolve-as nil {:message "Nope"}))))
Here be dragons tho, in possible-types-correct?
we navigate the parsed directives in ctx
, that isnโt promised to be stable, so breaking is on us ๐