-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Fixes for #3228 (playground dev crash), #3213 (Ajv8 additionalProperties validation) #3229
Conversation
- Fix vite dev server - Assign `globalThis` to window.global to fix issue in semantic - ajv-formats `addFormats` should not be called with a nullish value
Playground - Playground `localValidator` should use @rjsf/validator-ajv8 - Upgrade Vite and @vitejs/plugin-react to latest @rjsf/validator-ajv8 - Alias `ajv` to `ajv8` because in the playground, Vite erroneously imports Ajv 6 - Report any schema error thrown by Ajv - Disable Ajv's strict mode by default - Add RJSF-specific additional properties keywords to Ajv to prevent errors from being reported in strict mode. -
122e258
to
82dfc8d
Compare
@@ -27,13 +27,13 @@ | |||
] | |||
}, | |||
"dependencies": { | |||
"ajv": "^8.11.0", | |||
"ajv8": "npm:ajv@^8.11.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part of the reason the dev server was crashing was because Vite was resolving 'ajv'
to Ajv 6 in '@rjsf/validator-ajv8'
. I could not find a Vite/esbuild configuration option to handle this (maybe it's a bug?). This fixes the issue.
Will this affect anything for users?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe switch things in the ajv6
validator instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix doesn't work if I just change it for ajv6, not sure why.
"@rjsf/utils": "^5.0.0-beta.1" | ||
"@rjsf/utils": "^5.0.0-beta.12" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can revert this one since the ^
will get it to .12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just consider making the ajv6 validator the one using the alias since it is more likely to be deleted in the future
Fixes #3228, #3213
Playground
localValidator
should use @rjsf/validator-ajv8@rjsf/validator-ajv8
ajv
toajv8
because in the playground, Vite erroneously imports Ajv 6Checklist
npm run test:update
to update snapshots, if needed.