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

Backward compatibility is broken, today "ajv-merge-patch" v5.0.1 is not working with "ajv"v6.12.3" #50

Open
Parchuk opened this issue Mar 11, 2022 · 2 comments

Comments

@Parchuk
Copy link

Parchuk commented Mar 11, 2022

node_modules/ajv/lib/keyword.js:30 throw new Error('Keyword ' + keyword + ' is not a valid identifier'); ^
It’s related witth this changes

@Parchuk Parchuk changed the title Backward compatibility is broken, today "ajv-merge-patch" v5.0.1 not work with "ajv"v6.12.3" Backward compatibility is broken, today "ajv-merge-patch" v5.0.1 is not working with "ajv"v6.12.3" Mar 11, 2022
@wieringen
Copy link

wieringen commented May 8, 2022

I have the same problem; I'm using the latest version of fastify and added ajv-merge-patch as a plugin. When I revert back to 4.0.1 I have no problem.

@Parchuk
Copy link
Author

Parchuk commented May 14, 2022

I have the same problem; I'm using the latest version of fastify and added ajv-merge-patch as a plugin. When I revert back to 4.0.1 I have no problem.

My fix for this problem is
const addKeyword = ajv.addKeyword; ajv.addKeyword = (k, definition) => { if (typeof k === 'object') { const keyword = k.keyword; delete k.keyword; addKeyword.call(ajv, keyword, k); return; } addKeyword.call(ajv, k, definition); }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants