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

Improve developer ergonomics for precompiled validator usage #797

Closed
greg-nagy opened this issue Jan 4, 2022 · 0 comments · Fixed by #805
Closed

Improve developer ergonomics for precompiled validator usage #797

greg-nagy opened this issue Jan 4, 2022 · 0 comments · Fixed by #805
Labels
Type: Enhancement New feature or request

Comments

@greg-nagy
Copy link
Contributor

Background

In #796 we moved to precompile the validator functions so we can remove the unsafe-eval CSP policy but it happened in a bit of a rush.

Purpose

The usage of ajv is not really developer-friendly, and it would be good to be able to use it more conveniently.

Outline for the solution

  • move all the schema definitions into a separate folder
  • write code that imports all of them and
    • adds them to an ajv instance
    • compiles the validators in esm modules
    • writes the compiled output into a file
  • maybe
    • generates type guard functions and exports them, so they can be used throughout the codebase
    • keep the schema files next to the implementation code

References

@greg-nagy greg-nagy changed the title Imrpove precompiled validator ergonomics Improve developer ergonomics for precompiled validator usage Jan 4, 2022
@greg-nagy greg-nagy added the Type: Enhancement New feature or request label Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement New feature or request
Projects
None yet
1 participant