-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Enable $data reference usage for AJV validation #1255
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
Comments
I'm open to enabling this! This library was initially created without AJV, so not all the possible features of AJV were enabled by default. Please make a PR and I'll take a look. |
Thanks. I will start working on a PR to enable Meanwhile, can you also share your thoughts on adding a new dependency to ajv-keywords. This will enable the proposed keywords
If this makes sense, I will make this part of the PR. |
Great, thanks!
Hmm, I'd be wary of adding in keywords that are not yet part of the JSON schema specification. For example, the ajv-keywords repository mentions that switch is deprecated and they suggest using if/then/else, which is part of the spec instead. I'd be open to adding in functionality that is part of the JSON schema spec such as if/then/else (see #885 and #916), but otherwise it might take only a very good reason to add in additional keywords that are not part of the spec. |
Actually, given that $data is not yet part of the JSON Schema spec (it's just a proposal as of now -- see json-schema-org/json-schema-spec#51), it might be better to wait until we see if and/or how it is incorporated into the JSON schema spec before implementing it in rjsf. |
I could use this feature pls |
Closing this issue -- can reopen if json-schema-org/json-schema-spec#51 is accepted |
Hey, I've created a fix for this waiting to be approved by the team: #1668 |
Prerequisites
Description
Looking at the docs for AJV, it enables us to write validation rules using
$data
reference to an existing schema field's value, likeBut the default setup for AJV in RJSF does not enable
$data=true
Is this an opinionated design choice for some reason or we can somehow enable it. I couldn't find documentation that lets us override the AJV setup.
Having the
$data
reference will enable us to write more complex schema based validations.Is this something you will be open to enabling or letting users override this option somehow?
Thanks
The text was updated successfully, but these errors were encountered: