Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsonapi-checker-lib

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonapi-checker-lib

Lib to check some input follows the JSON API specifications

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Jsonapi Checker Library

Overview

This library let you to validate an API against the JSON API specifications. And it exposes the rules defined by these specifications.

You can see a UI which uses this library here : https://jsonapi-spec-validator-ui.herokuapp.com/

For more information on JSON API : http://jsonapi.org

This library is used in the following stack (but can be used alone) :

  • UI : ReactJS + json-api-store + bootstrap
  • Server : hapi (nodejs)
  • JSON API validation library : built on Chai (nodejs)

Use

Installation

npm i --save jsonapi-checker-lib

Validation

Validate a payload :

const validator = require('jsonapi-checker-lib').validator;
validator(body).be.ValidDocument(options);

validator(header).be.ValidHeaders();

The options parameter can contain :

  • fromClient : true if the payload is sent by the client to the server
  • method : HTTP method of the request (GET, POST, PATCH, DELETE,...)

Get the rules

# rules is a multi-level object
const rules = require('jsonapi-checker-lib').rules.list;
# flatRules is a one level object
const flatRules = require('jsonapi-checker-lib').rules.flat;

Tests

npm test

Quality

check-build

More info on the check-build tool : https://github.com/FGRibreau/check-build

Keywords

FAQs

Package last updated on 25 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc