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.
-
Prerequisites
What theme are you using?
core
Version
5.x
Current Behavior
In the playground, with the AJV8 validator, form data with additional keys that don't match the schema are valid and the form is submitted.
Playground: https://rjsf-team.github.io/react-jsonschema-form/#eyJmb3JtRGF0YSI6eyJmaXJzdE5hbWUiOiJDaHVjayIsImxhc3ROYW1lIjoiTm9ycmlzIiwiYXNzS2lja0NvdW50IjoxMjN9LCJzY2hlbWEiOnsidGl0bGUiOiJBIGN1c3RvbWl6YWJsZSByZWdpc3RyYXRpb24gZm9ybSIsImRlc2NyaXB0aW9uIjoiQSBzaW1wbGUgZm9ybSB3aXRoIGFkZGl0aW9uYWwgcHJvcGVydGllcyBleGFtcGxlLiIsInR5cGUiOiJvYmplY3QiLCJyZXF1aXJlZCI6WyJmaXJzdE5hbWUiLCJsYXN0TmFtZSJdLCJhZGRpdGlvbmFsUHJvcGVydGllcyI6eyJ0eXBlIjoic3RyaW5nIn0sInByb3BlcnRpZXMiOnsiZmlyc3ROYW1lIjp7InR5cGUiOiJzdHJpbmciLCJ0aXRsZSI6IkZpcnN0IG5hbWUifSwibGFzdE5hbWUiOnsidHlwZSI6InN0cmluZyIsInRpdGxlIjoiTGFzdCBuYW1lIn19fSwidWlTY2hlbWEiOnsiZmlyc3ROYW1lIjp7InVpOmF1dG9mb2N1cyI6dHJ1ZSwidWk6ZW1wdHlWYWx1ZSI6IiJ9fSwidGhlbWUiOiJkZWZhdWx0IiwibGl2ZVNldHRpbmdzIjp7InNob3dFcnJvckxpc3QiOiJ0b3AiLCJ2YWxpZGF0ZSI6ZmFsc2UsImRpc2FibGUiOmZhbHNlLCJyZWFkb25seSI6ZmFsc2UsIm9taXRFeHRyYURhdGEiOmZhbHNlLCJsaXZlT21pdCI6ZmFsc2V9fQ==
Please note that I tried this only on playground since locally I'm still using old AJV6 on my project.
Expected Behavior
additionalProperties is set to type "string", thus, number value such as 123 should fail to validate.
AJV6 (deprecated) validator behaves as expected and gives validation error "assKickCount should be string"
Steps To Reproduce
Environment
- Playground
Anything else?
No response
The text was updated successfully, but these errors were encountered: