simonplend / express-json-validator-middleware

Express middleware for validating requests against JSON schema

Home Page:https://npm.im/express-json-validator-middleware

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Email validation is not proper

anistark opened this issue · comments

commented

This name@com should throw an error.

commented

I'm not sure I understand your question, could you please clarify and provide an example?

commented

Valid Email format: jouzalol@gmail.com

Invalid Email formats:

jouzalol@com
jouzalol@gmail
jouzalolgmailcom
jouzalolgmailcom

But this returns jouzalol@com as a valid format. Should throw an error.

commented

It seems like your issue might be related to ajv itself, please open an issue there. Closing this for now, if it turns out it's related to this middleware, I'll reopen.

commented

I have the same issue. @anistark, did you find the solution ?

commented

@titib Been a while but If I remember, I ended up writing my own validator function 😛

commented

I found the solution : use the last beta version as mentioned in the issue #58

@titib I'm curious to understand your issue a little better. Are you using ajv-formats to add support for the email format to Ajv?

commented

@simonplend Yes, to solve the issue, I used ajv-formats.

Great, that's the official way to do validation of properties with the email format in Ajv v8.