-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed Class Validator using development debug messages #69
Conversation
|
@@ -44,14 59,26 @@ describe('class-validator', () => { | |||
id: 'c4a760a8-dbcf-4e14-9f39-645a8e933d74', | |||
name: 'John Doe', | |||
updatedAt: '2021-01-01T00:00:00.000Z', | |||
}; | |||
} as Schema; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was needed otherwise the infer tests started to fail
nested: new NestedSchema(), | ||
nestedArray: [new NestedSchema()], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
required to create instances here, otherwise class-validator doesn't know how to validate.
I didn't see any existing change sets / haven't really used them. But if you have a nightly build I can try that otherwise will need a bump. |
@decs can you please review this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
These error messages are pretty bad. Would love to see this PR get merged. |
@decs can we get this merged? |
Thanks a ton! Any chance we can get a release? |
for sure! this is out as |
I just started using this implementation of class library and noticed I was getting really horrible error messages.
Turns out it's because this line https://github.com/decs/typeschema/blob/main/packages/class-validator/src/validation.ts#L26 was using a developer helper method typestack/class-validator#26
I've added some tests to use the constrain messages. I've also flat mapped the errors so the messages are not combined (which I hope is ok but need more testing downstream in superforms).