diff options
author | Philipp Korber <p.korber@1aim.com> | 2018-11-20 17:05:50 +0100 |
---|---|---|
committer | Philipp Korber <p.korber@1aim.com> | 2018-11-20 17:11:33 +0100 |
commit | 3edb27a69d928df5077cd8e0cf6f9f05278a1a7c (patch) | |
tree | e3051c0d8bb13f94b9c5a38a553b65c5f15cb12f | |
parent | d621d9b15ae64ddbb7bff4662c3f5086eab8ec0b (diff) |
chore(serde) added some serde attributes to Source/Metadata
-rw-r--r-- | core/src/resource/data.rs | 1 | ||||
-rw-r--r-- | core/src/resource/source.rs | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/core/src/resource/data.rs b/core/src/resource/data.rs index 8e2d0eb..5affa59 100644 --- a/core/src/resource/data.rs +++ b/core/src/resource/data.rs @@ -41,6 +41,7 @@ use headers::header_components::{ #[cfg_attr(feature="serde", derive(Serialize, Deserialize))] pub struct Metadata { /// File meta like file name or file read time. + #[cfg_attr(feature="serde", serde(flatten))] pub file_meta: FileMeta, /// The media type of the data. diff --git a/core/src/resource/source.rs b/core/src/resource/source.rs index 4cbc248..2184871 100644 --- a/core/src/resource/source.rs +++ b/core/src/resource/source.rs @@ -24,6 +24,7 @@ pub struct Source { pub iri: IRI, /// Allows specifying how the media type detection is done. + #[cfg_attr(feature="serde", serde(default))] pub use_media_type: UseMediaType, /// Allows providing a explicit name overriding any inferred name. @@ -37,6 +38,7 @@ pub struct Source { /// Note that file names are optional and don't need to be provided at all. /// But it is strongly recommended to provide them for anything used as /// attachment but normally irrelevant for anything else. + #[cfg_attr(feature="serde", serde(default))] pub use_file_name: Option<String> } |