Forgive me if I’m not understanding the problem correctly, but can you solve this problem with a custom ecto type?
Similar to the approach used here: https://medium.com/@ItizAdz/creating-a-has-one-of-association-in-ecto-with-ectomorph-3932adb996d9
Essentially the custom type decides how to build which struct based on the shape of the params it gets.






















