graphql

steveb8n 2021-05-23T05:41:34.002100Z

Q: namespaced keyword are idiomatic in Clojure but not in graphql. Currently I discard namespaces when exposing a graphql api. how are others exposing namespaces (if at all) and what have you learned from your choice?

fmnoise 2021-05-26T16:41:10.003Z

something like that

:Keyword {:description "The Keyword scalar type represents valid Clojure keyword eg \"user.role/admin\""
           :parse keyword
           :serialize (fn [k]
                        (when (keyword? k)
                          (let [ns (namespace k)
                                name (name k)]
                            (if ns (str ns "/" name) name))))}

fmnoise 2021-05-26T16:43:22.003300Z

it definitely works, but I feel like using enums is better for keeping constraints and reducing garbage input