walmartlabs / lacinia

GraphQL implementation in pure Clojure
http://lacinia.readthedocs.io/en/latest/
Other
1.82k stars 160 forks source link

Question: Is there a way to return JSON without a corresponding EDN definition? #423

Closed ejstembler closed 2 years ago

ejstembler commented 2 years ago

I have a Postgres function which returns nested JSON. Is there a way to return the JSON without a corresponding EDN definition?

hlship commented 2 years ago

Yes, you can define a scalar type that is a JSON object.

ejstembler commented 2 years ago

@hlship Thanks for the reply! That sounds encourging.

Though, admittendly I have no clue what is needed to get it to work. Do you have a link to documention which can point me in the right direction? Or, some small snippet of example code?

I tried looking at the scalar_tests.clj unit tests, however, I didn't see anything JSON-related there...

hlship commented 2 years ago

This should go into an FAQ as it has come up before. I'll see about adding docs and/or test to demonstrate.