moxley
Controlling a JSON field in a AshGraphql query
In my resource, there is an attribute called component, backed by a JSONB column. I’d like to expose that attribute as a JSON field in AshGraphql, but I want to modify it first (converting keys from underscore_case keys to camelCase). Is there a way to modify it?
The attribute’s type is currently a custom Ash.Type module. I couldn’t figure out how to affect the GraphQL response with the callback functions within it (e.g., cast_input(), cast_stored(), dump_to_native()). It seems the callbacks only affect the interaction with the data layer, and input casting.
I notice there’s a modify_resolution DSL function available for the graphql DSL, but that’s defined at the query level, not at the field (resource) level, which is what I need.
Most Liked
moxley
zachdaniel
You would effectively have the same problem with that nested type, and would need that same feature to control graphql representation. That is a valuable feature for us to have, so I’d like it to exist at some point, it’s just not there yet (maybe in part because calculations etc. are a workaround)
Popular in Questions
Other popular topics
Latest Ash Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security









