Skip to content

Add @cfworker/json-schema #43

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

Merged
merged 2 commits into from
May 7, 2020
Merged

Add @cfworker/json-schema #43

merged 2 commits into from
May 7, 2020

Conversation

jdanyow
Copy link
Contributor

@jdanyow jdanyow commented May 6, 2020

@cfworker/json-schema is a validator that does not use code generation (eval or new Function). It's compatible with drafts 4, 7, and 2019-09.

eval and friends are not available in Cloudflare Workers so ajv style validators can't be used with dynamic schemas. The other non-code-generating validators are pretty out of date with the latest spec so I created yet another validator 🙄

This PR:

  1. Adds support for scoped packages in testRunner.js
  2. Makes minimal changes to index.js to support modern type: module packages.
  3. Adds @cfworker/json-schema to the list of validators

I'm sure changes will be required, I tried to use a light touch when making the module support changes.

Depending on your version of node you'll need to add some command line arguments to enable module support. I'm using v13.13.0.

node --experimental-modules --es-module-specifier-resolution=node index.js

Thanks for putting this benchmark together by the way, it's been super helpful for myself and the community.

@ebdrup ebdrup merged commit 035c37e into ebdrup:master May 7, 2020
@jdanyow jdanyow deleted the cfworker branch May 7, 2020 22:01
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

Successfully merging this pull request may close these issues.

2 participants