hypothesis / hypothesis/client

Add validation to incoming config values

Open
#2,798 0 comments 0 reactions 1 assignee Claimed by @LMS007 View on GitHub
Epic technical debt
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.

![96653176-59519500-12ed-11eb-932f-4bffd46c7675](https://user-images.githubusercontent.com/3939074/101392164-403f7c00-387a-11eb-8ac8-224a748bed2a.png)

**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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.