Skip to content
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

Merged
merged 1 commit into from
Oct 13, 2024

Conversation

niemyjski
Copy link
Contributor

I just started using this implementation of class library and noticed I was getting really horrible error messages.

image

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).

Copy link

changeset-bot bot commented Sep 18, 2024

⚠️ No Changeset found

Latest commit: 7905cb7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -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;
Copy link
Contributor Author

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

Comment on lines 80 to 81
nested: new NestedSchema(),
nestedArray: [new NestedSchema()],
Copy link
Contributor Author

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.

@niemyjski
Copy link
Contributor Author

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.

@niemyjski
Copy link
Contributor Author

@decs can you please review this.

Copy link
Contributor Author

@niemyjski niemyjski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@ejsmith
Copy link

ejsmith commented Sep 25, 2024

These error messages are pretty bad. Would love to see this PR get merged.

@niemyjski
Copy link
Contributor Author

@decs can we get this merged?

@decs decs merged commit 0f28135 into decs:main Oct 13, 2024
@niemyjski
Copy link
Contributor Author

Thanks a ton! Any chance we can get a release?

@decs
Copy link
Owner

decs commented Oct 14, 2024

for sure! this is out as @typeschema/class-validator v0.3.0
thanks for the fix, @niemyjski!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants