Skip to content

@IsUrl() with options has bad feedback when invalid #223

@j-maas

Description

@j-maas

When you pass the URL test.org to the isUrl() validator with the option require_protocol, it simply returns "url must be an URL address". This is the same for the other options, like require_tld. A user will not be able to understand what they did wrong.

I understand that class-validator delegates the URL validation to another library, but it looks like that library simple returns false without further information. Now, I'm not sure whether to open the issue here or on that library.

Is it possible to add discrimination of these errors here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: questionQuestions about the usage of the library.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions