Skip to content

Error: Cannot mix different versions of Joi schemas #4

@bradbeatson

Description

@bradbeatson

using:
"@feathers-plus/validate-joi": "^3.4.0", "@feathers-plus/validate-joi-mongodb": "^1.0.0", "@feathersjs/authentication": "^4.5.12", "@feathersjs/authentication-local": "^4.5.12", "@feathersjs/authentication-oauth": "^4.5.12", "@feathersjs/configuration": "^4.5.12", "@feathersjs/errors": "^4.5.12", "@feathersjs/express": "^4.5.12", "@feathersjs/feathers": "^4.5.12", "@feathersjs/socketio": "^4.5.13", "@feathersjs/transport-commons": "^4.5.12", "compression": "^1.7.4", "cors": "^2.8.5", "express-subdomain": "^1.0.5", "feathers-mongodb": "^6.4.1", "helmet": "^4.6.0", "joi": "^17.4.0", "moment": "^2.29.1", "mongodb": "^4.3.1", "mongodb-core": "^3.2.7", "pug": "^3.0.2", "serve-favicon": "^2.5.0", "validator": "^13.7.0", "winston": "^3.5.0"

The following results in an error: "Error: Cannot mix different versions of joi schemas"
validate.validateProvidedData(attrs, { abortEarly: false })

model being used:

const Joi = require('joi');
const { objectId } = ('@feathers-plus/validate-joi-mongodb');

const attrs = {
  _id: objectId(),
  email: Joi.string().disallow(null).required(),
  password: Joi.string().disallow(null).required(),
  firstName: Joi.string().disallow(null).required(),
  lastName: Joi.string().disallow(null).required(),
  profilePicture: Joi.string().disallow(null),
  createdAt: Joi.date().required(),
  updatedAt: Joi.date().required()
};

module.exports = {
  attrs,
  schema: Joi.object(attrs)
};

being used within before patch hook

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions