Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Declarative validators (zod, yup, etc) #2406

ntucker started this conversation in Ideas
Discussion options

https://github.com/jquense/yup

class User extends YupEntity(
 object({
 name: string().required(),
 lastName: string().required(),
 age: number().required().positive().integer(),
 email: string().email(),
 website: string().url().nullable(),
 createdOn: date().default(() => new Date()),
 })) {
 pk() {return this.id}
 get fullName() {
 return `${this.name} ${this.lastName}`;
 }
}

Use the lifecycle integration of Entity.validate

Perhaps we should provide an abstract interface, so any third-party validator could be hooked up in the same way. If their APIs are too different, we could simply ship adapters as well

You must be logged in to vote

Replies: 1 comment

Comment options

ntucker
Feb 23, 2023
Maintainer Author

https://github.com/samchon/typia is much faster; look into using this

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /