kulakowka / feathers-validate-hook

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

Home Page:https://code-typing-tutor.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

validator isnt returning anything

devSarry opened this issue · comments

My user/hooks/index.js file looks like this

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

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

exports.before = {
  all: [],
  find: [
    // auth.verifyToken(),
    // auth.populateUser(),
    // auth.restrictToAuthenticated()
  ],
  get: [
    auth.verifyToken(),
    auth.populateUser(),
    auth.restrictToAuthenticated(),
    auth.restrictToOwner({ ownerField: 'id' })
  ],
  create: [
    auth.hashPassword(),
    validateHook(schema)
  ],

This is the error im getting in my client when trying to use the validator

Cannot read property 'map' of null
    at Object.<anonymous> (/home/vagrant/Code/yeller-chat/node_modules/feathers-validate-hook/lib/validate/index.js:25:34)

How did you correct this?

ezoic increase your site revenue