This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-17
Channels
- # aleph (4)
- # announcements (2)
- # babashka (85)
- # beginners (136)
- # calva (72)
- # clj-commons (32)
- # clj-kondo (7)
- # cljs-dev (3)
- # clojure (117)
- # clojure-europe (38)
- # clojure-nl (3)
- # clojure-norway (1)
- # clojure-uk (4)
- # clojurescript (19)
- # conjure (38)
- # core-logic (2)
- # cursive (10)
- # datalevin (1)
- # datalog (1)
- # datomic (6)
- # events (2)
- # fulcro (16)
- # google-cloud (5)
- # graphql (10)
- # gratitude (3)
- # hugsql (3)
- # luminus (5)
- # membrane-term (12)
- # missionary (2)
- # nextjournal (5)
- # off-topic (3)
- # pedestal (2)
- # polylith (7)
- # portal (3)
- # re-frame (6)
- # reagent (26)
- # reclojure (8)
- # releases (3)
- # reveal (5)
- # shadow-cljs (14)
- # spacemacs (20)
- # sql (3)
- # tools-build (3)
- # web-security (9)
Since the performance rework in lacinia (somewhere between 1.0 and 1.1-alpha5) empty / nil values are also required to be tagged with a type when returning a union.
i.e. returning (resolve/resolve-as nil {:message "my error"})
will now raise "Field resolver returned an instance not tagged with a schema type."
, where it'd previously work. Is this intentional?
https://github.com/walmartlabs/lacinia/commit/6a458c7c59a1828bf43050eebbd31c65bddf26ac#diff-3f41bbf0c9f5c2c078d7b2ceff7311e62c2c9621ede2d79462e3593274fab886L1046
I suspect it's this specific line 😬 L1046 in com.walmartlabs.lacinia.schema.clj
. If you can restore that it should work again.
A simple repro would be returning nil
from a field which should return a union.
I tried creating a repro but wasn't able so far. I'm not sure what caused the initial issue but it seems it was local. Sorry for the noise 😅
Nope, there’s a test that passes at command line and fails inside Cursive. Funny that.
r.e. L1046, I’ll check again, but I believe that nil has its own path through that code so the check was no longer necessary.
Anyway, I can’t reproduce the problem you are seeing; the tests (such as https://github.com/walmartlabs/lacinia/blob/44d3526905b1689b377c875e4a61bc79cba74e31/test/com/walmartlabs/lacinia/unions_test.clj#L104) cover this case AFAIK and show that it is working correctly (a nil flows through OK, even for a type defined in terms of union or interface).