Explicit null
Backward incompatible changes
The models were generated with an implicit null acceptance for optional object properties (eg. an optional string value would also pass the validation if the property is present and contains null). This behaviour is not according to the JSON-Schema standard. Consequently now by default an explicit null type is required to accept null (eg. your property has a multi type ["string", "null"]). With a newly added option on your GeneratorConfiguration
you can enable implicit null acceptance to get the old behaviour. View the docs for more details on the implicit null option.
new Generator(
(new GeneratorConfiguration())
->setImplicitNull(true)
);
Features
- By default the properties now require an explicit definition of null acceptance via a multi type (eg. ["string", "null"]). A new option on the
GeneratorConfiguration
allows implicit null acceptance for optional object properties (docs) - Models can be initialized without providing an array. The
$modelData
parameter now defaults to an empty array. All properties will be validated against the empty array when initializing a new model without providing data. - If serialization is enabled the generated model will implement the PHP builtin
JsonSerializable
interface so the model can be passed tojson_encode
(docs) - The builtin
dateTime
filter now accepts PHPs builtin constants for formatting options (docs)
Bugfixes
- In a filter chain containing a transforming filter the filters after the transforming filter are now type checked against transformed type instead of the base type
- transforming filters applied to a multi type property must accept each of the defined types on the property
- don't execute enum validation for values with a fransforming filter if the provided value is already transformed