diff --git a/package.json b/package.json index 3c3ef1a..26c11f7 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "skeemas": "*", "themis": "*", "tv4": "*", + "zod": "*", "z-schema": "*" }, "description": "Benchmarks for Node.js JSON-schema validators", diff --git a/validators.js b/validators.js index be72793..5f1e763 100644 --- a/validators.js +++ b/validators.js @@ -22,6 +22,7 @@ const djv = require("djv")(); const jsvg = require("json-schema-validator-generator").default; const jlib = require("json-schema-library"); const schemasafe = require("@exodus/schemasafe"); +const zod = require("zod"); let cfworker; module.exports = async function valivators(draftUri, draftVersion) { @@ -307,6 +308,15 @@ module.exports = async function valivators(draftUri, draftVersion) { return instance(json); }, }, + { + name: "zod", + setup: function(schema) { + return zod.inferType(schema); + }, + test: function(instance, json, schema) { + return instance.parse(json); + }, + }, { name: "@cfworker/json-schema", setup: (schema) => {