Skip to content

Releases: nette/schema

Released version 1.3.6

Choose a tag to compare

@dg dg released this 17 Aug 18:17

A round of fixes to the corners of the validation pipeline that only bite once your schema gets interesting: nullable arrays, invalid keys, deprecated items and anyOf() branches. On top of that, castTo() now speaks backed enums.

✨ New Features

  • castTo() now accepts a backed enum – Expect::string()->castTo(Status::class) converts the value via Status::from() and, when it doesn't match, reports a proper validation error listing all allowed cases instead of blowing up with a ValueError. Pure (non-backed) enums are rejected up front with a clear message.
  • Casting to a class that can't swallow the given value no longer surfaces as a bare Error – you get an InvalidStateException naming the target class, so you know what failed to be constructed.

🐛 Bug Fixes

  • A null value for a nullable array is finally left as null. Previously the "NEON can't tell null from an empty array" workaround kicked in even for schemas explicitly declared nullable(), silently turning your null into [].
  • Items with an invalid key are now dropped instead of being merged together – all failing keys used to collapse into a single '' entry, quietly overwriting each other's values.
  • Processor::getWarnings() no longer dies with an error when called before anything was processed; it simply returns an empty array.
  • deprecated() on a required structure no longer emits a warning when the item isn't present in the input at all – you only get warned about deprecated items you actually used.
  • anyOf() stopped losing information in the winning branch: dynamic parameters found inside are propagated to the outer context again (they used to be silently forgotten, so DI never validated them), and skipDefaults is now honored inside the branch. A DynamicParameter schema also no longer registers itself for deferred validation.
  • Error messages keep unknown %placeholders% intact instead of tripping over an undefined index.

Released version 1.3.5

Choose a tag to compare

@dg dg released this 23 Feb 03:41

A code quality release that tightens static analysis and cleans up internals.

  • Fixed all PHPStan errors and improved phpDoc annotations
  • Switched to singleline declare statements across the codebase

Released version 1.3.3

Choose a tag to compare

@dg dg released this 30 Oct 22:59
  • support for PHP 8.5
  • optimized global function calls

Released version 1.3.2

Choose a tag to compare

@dg dg released this 05 Oct 00:30
  • support for PHP 8.4
  • added Structure::extend() #66
  • added Structure::getShape() #35
  • Expect::array(shape) returns Structure
  • Structure::merge() without otherItems it merges by overwriting

Released version 1.3.0

Choose a tag to compare

@dg dg released this 21 Jan 17:26
  • requires PHP 8.1
  • uses PHP 8.1 features

Released version 1.2.5

Choose a tag to compare

@dg dg released this 21 Jan 17:25
  • added transform() #52
  • castTo() allows you to create objects #44 #47 #58 #46
  • refactoring
  • added path to Context::$dynamics
  • Base: removed DynamicParameter from error message

Released version 1.2.4

Choose a tag to compare

@dg dg released this 09 Aug 14:30
  • support for PHP 8.3
  • constants are PascalCase

Released version 1.2.3

Choose a tag to compare

@dg dg released this 18 Nov 03:01
  • support for PHP 8.2
  • cs

Released version 1.2.2

Choose a tag to compare

@dg dg released this 15 Oct 11:42
  • supports nette/utils 2.5

Released version 1.2.0

Choose a tag to compare

@dg dg released this 21 Jan 14:51
  • Structure::skipDefaults() allow to skip defaults per structure
  • AnyOf() must not be empty
  • added AnyOf::firstIsDefault()
  • Ability to define scheme for the key Expert::arrayOf($stringType, $keyType)