@derive Jason.Encoder
Hi All,
I have an embedded Json object in Ash which is consumed by GraphQL. I have configured graphQL to use json instead of json_string like described here => https://hexdocs.pm/ash_graphql/use-json-with-graphql.html
But now I get a Jason.Encoder error. In Ecto this can be solved by adding @derive Jason.Encoder in the module. Is there a way in Ash to do this?
6 Replies
is it an embedded resource? like
use Ash.Resource, data_layer: :embedded
?yes exactly
You want to use the
graphql
extension in that embedded resource and give it a typeah cool, I'll try that. Thanks!
Keep in mind, this will mean that the graphql reponse will no longer be json, but will be a properly structured type, so if you do that it may require some changes 🙂
yeah that's fine, it's a greenfield thing so I can model it like I want. I guess even better to have it like that
ok, changed to use the graphql extension and added a type. Worked like a charm! Thanks again!