Skip to content

Release 3.0.0 - #39

Merged
yuriizee merged 11 commits into
mainfrom
release/3.0.0
Nov 27, 2026
Merged

yuriizee merged 11 commits into
mainfrom
release/3.0.0

Conversation

@yuriizee

Copy link
Copy Markdown
Contributor

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)

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.

CI runs on pushes and pull requests to 3.x, and a dev-3.x branch alias
lets applications try it as 3.0.x-dev.

UPGRADE-3.0.md describes each planned behaviour change, who is affected
and what to do; the migrate-from-v2-to-v3 skill walks a codebase through
it. Both are updated in the pull request that implements each change
(milestone 3.0.0).

CONTRIBUTING.md documents which branch takes which kind of change.
COPY . . copied the host's vendor/ over the dependencies composer install
had just put into the image, so local test runs used whatever the host
had installed instead of composer.lock: Laravel 13.23 locally while CI ran
13.44, which hid a failure until CI. node_modules/ and build/ are host
artefacts too.

(cherry picked from commit bad02fb)
Rules of a nested data class and of #[DataCollection] items apply when the parent is validated. Nullable, defaulted and Optional nested properties are validated only when present, at every depth. Closes #22.
fromValidated(), validate() and fromValidatedResult() pipe the input once, validate the piped values and hydrate them with a pipe-less hydrator compiled on first use. A failing pipe is a validation error. from() is unchanged. Closes #23.
* Throw on an invalid enum value for a nullable property

A non-null value that matches no case throws DataHydrationException whether the property is nullable or not. EnumCast without a default keeps the old behaviour. Closes #25.

* Flush metadata before the service provider cache path tests

The cache file is written only when metadata is built, so the test failed when an earlier test had already loaded UserData.
finite now defaults to true; finite: false keeps accepting non-finite values. Closes #27.
Built-in casts check the input type instead of raising PHP warnings; any exception from a cast, a property pipe or a data collection is rethrown as DataHydrationException naming the field, with the original as the previous exception. Closes #26.
A key given through $key, $env or $provider that is not 32 random bytes throws InvalidArgumentException unless a keyring is configured; next to a keyring it is accepted for reading and stays deprecated. Closes #28.
Hydrators compile with strict_types; when the constructor rejects an argument, plain int, float, string and bool fields are converted only if lossless and the call is retried, so input of the declared type costs nothing extra. Lossy input throws DataHydrationException naming the field. Closes #24.
CHANGELOG [3.0.0], branch alias dev-main 3.x-dev, final UPGRADE-3.0, an Upgrading from 2.x docs page linking the migration skill, the docs version switcher for v3/v2/v1 and the Pages build of v2.
# Conflicts:
#	CONTRIBUTING.md
@yuriizee
yuriizee merged commit b32f022 into main Nov 27, 2026
6 checks passed
@yuriizee
yuriizee deleted the release/3.0.0 branch November 27, 2026 15:45
@yuriizee yuriizee mentioned this pull request Nov 27, 2026
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant