Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

185
Vistas
Bad idea to use Sequelize to validate non-database objects?

I'm already using Sequelize as my ORM, and I love using the powerful built-in model validation. I am considering using Sequelize as a schema validator in certain situations where there wouldn't be any actual database writes. In other words, I would never call .save(), on the model, but I would call .validate() to validate the model.

Do I need to do anything special to prevent sequelize from creating a table? Is there a good reason not to do this and use something like express-validator instead?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Well I wouldn't do that if I were you. The problem in my opinion is that first it is very confusing for anyone (even yourself in long run) to determine whether if the model is a database table or not.

Secondly it creates an unnecessary dependency where it is not needed and forces you to even change non-database models too if you ever decide to change your ORM to something else.

Also there is a little chance to mistakenly executing save() method.

I'd suggest you to use packages like Joi and class-validator instead.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda