Skip to content

fix(jsonschema): keep integer and number properties draft 4 compliant #6098

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
Jan 16, 2024
Merged

fix(jsonschema): keep integer and number properties draft 4 compliant #6098

merged 1 commit into from
Jan 16, 2024

Conversation

llupa
Copy link
Contributor

@llupa llupa commented Jan 10, 2024

Q A
Branch? 3.2
Tickets Closes #6041
License MIT

I am opening this PR as a starting point to close the issue linked above. From a quick conversation with @soyuka in Symfony Slack workspace I am introducing a top-level decorator that targets integer and number properties that have range definition in them. The definition is set to Draft 4 of jsonschema since the assertion library the API Platform comes with does not recognize current Draft 6 defintion.

I want to add tests but I am not sure what are the preferred tests by the team. There are no behat tests for jsonschema checks directly (they are indirectly assessed in openapi feature files). I thought to add a KernelTestCase since the schema will append the extra definitions based on Symfony assertions found in the property. Let me know, happy to add/squash more in this PR.

Copy link
Member

@soyuka soyuka left a comment

Choose a reason for hiding this comment

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

Nice start, we also need to add that draft4 information to the https://github.com/api-platform/core/blob/main/src/Symfony/Bundle/Test/ApiTestAssertionsTrait.php#L121

indeed, that way it'll continue to work with the current version of the json-schema validator.

@llupa llupa changed the title fix(jsonschema): Keep integer and number properties Draft 4 compliant fix(jsonschema): keep integer and number properties draft 4 compliant Jan 10, 2024
Copy link
Member

@soyuka soyuka left a comment

Choose a reason for hiding this comment

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

few more changes

@soyuka soyuka merged commit dcab6c7 into api-platform:3.2 Jan 16, 2024
@soyuka
Copy link
Member

soyuka commented Jan 16, 2024

amazing thanks!

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.

2 participants