JSORM the isomorphic, framework-agnostic Javascript ORM

Validations

JSONAPI Suite is already set up to return validation errors with a 422 response code and JSONAPI-compliant errors payload. Those errors will be automatically assigned, and removed on subsequent requests:

Typescript
Javascript
  let success = await post.save()
  console.log(success) // false
  post.errors.title // { message: "Can't be blank", ... }
  post.title = "no longer blank"
  success = await post.save()
  console.log(success) // true
  post.errors // {}
  
  post.save().then(function(success) {
    console.log(success) // false
    post.errors.title // { message: "Can't be blank", ... }
    post.title = "no longer blank"
    post.save().then(function(success) {
      console.log(success); // true
      post.errors // {}
    });
  })