surgeventures/jabbax ? reverse-engineered prompt
Reverse engineered prompt
Build me an Elixir library for working with JSON API responses and requests in Phoenix apps.
I want to be able to assemble JSON API documents explicitly with simple structs, then encode them into the correct JSON API string, and also decode incoming JSON API bodies back into the same document shape. It should handle the usual little things for me, like turning atoms and ids into strings, dasherizing the fields that JSON API expects dashed, skipping empty maps and lists, and including the JSON API version block when needed.
Please make it easy to use in Phoenix views, and include a Plug parser and plug helper so a request with the JSON API media type can be read into conn.assigns automatically. I’d like the code and tests to show clear examples of building one resource, multiple resources, relationships, links, and error documents.
If you need to check current Elixir or Phoenix docs for anything subtle, go ahead and look them up online.
Are you gonna build this?
make sure you review the code using coderabbit