How to decode a JSON into a struct safely?

I addressed that with the EctoAtomID-behaviour: Create a behaviour that uses Ecto.Type - #3 by Sebb.

Would be nice if I could generate the id-type:

@type id_t() :: :job_mechanic | :job_doc | :job_programmer

from the ids list in the macro also. I’ll give that a try.

I’ll try to abstract the reference-integrity-checks also. Maybe I’ll just dump everything into a database to get better checks, but this seems weird because I don’t really need that, I just want a safe way to get some related collections from json into Elixir structs and then torture that data with some pipes.