JSON Schema gets a second null option when a #[JsonSchema] attribute allows null without a type

For optional data, getJsonSchemaForMethod() adds a {"type": "null"} option in a oneOf. If the declared #[JsonSchema] already accepts NULL, this results in a double NULL, which is incorrect.

The fix asks the justinrainbow/json-schema validator, which core ships with, whether NULL validates against the declared schema, and only adds the null option when it doesn't.

Edited by Dries Buytaert

Merge request reports

Loading
Loading