JSON and scehama validator libraries for Node

Hi, I'm a new into the Node world, but I'm working in a project where are using a library called Joi for to validate the JSON data came from the request and other things. Then, i decided to search other library, and I found several, than I decided to choose some and create this post, my first post in this community.

Yup

GitHub logo jquense / yup

Dead simple Object schema validation

Yup

Yup is a JavaScript schema builder for value parsing and validation. Define a schema, transform a value to match, validate the shape of an existing value, or both. Yup schema are extremely expressive and allow modeling complex, interdependent validations, or value transformations.

Yup's API is heavily inspired by Joi, but leaner and built with client-side validation as its primary use-case. Yup separates the parsing and validating functions into separate steps. cast() transforms data while validate checks that the input is the correct shape. Each can be performed together (such as HTML form validation) or seperately (such as deserializing trusted data from APIs).

Docs

Install

npm install -S yup
Enter fullscreen mode Exit fullscreen mode

Yup always relies on the Promise global object to handle asynchronous values as well as Set and Map For browsers that do not support these, you'll need to include a polyfill, such as…

Yup is a JavaScript schema builder for value parsing and validation. Define a schema, transform a value to match, validate the shape of an existing value, or both. Yup schema are extremely expressive and allow modeling complex, interdependent validations, or value transformations.

Yup's API is heavily inspired by Joi, but leaner and built with client-side validation as its primary use-case. Yup separates the parsing and validating functions into separate steps. cast() transforms data while validate checks that the input is the correct shape. Each can be performed together (such as HTML form validation) or seperately (such as deserializing trusted data from
APIs).

ajv

GitHub logo ajv-validator / ajv

The fastest JSON schema Validator. Supports JSON Schema draft-04/06/07/2019-09/2020-12 and JSON Type Definition (RFC8927)

Ajv logo

 

Ajv JSON schema validator

The fastest JSON validator for Node.js and browser.

Supports JSON Schema draft-04/06/07/2019-09/2020-12 (draft-04 support requires ajv-draft-04 package) and JSON Type Definition RFC8927.

build npm npm downloads Coverage Status Gitter GitHub Sponsors

Platinum sponsors

Ajv online event - May 20, 10am PT / 6pm UK

We will talk about:

  • new features of Ajv version 8.
  • the improvements sponsored by Mozilla's MOSS grant.
  • how Ajv is used in JavaScript applications.

Speakers:

  • Evgeny Poberezkin, the creator of Ajv.
  • Mehan Jayasuriya, Program Officer at Mozilla Foundation, leading the MOSS and other programs investing in the open source and community ecosystems.
  • Matteo Collina, Technical Director at NearForm and Node.js Technical Steering Committee member, creator of Fastify web framework.
  • Kin Lane, Chief Evangelist at Postman. Studying the tech, business & politics of APIs since 2010. Presidential Innovation Fellow during the Obama administration.
  • Ulysse Carion, the creator of JSON Type Definition specification.

Gajus Kuizinas will…

Superstructure

GitHub logo ianstormtaylor / superstruct

A simple and composable way to validate data in JavaScript (and TypeScript).

A simple and composable way
to validate data in JavaScript (and TypeScript)

UsageWhy?PrinciplesDemoExamplesDocumentation

Superstruct makes it easy to define interfaces and then validate JavaScript data against them. Its type annotation API was inspired by Typescript, Flow, Go, and GraphQL, giving it a familiar and easy to understand API.

But Superstruct is designed for validating data at runtime, so it throws (or returns) detailed runtime errors for you or your end users. This is especially useful in situations like accepting arbitrary input in a REST or GraphQL API. But it can even be used to validate internal data structures at runtime when needed.

Usage

Superstruct allows you to define the shape of data you want to validate:

import { assert, object, number, string, array } from 'superstruct'
const Article = object({
Enter fullscreen mode Exit fullscreen mode

Superstruct makes it easy to define interfaces and then validate JavaScript data against them. Its type annotation API was inspired by Typescript, Flow, Go, and GraphQL, giving it a familiar and easy to understand API.

But Superstruct is designed for validating data at runtime, so it throws (or returns) detailed runtime errors for you or your end users. This is especially useful in situations like accepting arbitrary input in a REST or GraphQL API. But it can even be used to validate internal data structures at runtime when needed.

Forg Js

GitHub logo oussamahamdaoui / forgJs

ForgJs is a javascript lightweight object validator. Go check the Quick start section and start coding with love

Hey every one im really happy that this repo reached this many stars 🎉,but this repo needs your contibution

I started to better document the code there is an open issue on that, the main goal is to make it more accessible to other developpers who want to contribute, i'm still the main maintainer of this project and i'm calling for your help to make this code better so if any of you want to contribute and you have a good idea of how to make this better please feel free to open an issue or a pull request here is the full documentation (work in preogress): https://oussamahamdaoui.github.io/forgJs/

Thank you! and dont forget code with love ❤️


forgJs logo

GitHub version npm GitHub CircleCI (all branches) codecov Maintainability

ForgJs is a JavaScript lightweight object validator. Go check the Quick start section and start coding with love ❤️

email

password

number

url

See more live examples here

Quick start

Install it via npm by running…

25