-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix schema.nullable #155
Fix schema.nullable #155
Conversation
@@ -23,7 +23,7 @@ | |||
"require": { | |||
"php": ">=7.2", | |||
"ext-json": "*", | |||
"cebe/php-openapi": "^1.3", | |||
"cebe/php-openapi": "^1.6", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
your fix should also work with older versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test from #146 fails because of lack of logic invented here cebe/php-openapi#132
So in order to make this test pass - we should have ^1.6.0
@@ -57,7 +57,7 @@ public function validate($data, CebeSchema $schema, ?BreadCrumb $breadCrumb = nu | |||
|
|||
try { | |||
// These keywords are not part of the JSON Schema at all (new to OAS) | |||
(new Nullable($schema))->validate($data, $schema->nullable); | |||
(new Nullable($schema))->validate($data, $schema->nullable ?? true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I didn't understand why we want nullable
true
by default instead of false
?)
Fixes #154
Fixes #146