This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-30
Channels
- # aleph (1)
- # beginners (126)
- # cider (2)
- # clara (38)
- # cljsrn (2)
- # clojars (2)
- # clojure (49)
- # clojure-dev (31)
- # clojure-dusseldorf (1)
- # clojure-finland (1)
- # clojure-france (6)
- # clojure-italy (13)
- # clojure-nl (12)
- # clojure-russia (9)
- # clojure-sg (1)
- # clojure-spec (33)
- # clojure-uk (83)
- # clojurescript (206)
- # community-development (3)
- # core-async (40)
- # cursive (4)
- # datomic (7)
- # duct (21)
- # emacs (9)
- # fulcro (36)
- # funcool (2)
- # graphql (12)
- # instaparse (4)
- # jobs (4)
- # lumo (24)
- # mount (1)
- # nyc (4)
- # off-topic (29)
- # onyx (1)
- # pedestal (2)
- # random (4)
- # re-frame (60)
- # reagent (136)
- # remote-jobs (1)
- # schema (1)
- # shadow-cljs (20)
- # spacemacs (6)
- # specter (14)
- # tools-deps (2)
does lacinia support complex enum like this? https://github.com/graphql/graphql-js/blob/master/src/type/__tests__/enumType-test.js#L31-L40
I'm trying to find a simple way to translate between :MY_STATE
and a corresponding value such as "some-state-A"
. Custom scaler almost work, except it doesn't list all possible enum value so I have to add them into description every time I make a change.
Short answer: no. Long answer: I'd need to understand the use case better, but typically you would expose an enum and use a field resolver to convert from internal representation to the GraphQL enum representation.
@hlship Enum’s like that look very much like rust enums, and they could make a lot of sense. For example you could have a location value, which could be either an ADDRESSS
or a GEOCOORDINATE
where depending on the enum you have properties like ‘country’ ‘postcode’ or ‘latitude’ and ‘longitude’
for my personal use case, it's just to get around the restriction where enum value can't take -
If I'm understanding this, you want to have Lacinia identify particular types in the resolved value and convert it, much like a scalar, to an enum? I just don't see how a client will see the someRandomValue: 123
structure ... they'll just see "TWO"
.
i understand this is a graphQL restriction, but it's a bit awkward to convert between db value "my-state"
and :MY_STATE
. I guess i'll just stick with string type for now. resolver works for one way, but we'd still need to parse incoming query to string
... and that becomes a resolver factory: http://lacinia.readthedocs.io/en/latest/resolve/attach.html#resolver-factories
resolver doesn't work in input object right? I would need to explicitly parse MY_STATE
back to "my-state"