-
Notifications
You must be signed in to change notification settings - Fork 222
Description
Hi, based on this issue:
#474
I was trying to do something similar. In my case, I have some conflicting info: for example, if I chose a specific type of document, I don't need to provide additional info, for example. To allow that I was using an :fn schema like so:
[:and
[:map
[:document-type string?]
[:document-state string?]
[:document-country string?]]
[:fn {:error/message "Mandatory field for this document"
:error/path [???]
(fn [{:keys [...]}]
...rules-to-check-for-fields...)]]So, the problem is that if I want to put the error on the :document-state for example if document is type A, and on :document-country if document is of type B. I have no way of doing this today.
For this simple example, it's not a problem, but when the logic is complicated, or in some of the examples of the issue #474, you have a field that conflicts with other, I think it could be a great addition to just let the validation function define the path, for example, or maybe some other solution... WDYT?
Another good addition could be to allow multiple paths (when, for example, document is type C, it'll require both "state" and "country" to be filled)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status