jsonforms
jsonforms copied to clipboard
Async Validation with Ajv
This (draft) PR introduces the concept of async validation with Ajv for #1347.
This concept is introduced next to (instead of replacing) synchronous validation. To implement the functionality we use redux-thunk to allow for chained async actions, however redux-thunk is only necessary when the user wants to use async-marked schemas.
This (draft) PR contains the thunk for JSON Forms initialization with an async Ajv validation run, see Actions.initAsyncValidation. The (currently) last commit enables the async behavior for all examples, however only the person example is actually marked async (the remaining examples use a fallback).
Open tasks:
- Implement same behavior for the remaining core actions which perform validation:
SET_AJVandUPDATE_DATA. - Check whether we can offer dispatching-functions which either use the normal action or the preconfigured thunk depending on whether the current schema is marked asynchronous.
- Make sure the correct update data action / thunk is called depending on the circumstances
- Write testcases.
Thank you, Stefan!