Skip to content

Conversation

@simonedelmann
Copy link
Contributor

As discussed in Discord:

Zod has built-in string transformations .trim() / .toUpperCase() / .toLowerCase()

This PR adds data validation attributes @trim / @upper / @lower to ZModel:

model User {
    // ...
    name String @length(min: 1) @trim
    slug String @lower
    heroText String @upper
}

@simonedelmann simonedelmann marked this pull request as ready for review February 2, 2024 13:45
@ymc9 ymc9 changed the base branch from main to dev February 3, 2024 08:35
@ymc9
Copy link
Member

ymc9 commented Feb 3, 2024

Thank you for working on it @simonedelmann ! I'm merging it to dev and will include it in the next release (around 2/15). I'll also check if more changes are needed to make it effective for Prisma create/update operations.

@ymc9 ymc9 merged commit dde1931 into zenstackhq:dev Feb 3, 2024
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.

2 participants