How do you model your nullable strings?

Oof, I’m so confused now- so if I use empty_values: [nil], then after casting a %{subject: nil}, I’ll have changes: %{subject: ""} Then the validate_change will be called with an empty string (so I actually don’t need it anymore, it looks like nil can’t make it through the cast).

  defp validate_not_null(changeset, fields) do
    Enum.reduce(fields, changeset, fn field, changeset ->
      validate_change(changeset, field, fn
        field, nil -> [{field, "can't be empty"}]
        _, _ -> []
      end)
    end)
  end

Without adding empty_values: [nil], my changes are %{subject: nil}, and my validateChange is never called. I think that’s expected behaviour: `Ecto.Changeset.validate_change` and setting fields to `nil` - #3 by josevalim