From f30e45c3eae4371cc5f1bee030791187a173c284 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 28 Jun 2018 12:08:32 -0700 Subject: make release_rev.work_id optional in openapi spec This is to enable auto-creation of works, speeding up bulk insertion. --- rust/fatcat-api/README.md | 2 +- rust/fatcat-api/api.yaml | 1 - rust/fatcat-api/api/swagger.yaml | 1 - rust/fatcat-api/src/models.rs | 7 ++++--- 4 files changed, 5 insertions(+), 6 deletions(-) (limited to 'rust') diff --git a/rust/fatcat-api/README.md b/rust/fatcat-api/README.md index 572bcbc5..fe725d7f 100644 --- a/rust/fatcat-api/README.md +++ b/rust/fatcat-api/README.md @@ -13,7 +13,7 @@ To see how to make this your own, look here: [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) - API version: 0.1.0 -- Build date: 2018-06-21T18:49:41.205Z +- Build date: 2018-06-28T19:08:07.508Z This autogenerated project defines an API crate `fatcat` which contains: * An `Api` trait defining the API in Rust. diff --git a/rust/fatcat-api/api.yaml b/rust/fatcat-api/api.yaml index 2326f225..eba6b63c 100644 --- a/rust/fatcat-api/api.yaml +++ b/rust/fatcat-api/api.yaml @@ -129,7 +129,6 @@ definitions: type: object required: - title - - work_id properties: <<: *ENTITYPROPS title: diff --git a/rust/fatcat-api/api/swagger.yaml b/rust/fatcat-api/api/swagger.yaml index 1a719322..8a328822 100644 --- a/rust/fatcat-api/api/swagger.yaml +++ b/rust/fatcat-api/api/swagger.yaml @@ -1710,7 +1710,6 @@ definitions: type: "object" required: - "title" - - "work_id" properties: refs: type: "array" diff --git a/rust/fatcat-api/src/models.rs b/rust/fatcat-api/src/models.rs index fd9e8658..60330392 100644 --- a/rust/fatcat-api/src/models.rs +++ b/rust/fatcat-api/src/models.rs @@ -509,7 +509,8 @@ pub struct ReleaseEntity { pub container_id: Option, #[serde(rename = "work_id")] - pub work_id: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub work_id: Option, #[serde(rename = "title")] pub title: String, @@ -541,7 +542,7 @@ pub struct ReleaseEntity { } impl ReleaseEntity { - pub fn new(work_id: String, title: String) -> ReleaseEntity { + pub fn new(title: String) -> ReleaseEntity { ReleaseEntity { refs: None, contribs: None, @@ -556,7 +557,7 @@ impl ReleaseEntity { release_status: None, release_type: None, container_id: None, - work_id: work_id, + work_id: None, title: title, state: None, ident: None, -- cgit v1.2.3