-
Notifications
You must be signed in to change notification settings - Fork 1
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
Update Priority
de/serialization
#11
Conversation
Seems that doesn't work anymore, probably the JSON payload must contain the priority as number. |
I also just checked, what is used for the JSON (de-)serializer: |
The ntfy server return error 400 when sending the priority as string |
Yeah, the message format seems to specify an integer: https://docs.ntfy.sh/subscribe/api/#json-message-format |
Then maybe just allow strings in the deserializer, as I mentioned here and "force" u8 for serialization. EDIT: I just realized that would still be a problem sometimes. Even if you won't keep the string in the (de-)serialization, having the as_str and from_str is still useful. I'll check how this works with serde attributes. EDIT2: I also just remembered why this was a bigger problem. I have the Priorities in a hash map, so I can't directly use the attribute to specify a custom (de-)serialization function without replacing the one used for the hash map itself. |
Signed-off-by: Yuki Kishimoto <[email protected]>
Signed-off-by: Yuki Kishimoto <[email protected]>
Support both deserialization from `u8` and `String`. Signed-off-by: Yuki Kishimoto <[email protected]>
@JoeJoeTV, now the |
Alright, thanks, nice, I'll try this with my usecase. |
@yukibtc This seems to work well! Thanks! |
@JoeJoeTV I think we are ready for v0.7, right? |
Yes, I would say so. |
@JoeJoeTV, I've just released v0.7 |
De/serialize
Priority
from/to string if the form is human-readable, otherwise tou8
.