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

types(schema): support required: { isRequired: true } syntax in schema definition #13680

Merged
merged 3 commits into from Aug 3, 2023

Conversation

vkarpov15
Copy link
Collaborator

Re: #13514

Summary

One potential workaround for #13514 is using object syntax for defining required, because the following works fine:

new Schema({
  email: {
    type: String,
    required: { isRequired: true, message: 'Email is required' }
  }
});

But we don't currently support that in TypeScript. This PR adds support for the required: { isRequired: true } syntax. Unfortunately doesn't help very much with #13514.

Examples

@vkarpov15 vkarpov15 requested a review from hasezoey August 1, 2023 14:30
Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

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

Change looks good to me, but the test not really

test/types/schema.test.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@IslandRhythms IslandRhythms left a comment

Choose a reason for hiding this comment

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

LGTM

@vkarpov15 vkarpov15 added this to the 7.4.3 milestone Aug 3, 2023
@vkarpov15 vkarpov15 merged commit 570be58 into master Aug 3, 2023
3 checks passed
@hasezoey hasezoey deleted the vkarpov15/gh-13514 branch August 4, 2023 08:48
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.

None yet

3 participants