Skip to content
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

Merged
merged 2 commits into from
Feb 10, 2022
Merged

Fix schema.nullable #155

merged 2 commits into from
Feb 10, 2022

Conversation

scaytrase
Copy link
Member

Fixes #154
Fixes #146

@@ -23,7 +23,7 @@
"require": {
"php": ">=7.2",
"ext-json": "*",
"cebe/php-openapi": "^1.3",
"cebe/php-openapi": "^1.6",
Copy link

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.

Copy link
Member Author

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

@scaytrase scaytrase merged commit c3daf7c into master Feb 10, 2022
@scaytrase scaytrase deleted the bugfix/fix-schema-nullable branch February 10, 2022 13:54
tunezilla added a commit to tunezilla/openapi-test-validation that referenced this pull request Aug 2, 2022
@@ -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);
Copy link

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 ?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

$schema->nullable can be null as of cebe/php-openapi 1.6 nullable oneOf/anyOf value rejected
3 participants