data-point
data-point copied to clipboard
Create a stand alone schema function reducer
Problem description:
With the newer version of data-point, we expect the Schema entity to be removed from the set of entities offered by data-point core package.
Suggested solution:
Create a new package that exposes a function reducer that implements ajv's schema functionality.
The API would be a higher-order function that accepts a compatible schema Object and that returns a function that will run the compiled schema against the value received.
If the schema fails to pass, then throw an error with as much information as possible provided by ajv's error object.
If there is no error, then return the value that was originally passed.