MartinVolerich
How to use AshJSONAPI / OpenUI to fetch key relationships for index (:read action)
I am curious how to best handle :belongs_to relationships over openai/Swagger.
I have created a read action on a resource, which has the necessary prepare commands and of course these work beautifully over the code_interface apis and within Elixir.
My question is how best to exercise them in a similar fashion over a JSONapi. I have discovered and used the “related” macro, but would like the index/read to automatically supply those linked attributes in the main request (if that makes any sense at all!).
Thanks again for a wonderful framework that created so many new possibilites.
Martin
Most Liked
MartinVolerich
Found the issue. I just realized (or I should say that my colleague discovered) that the included fields are in a completed separate part of the response body as a sibling to “data” and not to “attributes” - which makes sense as it caters for multiple use of the same “one” entity in the various “many” entities returned in the data field.
Many thanks for all of the help again. Now we have work to do in parsing of the json data!
Martin
Popular in Questions
Other popular topics
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
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









