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

Deserialize from string by default #847

Open
baszalmstra opened this issue Sep 5, 2024 · 0 comments
Open

Deserialize from string by default #847

baszalmstra opened this issue Sep 5, 2024 · 0 comments
Labels
good first issue Good for newcomers

Comments

@baszalmstra
Copy link
Collaborator

We often write code like this:

#[serde_as(as = "Vec<DisplayFromStr>")]
pub constrains: Vec<MatchSpec>,

This is because the default serde implementation serializes all the fields. However, I think its more common to serialize matchspec as a string then to serialize the individual fields. I would therefor propose that we serialize and deserialize matchspecs as strings instead.

This is also the case for NamelessMatchSpec and Version and possibly some other types.

@baszalmstra baszalmstra added the good first issue Good for newcomers label Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant