Improve schema validation and error display
Closed this issue · 2 comments
The current state of the liform-react schema validation and error display works for schema members which are of type array or string and are at the first level of the schema. However when the element is in a "oneOf", "allOf", or "anyOf" schema, an error is thrown and consequently the schema rendering and error display beaks.
Also the current implementation does not take into consideration the fact that a user can make use of a custom ajv instance and as such can set the jsonPointers option of ajv to false. This will make the dataPath of the error to be "." separated rather than "/" separated. The implementation needs to be modified to be able to handle both scenarios with jsonPointers set to true or false.
I will be submitting a PR very soon to solve this issue.
The problem is that jsonPointers to false is quite painful to parse. Can't we just make the users set it to true? What would be the use case for wanting to have it disabled?
Anyways, if the error display with jsonPointers to false is working and with tests, that would be fine as well.
@nacmartin I found a way to easily use the datapath with jsonPointers set to false. I am just working on handling the situation with oneOf and allOf