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

Handle Ajv backwards incompatible changes between 7 and 8 #163

Merged
merged 4 commits into from
Nov 4, 2021

Conversation

Nevon
Copy link
Member

@Nevon Nevon commented Nov 3, 2021

Since v3.1.0 we allow passing an Ajv instance in the constructor parameters. However, because we require it to be an instance of Ajv, and Ajv made backwards incompatible changes in version 8, it means that you cannot use that version with this package.

Our interface towards Ajv is actually quite small. We only ever use the compile method and the error type that we get back. The error type unfortunately had some backwards incompatible changes that affected us, so I had to write a small compatibility shim to construct our error from either version.

Newer versions of the Ajv constructor aren't compatible
with the version we're using. Since we only care about the
compile method, we can require just that.
Newer versions of Ajv have made backwards incompatible changes
to the validation errors, so we have to have our own type that only
requires the things we need, and then handle both possible types.
@Nevon Nevon merged commit 1da0ea6 into master Nov 4, 2021
@Nevon Nevon deleted the be-flexible-with-ajv-versions branch November 4, 2021 06:22
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.

1 participant