I’m new to Elixir and Phoenix and I’ve been trying to prototype a difficult solution before committing to Phoenix for my new app, but I’m coming up empty handed and need some help!
I need to build dynamic forms using JSON Schema, and I’d prefer to do it in the backend to take advantage of LiveView and server side validation.
My idea was to convert between JSON Schema and Ecto schema/changeset so I could build and validate forms using the server. Every variation of the form has at least 3 unchanging fields and the rest can be saved as JSON in the database. Does this even make sense to do or should I just leverage some front end JS framework that already has support for JSON schema/forms and a rest api?
So far I’ve tried leveraging json_xema
, xema
, and also failed to build a macro to define a dynamic module with the fields from the JSON Schema (which might be the best solution?)… I’m totally stuck.
In PHP or Python I could probably use a form builder to get this done, but I’m out of my element with Elixir and any sample code, pointers, links to tutorials or docs are appreciated.
Pete