Skip to content

v0.3.0

Latest

Choose a tag to compare

@fuelen fuelen released this 28 Aug 20:57

Changed

  • Lists now collect all element errors instead of stopping at the first one, consistent with maps and tuples.
  • :integer, :float, :boolean, and :atom now treat empty strings as nil, like :string and the date/time types already did. This makes nilable and default work for these types when the input is "", and changes the error reason from :invalid_format to :unexpected_nil when neither option is set.

Fixed

  • :atom no longer accepts an empty string as the atom :"". Since :"" always exists at runtime, String.to_existing_atom("") never raised and the empty value passed validation silently.
  • Optional fields and fields with defaults no longer hide :unexpected_type errors caused by malformed intermediate values in a source path. Only missing path segments trigger omission or a default.
  • Errors returned by nested union variants now preserve the full outer trace.

Documentation

  • Custom function types now document that a bare capture such as &Version.parse/1 raises on input of an unexpected shape, and show the guard clause that returns {:error, :unexpected_type} instead.
  • Documented empty-string handling, the full validate return contract, and that defaults are final values which skip parsing and the shared option pipeline.
  • Completed the error-formatting example for all built-in reasons and corrected the nested trace example in the README.