oliyh / locksmith

Want to use GraphQL with Clojure/script but don't want keBab or snake_keys everywhere? Use locksmith to change all the keys!
61 stars 2 forks source link

Support extended types #3

Open oliyh opened 6 years ago

oliyh commented 6 years ago

E.g.

{:type String :locksmith/type UUID}

Which would then transform it from a String to a UUID or vice versa in the transforms

madstap commented 6 years ago

Isn't this already covered by custom scalars?

oliyh commented 6 years ago

Hi @madstap,

No, it's not quite the same thing. This was intended to help with the fact that we start with edn data structures including sets, #inst, #uuid etc and lose a lot of them as they go through JSON serialisation to get to the client. The idea here is that we can leave hints in the schema so that the client side can get them back using locksmith.

Thinking about it now though, that might be a better use case for spec and conformers, and you can think of locksmith as just sorting out the keys first so that you can write your spec with idiomatic Clojure keys.

So this probably won't get implemented but it might be worth some documentation to show how you might use it in the real world.