remoteoss / json-schema-form

https://json-schema-form.vercel.app
MIT License
70 stars 7 forks source link

Better error messages when given a non-supported JSON Schema #29

Open sandrina-p opened 1 year ago

sandrina-p commented 1 year ago

Problem

Currently, given a JSON Schema not supported by json-schema-form, the error message is hard to understand and trace back to where the problem originates from.

Solution

Evaluate a JSON Schema structure before trying to parse it, to spot and warn about invalid types.

For example, in this https://github.com/remoteoss/json-schema-form/issues/21 , the error should be:

- JSON Schema invalid TypeError: innerFields.forEach is not a function
+ JSON Schema invalid: data/properties/hobbies/items/type must be object

Investigate the possibility of using TypeScript, Zod, or any other typing tool for this type check.