hypothesis / hypothesis/client
Add validation to incoming config values
- Dominant language
- Mustache
- Stars
- 730
- Forks
- 224
- PR merge metrics
- No merged PRs in 30d
Description
Many of the values from the host page or from a via proxy need validation to produce relatvent warnings for the site owner which may otherwise prevent some features from working. The validated values must support a variety of types including objects and arrays. Our current validation/translation checking process is incomplete and inconsistent.
**Currently**
- All values are nulled if they are not set.
- Some values are translated that come from via because it only outputs strings.
- Some values are just validated, but others are not.

**Specifically we need to**
- [ ] Build a validation module that can take a schema and produce errors from a given data set against that schema
- [ ] Don't set a value to null if its missing, just don't include it. (explore if this can be done)
- [ ] Build a schema and validate values coming into the host page (adder)
- [ ] Build a schema and validate values again coming into the sidebar iframe
- [ ] Design a process for versioning the config so we don't have to support too many different versions of values
- [ ] Translate validated values from via that might need to be move to another type for client processing. e.g. `"3"` to `3`
Relates to https://github.com/hypothesis/client/issues/1968
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.