Open dktapps opened 3 years ago
This seems to appear in a few other places where anyOf
has been used in my schemas, like this one (both getters and setters are wrong in this case):
I've added fixes for this issue and issue #51 to the master branch and tagged version 0.21.6 which includes the fixes.
https://github.com/wol-soft/php-json-schema-model-generator/issues/50#issuecomment-943716585
Unfortunately, this is still reproducible for non-nullable unions. https://github.com/pmmp/DataModels/blob/3825e7a99210302b0b3a2d94641631710f782f6d/src/immutable/PluginManifest.php#L528 https://github.com/pmmp/DataModels/blob/3825e7a99210302b0b3a2d94641631710f782f6d/src/mutable/PluginManifest.php#L582 https://github.com/pmmp/DataModels/blob/3825e7a99210302b0b3a2d94641631710f782f6d/schema/PluginManifest.json#L41-L47
Hi @dktapps,
thanks for the report, again. I'm currently working on a larger refactoring to support various JSON-Schema versions which also includes how types are evaluated to fix issues with composed types. This will fix the issue, when completed.
Cheers.
Alright, thanks for the update.
Describe the bug Nullable field setters don't correctly account for
null
when generating typehints.Again, found by PHPStan.
Expected behavior
setDisableBlockTicking()
should acceptnull
.Schema
Config: https://github.com/pmmp/DataModels/blob/3f398d966d5180d68e33c8f4054ab592094ea54c/generate-schemas.php
Version: 0.21.5.