We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
On my domain layer I usually adapt controller inputs into aggregate/entities/value object/etc
I do have a schema that ensure every entity props to match the desired type. Lets say
const schema = { isActive: z.boolean(), auth: z.instanceOf(Authentication), profile: instanceOf(Profile), email: z.string() } export interface UserProps { isActive: boolean auth: Authentication profile: Profile email: string //... } export class User extends Entity<User> { static schema = schema } const user = new User({ isActive: true, profile: new Profile({...}), email: 'whatever@gmail.com', ... })
When I do construct an entity object, it auto runs an type validation based on schema checking if props match schema.
How hard is to just pass an interface and validation be done? Without an schema, pure interface.
If an primitive was provided, check if matchs If an class was provided, check by instanceof
Thanks in advance
The text was updated successfully, but these errors were encountered:
You can use below typia functions:
typia
typia.is<T>() function auto-casts to the T type when valid. typia.assertGuard<T>() function auto-casts when no type error.
typia.is<T>()
T
typia.assertGuard<T>()
Related documents:
Sorry, something went wrong.
samchon
No branches or pull requests
On my domain layer I usually adapt controller inputs into aggregate/entities/value object/etc
I do have a schema that ensure every entity props to match the desired type. Lets say
When I do construct an entity object, it auto runs an type validation based on schema checking if props match schema.
Question
How hard is to just pass an interface and validation be done? Without an schema, pure interface.
If an primitive was provided, check if matchs
If an class was provided, check by instanceof
Thanks in advance
The text was updated successfully, but these errors were encountered: