diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-15 21:17:09 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-15 21:17:09 -0700 |
commit | 0ed087be71b02d9279bd3b131131eae672580d71 (patch) | |
tree | da4bc59d4db19ae466c86992c1e625bf0797584e /rust/fatcat-api/src/models.rs | |
parent | 9036469324912eae3eed8cb8645f91f1a68c5857 (diff) | |
download | fatcat-0ed087be71b02d9279bd3b131131eae672580d71.tar.gz fatcat-0ed087be71b02d9279bd3b131131eae672580d71.zip |
tweak openapi schema
Diffstat (limited to 'rust/fatcat-api/src/models.rs')
-rw-r--r-- | rust/fatcat-api/src/models.rs | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/rust/fatcat-api/src/models.rs b/rust/fatcat-api/src/models.rs index 5e5be35f..b6f450aa 100644 --- a/rust/fatcat-api/src/models.rs +++ b/rust/fatcat-api/src/models.rs @@ -47,8 +47,7 @@ pub struct ContainerEntity { pub parent: Option<String>, #[serde(rename = "name")] - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option<String>, + pub name: String, // Note: inline enums are not fully supported by swagger-codegen #[serde(rename = "state")] @@ -73,12 +72,12 @@ pub struct ContainerEntity { } impl ContainerEntity { - pub fn new() -> ContainerEntity { + pub fn new(name: String) -> ContainerEntity { ContainerEntity { issn: None, publisher: None, parent: None, - name: None, + name: name, state: None, ident: None, revision: None, @@ -95,8 +94,7 @@ pub struct CreatorEntity { pub orcid: Option<String>, #[serde(rename = "name")] - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option<String>, + pub name: String, #[serde(rename = "editgroup")] #[serde(skip_serializing_if = "Option::is_none")] @@ -121,10 +119,10 @@ pub struct CreatorEntity { } impl CreatorEntity { - pub fn new() -> CreatorEntity { + pub fn new(name: String) -> CreatorEntity { CreatorEntity { orcid: None, - name: None, + name: name, editgroup: None, redirect: None, revision: None, @@ -137,15 +135,16 @@ impl CreatorEntity { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Editgroup { #[serde(rename = "id")] - pub id: isize, + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option<isize>, #[serde(rename = "editor_id")] pub editor_id: isize, } impl Editgroup { - pub fn new(id: isize, editor_id: isize) -> Editgroup { - Editgroup { id: id, editor_id: editor_id } + pub fn new(editor_id: isize) -> Editgroup { + Editgroup { id: None, editor_id: editor_id } } } @@ -175,9 +174,9 @@ pub struct EntityEdit { #[serde(skip_serializing_if = "Option::is_none")] pub ident: Option<String>, - #[serde(rename = "id")] + #[serde(rename = "edit_id")] #[serde(skip_serializing_if = "Option::is_none")] - pub id: Option<isize>, + pub edit_id: Option<isize>, } impl EntityEdit { @@ -186,7 +185,7 @@ impl EntityEdit { editgroup_id: None, revision: None, ident: None, - id: None, + edit_id: None, } } } @@ -348,10 +347,6 @@ pub struct WorkEntity { #[serde(skip_serializing_if = "Option::is_none")] pub work_type: Option<String>, - #[serde(rename = "title")] - #[serde(skip_serializing_if = "Option::is_none")] - pub title: Option<String>, - #[serde(rename = "editgroup")] #[serde(skip_serializing_if = "Option::is_none")] pub editgroup: Option<isize>, @@ -378,7 +373,6 @@ impl WorkEntity { pub fn new() -> WorkEntity { WorkEntity { work_type: None, - title: None, editgroup: None, redirect: None, revision: None, |