Skip to content

Fix schema.nullable - #155

Merged
scaytrase merged 2 commits into
masterfrom
bugfix/fix-schema-nullable
Feb 10, 2022
Merged

Fix schema.nullable#155
scaytrase merged 2 commits into
masterfrom
bugfix/fix-schema-nullable

Conversation

@scaytrase

Copy link
Copy Markdown
Member

Fixes #154
Fixes #146

Comment thread composer.json
"php": ">=7.2",
"ext-json": "*",
"cebe/php-openapi": "^1.3",
"cebe/php-openapi": "^1.6",

Copy link
Copy Markdown

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
Copy Markdown
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
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
Copy Markdown

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