diff options
author | Cyborus <cyborus@cyborus.xyz> | 2024-01-19 00:10:05 +0100 |
---|---|---|
committer | Cyborus <cyborus@cyborus.xyz> | 2024-01-19 00:10:05 +0100 |
commit | 194a1b5e36bd3f7a23953c86be804648a0a9e5b4 (patch) | |
tree | c4ba8544cbcf7238d4e7e5832960466271a3a21f /generator | |
parent | add trailing slash to api prefix (diff) | |
download | forgejo-api-194a1b5e36bd3f7a23953c86be804648a0a9e5b4.tar.xz forgejo-api-194a1b5e36bd3f7a23953c86be804648a0a9e5b4.zip |
handle datetime (de)serialization
Diffstat (limited to 'generator')
-rw-r--r-- | generator/src/main.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/generator/src/main.rs b/generator/src/main.rs index 0286bf7..9bd1ea3 100644 --- a/generator/src/main.rs +++ b/generator/src/main.rs @@ -728,6 +728,12 @@ fn create_struct_for_definition( if field_ty == "Option<url::Url>" { fields.push_str("#[serde(deserialize_with = \"crate::none_if_blank_url\")]\n"); } + if field_ty == "time::OffsetDateTime" { + fields.push_str("#[serde(with = \"time::serde::rfc3339\")]\n"); + } + if field_ty == "Option<time::OffsetDateTime>" { + fields.push_str("#[serde(with = \"time::serde::rfc3339::option\")]\n"); + } if &field_name != prop_name { fields.push_str("#[serde(rename = \""); fields.push_str(prop_name); |