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

Cache schemas by explicit ID in AJV8Validator.isValid #3721

Merged
merged 3 commits into from Jun 16, 2023

Conversation

evshi
Copy link
Contributor

@evshi evshi commented Jun 5, 2023

Reasons for making this change

fixes #3692

For allOf/anyOf schemas, subschemas are compiled each time they are encountered if they lack an $id field. This can create poor performance for large lists or recursive refs. Leveraging the ajv cache to cache subschemas that have been encountered before greatly improves performance.

Checklist

  • I'm updating documentation
  • I'm adding or updating code
    • I've added and/or updated tests. I've run npm run test:update to update snapshots, if needed.
    • I've updated docs if needed
    • I've updated the changelog with a description of the PR
  • I'm adding a new feature
    • I've updated the playground with an example use of the feature

@evshi evshi changed the title Cache schemas in ajv by hash Cache schemas by explicit ID in AJV8Validator.isValid Jun 13, 2023
@evshi
Copy link
Contributor Author

evshi commented Jun 13, 2023

@heath-freenome updated, PTAL

Copy link
Member

@heath-freenome heath-freenome left a comment

Choose a reason for hiding this comment

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

@evshi This looks pretty good! Can you update the CHANGELOG.md and add an 5.8.2 section for this change? And also rebase to main

@evshi evshi marked this pull request as ready for review June 16, 2023 01:08
@evshi
Copy link
Contributor Author

evshi commented Jun 16, 2023

@heath-freenome updated CHANGELOG and confirmed up to date with main

@nickgros nickgros merged commit 1567ea1 into rjsf-team:main Jun 16, 2023
4 checks passed
@evshi evshi deleted the evshi/cache-validator branch June 17, 2023 00:45
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.

Terrible performance with big anyOf field
3 participants