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

Output value together with validation error #63

Open
jirutka opened this issue Aug 12, 2023 · 3 comments
Open

Output value together with validation error #63

jirutka opened this issue Aug 12, 2023 · 3 comments
Milestone

Comments

@jirutka
Copy link
Contributor

jirutka commented Aug 12, 2023

When the value of a field doesn’t pass the validation rule, I’d like to print a string representation of the value. This is supported in the validator crate, but not in garde.

Do you have an idea of how this could be ideally done?

This could also be solved by #7.

@jprochazk
Copy link
Owner

garde doesn't store or output the values anywhere for security reasons (validator#157).

I think #7 would definitely be the right solution to this. I'll add more context into that issue, because I believe there are a few important pre-requisites.

@jprochazk jprochazk mentioned this issue Sep 2, 2023
4 tasks
@jirutka
Copy link
Contributor Author

jirutka commented Sep 2, 2023

garde doesn't store or output the values anywhere for security reasons (validator#157).

This is only relevant for a small fraction of use cases and it can be easily handled by some attribute per field, e.g. #[garde(sensitive)].

@jprochazk
Copy link
Owner

This is only relevant for a small fraction of use cases

I'm not sure about that. I'd prefer to not have my validation library leak secrets by default, and require me to think about what is sensitive and what isn't.

My endgame is for garde to be able to act as the single source of truth for validation in web apps for both server and client sides, and in that case, I don't need the value to be output as part of the error, I just need the error itself to render next to the form input that already contains the invalid value.

@jprochazk jprochazk changed the title Access to a value that has failed validation in Error Output value together with validation error Sep 3, 2023
@jprochazk jprochazk modified the milestones: v0.15, v0.16 Sep 3, 2023
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

No branches or pull requests

2 participants