Skip to content

built-in type validators missing useful information #9488

Closed

Description

@yocontra

What are you doing?

We expect to be able to return useful validation errors for our API users/UI to understand - to do so we need the field name the error is for. With custom validation errors, we get that information and can use it to highlight fields in the UI - with any core type, we get no information other than the value that failed. It would be extremely useful if all validation errors were the same, no matter if it was a core type or custom type. If you agree I can send a PR shortly since this is a pretty easy fix.

Model.validate({ id: '1234' })

What do you expect to happen?

An error resembling other validation errors, complete with an errors array, each item containing validatorKey, path, value, and message.

What is actually happening?

The only information in the error is the message attribute:

"1234" is not a valid uuid

Dialect: any
Sequelize version: 5.x
Tested with latest release: Yes

Activity

  1. sushantdhiman commented on May 29, 2018

    @sushantdhiman
    Contributor

    Good idea

  2. sushantdhiman commented on Jul 14, 2018

    @sushantdhiman
    Contributor

    Fixed in #9660

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions