Use chrono::Duration directly with serde attributes

This commit is contained in:
philippeitis
2022-10-07 20:34:40 -07:00
parent 444b610ddc
commit 05df68de32
2 changed files with 73 additions and 75 deletions

View File

@@ -19,6 +19,8 @@ ${struct} {
% endif
% if p.get("format", None) == "byte":
#[serde(serialize_with = "client::types::to_urlsafe_base64", deserialize_with = "client::types::from_urlsafe_base64")]
% elif p.get("format", None) == "google-duration":
#[serde(serialize_with = "client::types::to_duration_str", deserialize_with = "client::types::from_duration_str")]
% endif
pub ${mangle_ident(pn)}: ${to_rust_type(schemas, s.id, pn, p, allow_optionals=allow_optionals)},
% endfor