Replies: 2 comments
-
|
Nevermind, I can just derive FromStr, sorry! |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
@gregouar Sorry for a very delayed feedback. In fact, one of the motivation to started nutype, was when I was building UI with seed-rs, I wanted to implement validation once and reuse it both frontend and backend. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm experimenting using nutype to create shared types between my backend (axum) and frontend (leptos). I work really nicely with serde and the json request/response pattern.
However, I would like to push it a bit further and also use these nutype to dynamically validate user inputs on frontend side and give immediate feedback. For this, I wanted to create a custom generic Leptos component, but it seems we are missing a trait that simply say my struct implement try_new.
My current workaround is to request being deserializable and leverage serde_plain. It works quite well, except that now in addition to the nice nutype error, the error message contains an additional " Expected valid XXX". I can trim that part as post ops, but this feels very hacky:
Beta Was this translation helpful? Give feedback.
All reactions