New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

feathers-validate-hook

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

feathers-validate-hook

Feathers hook for validate json-schema with is-my-json-valid

latest
Source
npmnpm
Version
0.0.7
Version published
Maintainers
1
Created
Source

feathers-validate-hook

npm package

NPM version Dependency Status

This is experiment. Work in progress!

Feathers hook for validate json-schema with is-my-json-valid

const validateHook = require('feathers-validate-hook')

// Define schema 
const schema = {
  // Required attribute 'text' with type 'string'
  text: {
    required: true,
    type: 'string'
  }
}

app.service('/messages').before({
  create: [ 
    validateHook(schema)
  ]
})

Example

Look example folder for more information.

Test request:

curl -H "Accept: application/json" -X POST http://localhost:3030/messages

Server response example:

{
  "name": "BadRequest",
  "message": "Validation failed",
  "code": 400,
  "className": "bad-request",
  "data": {},
  "errors": [
    {
      "field": "data.text",
      "message": "is required",
      "type": "string"
    }
  ]
}

Keywords

feathers

FAQs

Package last updated on 28 Feb 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