Arri Validate
This is a work in progress. Stuff will break!
A type builder and validation library built on top of the Json Type Definition (RFC 8927) This library is pretty similar to Typebox except that it creates Json Type Definition (JTD) objects instead of Json Schema objects.
A lot of inspiration was taken from both Typebox and Zod when designing this library
Installation
npm install arri-validate
pnpm install arri-validate
Example
import { a } from "arri-validate";
const User = a.object({
id: a.string(),
name: a.string(),
});
type User = a.infer<typeof User>;
a.parse(User, `{"id": "1", "name": "John Doe"}`);
a.parse(User, `{"id": "1", "name": null}`);
a.validate(User, { id: "1", name: "John Doe" });
a.validate(User, { id: "1", name: null });
a.serialize(User, { id: "1", name: "John Doe" });
Building
Run nx build arri-validate
to build the library.
Running unit tests
Run nx test arri-validate
to execute the unit tests via Jest.