Skip to content

Upgrading dry-types 0.15 to 1

Breaking0.15.0 → 1.9.1Breaking3Platform2Deprecated2New19Changed12Fixed25Other3

BreakingUpgrade verdict

3 breaking changes and 2 platform requirement changes.

  • The 'safe' types have a new name, 'Lax'. The old name still works but shows a warning.
  • Type metadata now lives on the decorated type rather than the wrapper, which may affect code relying on where metadata is stored.
  • When a value cannot be converted to the expected type, these types now raise an error instead of silently returning the original value.
  • This version no longer runs on Ruby versions older than 3.2.
Top 5 of 7 that need code or config changes

Ruby requirement changed in 1.9.0: >= 2.3.0 → >= 3.2.

Breaking3
Safe types are renamed to Lax; the old name still works but prints a warning.
Lax
Metadata is now pushed down to the decorated type, a breaking change enabling rom use cases with default types in relations.
Built-in constructor types now always raise an error on failed coercion instead of returning the input.
Types::Params::IntegerDry::Types::CoercionErrorType#call
Platform2
Requires Ruby 3.2 or later.
Sets the minimum Ruby version to 3.1.
Deprecated2
Deprecates inferring predicates from class names; an exception with instructions is raised if relied upon.
Dry::Types::PredicateInferrer::Compiler.infer_predicate_by_class_name
Deprecates using Dry::Types.[] with classes.
Dry::Types.[]