Skip to content

fix: ensure OpenAPI-specific implementation for nullable types does not influence the other ones #4725

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

Merged
merged 1 commit into from
Apr 22, 2022

Conversation

Deuchnord
Copy link
Contributor

@Deuchnord Deuchnord commented Apr 21, 2022

Q A
Branch? main
Tickets fix #4621
License MIT

Fixing a bug that prevents the ApiPlatform\Core\Bridge\Symfony\Bundle\Test\ApiTestAssertionsTrait::assertMatchesResourceItemJsonSchema() method from validating against JSON-Schema correctly for some nullable properties.

@Deuchnord Deuchnord changed the title fix: ensure OpenAPI-specific implementation for nullable types does n… fix: ensure OpenAPI-specific implementation for nullable types does not influence the other ones Apr 21, 2022
@Deuchnord Deuchnord force-pushed the fix/4621-null-value-found branch from c23981f to be0380b Compare April 21, 2022 13:00
];
$typeDefinition = ['anyOf' => $jsonSchema];

if ($schema && Schema::VERSION_OPENAPI === $schema->getVersion()) {
Copy link
Member

@alanpoulain alanpoulain Apr 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure you are in a JSON Schema context, not an OpenAPI one: nullable is not available for OpenAPI >= 3.1.

@Deuchnord Deuchnord force-pushed the fix/4621-null-value-found branch from be0380b to 7301f27 Compare April 21, 2022 14:01
@Deuchnord Deuchnord marked this pull request as ready for review April 21, 2022 14:10
@Deuchnord Deuchnord requested a review from alanpoulain April 21, 2022 14:12
@soyuka soyuka merged commit 334fa25 into api-platform:main Apr 22, 2022
@Deuchnord Deuchnord deleted the fix/4621-null-value-found branch April 22, 2022 09:10
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.

assertMatchesResourceItemJsonSchema returns invalid error "NULL value found, but an integer is required"
3 participants