From d91c04608480f819263dedc8eaa4ecf707e5914e Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 24 May 2018 22:34:51 -0700 Subject: extra_json in API schema (manually) --- rust/fatcat-api/README.md | 2 +- rust/fatcat-api/api.yaml | 12 +++++++++--- rust/fatcat-api/api/swagger.yaml | 24 ++++++++++++++++++++++++ rust/fatcat-api/src/models.rs | 32 +++++++++++++++++++++++++++++++- rust/fatcat-openapi2.yml | 12 +++++++++--- 5 files changed, 74 insertions(+), 8 deletions(-) (limited to 'rust') diff --git a/rust/fatcat-api/README.md b/rust/fatcat-api/README.md index baf249ca..48c3aeeb 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-05-25T00:58:40.370Z +- Build date: 2018-05-25T05:25:40.149Z 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 1fe5c8ff..14c94f35 100644 --- a/rust/fatcat-api/api.yaml +++ b/rust/fatcat-api/api.yaml @@ -35,6 +35,9 @@ x-entity-props: &ENTITYPROPS type: integer example: 16 format: int64 + extra: + type: object + additionalProperties: {} x-entity-edit-props: &ENTITYEDITPROPS edit_id: type: integer @@ -51,6 +54,9 @@ x-entity-edit-props: &ENTITYEDITPROPS type: integer example: 16 format: int64 + extra: + type: object + additionalProperties: {} definitions: @@ -177,6 +183,9 @@ definitions: format: int64 description: type: string + extra: + type: object + additionalProperties: {} # container_edits: # type: array # item: @@ -216,9 +225,6 @@ definitions: # type: object # proposeties: # <<: *ENTITYEDITPROPS - extra: - type: object - additionalProperties: {} changelogentries: type: array items: diff --git a/rust/fatcat-api/api/swagger.yaml b/rust/fatcat-api/api/swagger.yaml index 487c0a4f..993df05c 100644 --- a/rust/fatcat-api/api/swagger.yaml +++ b/rust/fatcat-api/api/swagger.yaml @@ -1031,6 +1031,8 @@ definitions: name: type: "string" example: "Grace Hopper" + extra: + type: "object" editgroup_id: type: "integer" format: "int64" @@ -1055,6 +1057,7 @@ definitions: example: redirect: "f1f046a3-45c9-4b99-adce-000000000002" ident: "f1f046a3-45c9-4b99-adce-000000000001" + extra: "{}" name: "Grace Hopper" editgroup_id: 16 orcid: "0000-0002-1825-0097" @@ -1096,10 +1099,13 @@ definitions: type: "integer" format: "int64" example: 16 + extra: + type: "object" example: redirect: "f1f046a3-45c9-4b99-adce-000000000002" issn: "1234-5678" ident: "f1f046a3-45c9-4b99-adce-000000000001" + extra: "{}" name: "Journal of Important Results" publisher: "Society of Curious Students" editgroup_id: 16 @@ -1120,6 +1126,8 @@ definitions: type: "integer" format: "int64" example: 1048576 + extra: + type: "object" editgroup_id: type: "integer" format: "int64" @@ -1146,6 +1154,7 @@ definitions: redirect: "f1f046a3-45c9-4b99-adce-000000000002" size: 1048576 ident: "f1f046a3-45c9-4b99-adce-000000000001" + extra: "{}" editgroup_id: 16 state: "wip" url: "https://example.edu/~frau/prcding.pdf" @@ -1199,6 +1208,8 @@ definitions: type: "integer" format: "int64" example: 16 + extra: + type: "object" example: redirect: "f1f046a3-45c9-4b99-adce-000000000002" work_id: "f1f046a3-45c9-4b99-adce-000000000001" @@ -1209,6 +1220,7 @@ definitions: revision: 42 volume: "volume" pages: "pages" + extra: "{}" editgroup_id: 16 state: "wip" container_id: "f1f046a3-45c9-4b99-adce-000000000001" @@ -1219,6 +1231,8 @@ definitions: properties: work_type: type: "string" + extra: + type: "object" editgroup_id: type: "integer" format: "int64" @@ -1243,6 +1257,7 @@ definitions: example: redirect: "f1f046a3-45c9-4b99-adce-000000000002" ident: "f1f046a3-45c9-4b99-adce-000000000001" + extra: "{}" work_type: "work_type" editgroup_id: 16 state: "wip" @@ -1251,6 +1266,8 @@ definitions: entity_edit: type: "object" properties: + extra: + type: "object" editgroup_id: type: "integer" format: "int64" @@ -1268,6 +1285,7 @@ definitions: example: 847 example: ident: "f1f046a3-45c9-4b99-adce-000000000001" + extra: "{}" edit_id: 847 editgroup_id: 16 revision: 42 @@ -1347,6 +1365,9 @@ x-entity-props: type: "integer" example: 16 format: "int64" + extra: + type: "object" + additionalProperties: {} x-entity-edit-props: edit_id: type: "integer" @@ -1363,6 +1384,9 @@ x-entity-edit-props: type: "integer" example: 16 format: "int64" + extra: + type: "object" + additionalProperties: {} x-entity-responses: 400: description: "Bad Request" diff --git a/rust/fatcat-api/src/models.rs b/rust/fatcat-api/src/models.rs index 989c73f2..6c13e091 100644 --- a/rust/fatcat-api/src/models.rs +++ b/rust/fatcat-api/src/models.rs @@ -1,7 +1,7 @@ #![allow(unused_imports, unused_qualifications, unused_extern_crates)] extern crate chrono; -extern crate serde_json; extern crate uuid; +extern crate serde_json; use serde::ser::Serializer; @@ -125,6 +125,10 @@ pub struct ContainerEntity { #[serde(rename = "editgroup_id")] #[serde(skip_serializing_if = "Option::is_none")] pub editgroup_id: Option, + + #[serde(rename = "extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub extra: Option, } impl ContainerEntity { @@ -138,6 +142,7 @@ impl ContainerEntity { revision: None, redirect: None, editgroup_id: None, + extra: None, } } } @@ -151,6 +156,10 @@ pub struct CreatorEntity { #[serde(rename = "name")] pub name: String, + #[serde(rename = "extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub extra: Option, + #[serde(rename = "editgroup_id")] #[serde(skip_serializing_if = "Option::is_none")] pub editgroup_id: Option, @@ -178,6 +187,7 @@ impl CreatorEntity { CreatorEntity { orcid: None, name: name, + extra: None, editgroup_id: None, redirect: None, revision: None, @@ -230,6 +240,10 @@ impl Editor { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct EntityEdit { + #[serde(rename = "extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub extra: Option, + #[serde(rename = "editgroup_id")] #[serde(skip_serializing_if = "Option::is_none")] pub editgroup_id: Option, @@ -250,6 +264,7 @@ pub struct EntityEdit { impl EntityEdit { pub fn new() -> EntityEdit { EntityEdit { + extra: None, editgroup_id: None, revision: None, ident: None, @@ -284,6 +299,10 @@ pub struct FileEntity { #[serde(skip_serializing_if = "Option::is_none")] pub size: Option, + #[serde(rename = "extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub extra: Option, + #[serde(rename = "editgroup_id")] #[serde(skip_serializing_if = "Option::is_none")] pub editgroup_id: Option, @@ -312,6 +331,7 @@ impl FileEntity { url: None, sha1: None, size: None, + extra: None, editgroup_id: None, redirect: None, revision: None, @@ -373,6 +393,10 @@ pub struct ReleaseEntity { #[serde(rename = "editgroup_id")] #[serde(skip_serializing_if = "Option::is_none")] pub editgroup_id: Option, + + #[serde(rename = "extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub extra: Option, } impl ReleaseEntity { @@ -391,6 +415,7 @@ impl ReleaseEntity { revision: None, redirect: None, editgroup_id: None, + extra: None, } } } @@ -413,6 +438,10 @@ pub struct WorkEntity { #[serde(skip_serializing_if = "Option::is_none")] pub work_type: Option, + #[serde(rename = "extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub extra: Option, + #[serde(rename = "editgroup_id")] #[serde(skip_serializing_if = "Option::is_none")] pub editgroup_id: Option, @@ -439,6 +468,7 @@ impl WorkEntity { pub fn new() -> WorkEntity { WorkEntity { work_type: None, + extra: None, editgroup_id: None, redirect: None, revision: None, diff --git a/rust/fatcat-openapi2.yml b/rust/fatcat-openapi2.yml index 1fe5c8ff..14c94f35 100644 --- a/rust/fatcat-openapi2.yml +++ b/rust/fatcat-openapi2.yml @@ -35,6 +35,9 @@ x-entity-props: &ENTITYPROPS type: integer example: 16 format: int64 + extra: + type: object + additionalProperties: {} x-entity-edit-props: &ENTITYEDITPROPS edit_id: type: integer @@ -51,6 +54,9 @@ x-entity-edit-props: &ENTITYEDITPROPS type: integer example: 16 format: int64 + extra: + type: object + additionalProperties: {} definitions: @@ -177,6 +183,9 @@ definitions: format: int64 description: type: string + extra: + type: object + additionalProperties: {} # container_edits: # type: array # item: @@ -216,9 +225,6 @@ definitions: # type: object # proposeties: # <<: *ENTITYEDITPROPS - extra: - type: object - additionalProperties: {} changelogentries: type: array items: -- cgit v1.2.3