Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add additional features to the messaging schema validation #33

Open
hamilton opened this issue Mar 30, 2021 · 1 comment
Open

add additional features to the messaging schema validation #33

hamilton opened this issue Mar 30, 2021 · 1 comment

Comments

@hamilton
Copy link
Contributor

hamilton commented Mar 30, 2021

The schema validation part of the Messaging is a great way to catch errors at the point of reporting from content scripts. It is, however, missing some features that would enable more sophisticated use in future studies:

  • there is no way to mark a field as optional or alternatively specify which are required
  • there is no way to specify more than one type

Some possibilities:

  1. build these two features into the current schema validation. It wouldn't be too hard to take the syntax from json schema and implement those here.
  2. use a well-tested / pre-existing schema validation library like ajv
@jonathanmayer
Copy link
Contributor

use a well-tested / pre-existing schema validation library like ajv

I like this idea. We developed the current schema system as an ad hoc means of minimizing foreseeable bugs. Switching to a standard schema system and library should be (relatively) painless, since our schemas are simple and we can integrate a library into the build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants