Ecto.Schema / Ecto.Changeset - optional, conditionally present fields

There’s a library available for defining custom types, which allows you to dump or load values based on those types. It might be helpful for your use case: Parameter — Parameter v0.14.1