Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

184
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda