Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

183
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!