-
Notifications
You must be signed in to change notification settings - Fork 0
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
move name validation to route deserialization #253
base: main
Are you sure you want to change the base?
Conversation
simplified name types implementation of validate. added new trait functions. I wouldn't say its better, just different
refac Names to original/ update project/groups/roles to use name deserial validation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @samankittani ! Nice work.
I added one comment about how we should be able to simplify the implementation of the different name validation. Otherwise, looks good!
} | ||
|
||
#[derive(Clone, Debug, PartialEq, Eq, TS)] | ||
pub struct Name<T: Validate>(String, std::marker::PhantomData<T>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we re-using this struct for all the different types of names rather than creating completely different versions for each (ie, struct GroupName
rather than type GroupName = ..
)? Is it just for code re-use?
If so, I am concerned that this approach introduces complexity that doesn't buy us much. For example, we could impl Validate
for each of the GroupName
, etc, structs (as opposed to type aliases) then define a blanket implementation for all structs that implement Validate
.
this pr moves name validation to serde deserialization step