Validators
expede opened this issue · 3 comments
expede commented
Add the ability to validate entire ADTs, similar to Ecto models. Validation of individual fields should be left to #2. This feature is meant to enforce structure among fields.
defdata AcuteTriangle, validate: acute do
angle1: float
angle2: float
end
defp acute(%AcuteTriangle{angle1: angle1, angle2: angle2}) do: abs(angle1 - angle2) < 90.0
hariroshan commented
where does the macro defadt
exist. I tried import Algae
and Use Witchcraft
as well. No luck
expede commented
Hey @hariroshan 👋
This Issue is from the earliest days of the project, and defadt
has since been renamed to defdata
, and the syntax changed quite a lot as well. I'll update the text to reflect this. Thanks for pointing it out :)