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

move name validation to route deserialization #253

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

samankittani
Copy link

this pr moves name validation to serde deserialization step

@samankittani samankittani self-assigned this Jun 16, 2024
Copy link
Collaborator

@brollb brollb left a 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>);
Copy link
Collaborator

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.

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

2 participants