Repository navigation
3.0 changes how input is validated and coerced. Each change makes the library reject input that 2.x accepted silently or turned into something else. No public API is removed. Most applications need no code changes, only a check of the classes each section of UPGRADE-3.0.md names. The migrate-from-v2-to-v3 skill walks a codebase through it with Claude Code.
Changed (breaking)
- Nested
#[Rules]apply without#[InferRules](#22). The rules of a nested data class, and of a#[DataCollection]item class, apply when the parent is validated. Rules for nullable, defaulted orOptionalnested values apply only when the value is present. - Pipes run before validation (#23).
fromValidated(),validate()andfromValidatedResult()validate the piped values and hydrate from them without running the pipes again. A pipe that throws becomes a validation error. - Scalar properties are coerced without loss (#24). An
int,float,stringorboolproperty without a cast takes"3"and3.0intoint, and"false"intoboolasfalse. Lossy input such as"1.9"intointthrowsDataHydrationExceptionnaming the field. Union types are checked in strict mode and are not converted. - Invalid enum values on nullable properties throw (#25) instead of becoming
null.EnumCastkeeps the old behaviour. - Cast failures are
DataHydrationException(#26). The exception names the field and keeps the original asgetPrevious(). Built-in casts check the input type before using it. FloatCastrejectsINFandNANby default (#27). Passfinite: falseto accept them.- Weak legacy
EncryptedCastkeys are rejected (#28) when they are the only key. Next tokeyring:they are still accepted for reading and raise a deprecation notice.
The metadata cache format is sdo-cache-5; caches written by 2.x are rebuilt on first use.
Performance
Local benchmarks against 2.9.0, best of 7 rounds, ops/s. Hydration (flat, nested, collection) and serialization are within ±2%. The casts scenario is about 5% slower (cold 985k → 938k, warm 984k → 933k), the cost of the type checks the casts now do before using their input.
Documentation
The 3.x docs are at the site root, and the 2.x docs moved to /v2/. New page: Upgrading from 2.x.
2.x keeps receiving fixes on the v2 branch.