I'm not sure what a good solution would be here. I have a situation where it would be ideal for me to be able to set the default to null. I can work around it easily, but I would prefer that this situation just worked.
As a side note, this is supported by Opis JSON Schema. It looks like they take an approach where they check if a default was set for this property in the schema before trying to use the default. This repo simply sets the default to null if a default is not present in the schema.
Thank you for raising this issue, let me check if it is feasible to declare default as a three-state value (absent, null, not-null) in a same way const is declared now.
Due to the following line, applyDefaults fails to apply a default if that default is null.
https://github.com/swaggest/php-json-schema/blob/93a7278cf738d2e8084b175c2f5de29b97863a06/src/Schema.php#L799
I'm not sure what a good solution would be here. I have a situation where it would be ideal for me to be able to set the default to null. I can work around it easily, but I would prefer that this situation just worked.
As a side note, this is supported by Opis JSON Schema. It looks like they take an approach where they check if a default was set for this property in the schema before trying to use the default. This repo simply sets the default to null if a default is not present in the schema.