summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-27 14:45:07 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-27 14:45:18 -0700
commit19eb1641eece9f03ca193417cdf244efc1a9da8a (patch)
tree78545c8e2117bcb0b46680de10d9a49b8f01d75f
parent29e02c4321762e9c0efcbd2129885ff0af661b34 (diff)
downloadfatcat-19eb1641eece9f03ca193417cdf244efc1a9da8a.tar.gz
fatcat-19eb1641eece9f03ca193417cdf244efc1a9da8a.zip
swagger spec: body -> entity
-rw-r--r--rust/fatcat-api/README.md2
-rw-r--r--rust/fatcat-api/api.yaml76
-rw-r--r--rust/fatcat-api/api/swagger.yaml96
-rw-r--r--rust/fatcat-api/examples/server_lib/server.rs24
-rw-r--r--rust/fatcat-api/src/client.rs24
-rw-r--r--rust/fatcat-api/src/lib.rs48
-rw-r--r--rust/fatcat-api/src/models.rs38
-rw-r--r--rust/fatcat-api/src/server.rs128
-rw-r--r--rust/fatcat-openapi2.yml76
-rw-r--r--rust/src/api_server.rs94
10 files changed, 310 insertions, 296 deletions
diff --git a/rust/fatcat-api/README.md b/rust/fatcat-api/README.md
index 1c409076..99162994 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-27T00:04:18.431Z
+- Build date: 2018-05-27T21:43:16.246Z
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 585932b3..f1b94234 100644
--- a/rust/fatcat-api/api.yaml
+++ b/rust/fatcat-api/api.yaml
@@ -38,29 +38,6 @@ x-entity-props: &ENTITYPROPS
extra:
type: object
additionalProperties: {}
-x-entity-edit-props: &ENTITYEDITPROPS
- edit_id:
- type: integer
- example: 847
- format: int64
- ident:
- type: string
- example: "f1f046a3-45c9-4b99-adce-000000000001"
- revision:
- type: integer
- example: 42
- format: int64
- redirect_ident:
- type: string
- example: "f1f046a3-45c9-4b99-adce-000000000002"
- #format: uuid
- editgroup_id:
- type: integer
- example: 16
- format: int64
- extra:
- type: object
- additionalProperties: {}
definitions:
@@ -196,7 +173,28 @@ definitions:
- ident
- editgroup_id
properties:
- <<: *ENTITYEDITPROPS
+ edit_id:
+ type: integer
+ example: 847
+ format: int64
+ ident:
+ type: string
+ example: "f1f046a3-45c9-4b99-adce-000000000001"
+ revision:
+ type: integer
+ example: 42
+ format: int64
+ redirect_ident:
+ type: string
+ example: "f1f046a3-45c9-4b99-adce-000000000002"
+ #format: uuid
+ editgroup_id:
+ type: integer
+ example: 16
+ format: int64
+ extra:
+ type: object
+ additionalProperties: {}
editor:
type: object
required:
@@ -305,7 +303,7 @@ paths:
/creator:
post:
parameters:
- - name: body
+ - name: entity
in: body
required: true
schema:
@@ -316,6 +314,24 @@ paths:
schema:
$ref: "#/definitions/entity_edit"
<<: *ENTITYRESPONSES
+# /creator/batch:
+# post:
+# parameters:
+# - name: entity_list
+# in: body
+# required: true
+# schema:
+# type: array
+# items:
+# $ref: "#/definitions/creator_entity"
+# responses:
+# 201:
+# description: Created Entities
+# schema:
+# type: array
+# items:
+# $ref: "#/definitions/entity_edit"
+# <<: *ENTITYRESPONSES
/creator/{id}:
parameters:
- name: id
@@ -345,7 +361,7 @@ paths:
/container:
post:
parameters:
- - name: body
+ - name: entity
in: body
required: true
schema:
@@ -385,7 +401,7 @@ paths:
/file:
post:
parameters:
- - name: body
+ - name: entity
in: body
required: true
schema:
@@ -425,7 +441,7 @@ paths:
/release:
post:
parameters:
- - name: body
+ - name: entity
in: body
required: true
schema:
@@ -465,7 +481,7 @@ paths:
/work:
post:
parameters:
- - name: body
+ - name: entity
in: body
required: true
schema:
@@ -532,7 +548,7 @@ paths:
/editgroup:
post:
parameters:
- - name: body
+ - name: entity
in: body
required: true
schema:
diff --git a/rust/fatcat-api/api/swagger.yaml b/rust/fatcat-api/api/swagger.yaml
index e6b4b356..d9c03d42 100644
--- a/rust/fatcat-api/api/swagger.yaml
+++ b/rust/fatcat-api/api/swagger.yaml
@@ -17,7 +17,7 @@ paths:
post:
parameters:
- in: "body"
- name: "body"
+ name: "entity"
required: true
schema:
$ref: "#/definitions/creator_entity"
@@ -177,7 +177,7 @@ paths:
post:
parameters:
- in: "body"
- name: "body"
+ name: "entity"
required: true
schema:
$ref: "#/definitions/container_entity"
@@ -337,7 +337,7 @@ paths:
post:
parameters:
- in: "body"
- name: "body"
+ name: "entity"
required: true
schema:
$ref: "#/definitions/file_entity"
@@ -497,7 +497,7 @@ paths:
post:
parameters:
- in: "body"
- name: "body"
+ name: "entity"
required: true
schema:
$ref: "#/definitions/release_entity"
@@ -657,7 +657,7 @@ paths:
post:
parameters:
- in: "body"
- name: "body"
+ name: "entity"
required: true
schema:
$ref: "#/definitions/work_entity"
@@ -850,7 +850,7 @@ paths:
post:
parameters:
- in: "body"
- name: "body"
+ name: "entity"
required: true
schema:
$ref: "#/definitions/editgroup"
@@ -1321,30 +1321,30 @@ definitions:
- "editgroup_id"
- "ident"
properties:
- extra:
- type: "object"
- editgroup_id:
+ edit_id:
type: "integer"
format: "int64"
- example: 16
- redirect_ident:
+ example: 847
+ ident:
type: "string"
- example: "f1f046a3-45c9-4b99-adce-000000000002"
+ example: "f1f046a3-45c9-4b99-adce-000000000001"
revision:
type: "integer"
format: "int64"
example: 42
- ident:
+ redirect_ident:
type: "string"
- example: "f1f046a3-45c9-4b99-adce-000000000001"
- edit_id:
+ example: "f1f046a3-45c9-4b99-adce-000000000002"
+ editgroup_id:
type: "integer"
format: "int64"
- example: 847
+ example: 16
+ extra:
+ type: "object"
example:
ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
@@ -1382,66 +1382,66 @@ definitions:
edits:
works:
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
creators:
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
files:
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
containers:
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
releases:
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
@@ -1512,66 +1512,66 @@ definitions:
example:
works:
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
creators:
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
files:
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
containers:
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
releases:
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
@@ -1617,28 +1617,6 @@ x-entity-props:
extra:
type: "object"
additionalProperties: {}
-x-entity-edit-props:
- edit_id:
- type: "integer"
- example: 847
- format: "int64"
- ident:
- type: "string"
- example: "f1f046a3-45c9-4b99-adce-000000000001"
- revision:
- type: "integer"
- example: 42
- format: "int64"
- redirect_ident:
- type: "string"
- example: "f1f046a3-45c9-4b99-adce-000000000002"
- editgroup_id:
- type: "integer"
- example: 16
- format: "int64"
- extra:
- type: "object"
- additionalProperties: {}
x-entity-responses:
400:
description: "Bad Request"
diff --git a/rust/fatcat-api/examples/server_lib/server.rs b/rust/fatcat-api/examples/server_lib/server.rs
index a28b9c72..4ea73046 100644
--- a/rust/fatcat-api/examples/server_lib/server.rs
+++ b/rust/fatcat-api/examples/server_lib/server.rs
@@ -30,9 +30,9 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn container_post(&self, body: models::ContainerEntity, context: &Context) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send> {
+ fn container_post(&self, entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("container_post({:?}) - X-Span-ID: {:?}", body, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("container_post({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
@@ -48,9 +48,9 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn creator_post(&self, body: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send> {
+ fn creator_post(&self, entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("creator_post({:?}) - X-Span-ID: {:?}", body, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("creator_post({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
@@ -66,9 +66,9 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn editgroup_post(&self, body: models::Editgroup, context: &Context) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send> {
+ fn editgroup_post(&self, entity: models::Editgroup, context: &Context) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("editgroup_post({:?}) - X-Span-ID: {:?}", body, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("editgroup_post({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
@@ -100,9 +100,9 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn file_post(&self, body: models::FileEntity, context: &Context) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send> {
+ fn file_post(&self, entity: models::FileEntity, context: &Context) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("file_post({:?}) - X-Span-ID: {:?}", body, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("file_post({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
@@ -118,9 +118,9 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn release_post(&self, body: models::ReleaseEntity, context: &Context) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send> {
+ fn release_post(&self, entity: models::ReleaseEntity, context: &Context) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("release_post({:?}) - X-Span-ID: {:?}", body, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("release_post({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
@@ -130,9 +130,9 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn work_post(&self, body: models::WorkEntity, context: &Context) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send> {
+ fn work_post(&self, entity: models::WorkEntity, context: &Context) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("work_post({:?}) - X-Span-ID: {:?}", body, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("work_post({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
}
diff --git a/rust/fatcat-api/src/client.rs b/rust/fatcat-api/src/client.rs
index 23f6dd21..d81d251f 100644
--- a/rust/fatcat-api/src/client.rs
+++ b/rust/fatcat-api/src/client.rs
@@ -284,10 +284,10 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn container_post(&self, param_body: models::ContainerEntity, context: &Context) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send> {
+ fn container_post(&self, param_entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send> {
let url = format!("{}/v0/container", self.base_path);
- let body = serde_json::to_string(&param_body).expect("impossible to fail to serialize");
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Post, &url);
@@ -472,10 +472,10 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn creator_post(&self, param_body: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send> {
+ fn creator_post(&self, param_entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send> {
let url = format!("{}/v0/creator", self.base_path);
- let body = serde_json::to_string(&param_body).expect("impossible to fail to serialize");
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Post, &url);
@@ -657,10 +657,10 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn editgroup_post(&self, param_body: models::Editgroup, context: &Context) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send> {
+ fn editgroup_post(&self, param_entity: models::Editgroup, context: &Context) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send> {
let url = format!("{}/v0/editgroup", self.base_path);
- let body = serde_json::to_string(&param_body).expect("impossible to fail to serialize");
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Post, &url);
@@ -952,10 +952,10 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn file_post(&self, param_body: models::FileEntity, context: &Context) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send> {
+ fn file_post(&self, param_entity: models::FileEntity, context: &Context) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send> {
let url = format!("{}/v0/file", self.base_path);
- let body = serde_json::to_string(&param_body).expect("impossible to fail to serialize");
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Post, &url);
@@ -1140,10 +1140,10 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn release_post(&self, param_body: models::ReleaseEntity, context: &Context) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send> {
+ fn release_post(&self, param_entity: models::ReleaseEntity, context: &Context) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send> {
let url = format!("{}/v0/release", self.base_path);
- let body = serde_json::to_string(&param_body).expect("impossible to fail to serialize");
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Post, &url);
@@ -1265,10 +1265,10 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn work_post(&self, param_body: models::WorkEntity, context: &Context) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send> {
+ fn work_post(&self, param_entity: models::WorkEntity, context: &Context) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send> {
let url = format!("{}/v0/work", self.base_path);
- let body = serde_json::to_string(&param_body).expect("impossible to fail to serialize");
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Post, &url);
diff --git a/rust/fatcat-api/src/lib.rs b/rust/fatcat-api/src/lib.rs
index a21a0751..dca1aa35 100644
--- a/rust/fatcat-api/src/lib.rs
+++ b/rust/fatcat-api/src/lib.rs
@@ -260,19 +260,19 @@ pub trait Api {
fn container_lookup_get(&self, issnl: String, context: &Context) -> Box<Future<Item = ContainerLookupGetResponse, Error = ApiError> + Send>;
- fn container_post(&self, body: models::ContainerEntity, context: &Context) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send>;
+ fn container_post(&self, entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send>;
fn creator_id_get(&self, id: String, context: &Context) -> Box<Future<Item = CreatorIdGetResponse, Error = ApiError> + Send>;
fn creator_lookup_get(&self, orcid: String, context: &Context) -> Box<Future<Item = CreatorLookupGetResponse, Error = ApiError> + Send>;
- fn creator_post(&self, body: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send>;
+ fn creator_post(&self, entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send>;
fn editgroup_id_accept_post(&self, id: i64, context: &Context) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send>;
fn editgroup_id_get(&self, id: i64, context: &Context) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send>;
- fn editgroup_post(&self, body: models::Editgroup, context: &Context) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send>;
+ fn editgroup_post(&self, entity: models::Editgroup, context: &Context) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send>;
fn editor_username_changelog_get(&self, username: String, context: &Context) -> Box<Future<Item = EditorUsernameChangelogGetResponse, Error = ApiError> + Send>;
@@ -282,17 +282,17 @@ pub trait Api {
fn file_lookup_get(&self, sha1: String, context: &Context) -> Box<Future<Item = FileLookupGetResponse, Error = ApiError> + Send>;
- fn file_post(&self, body: models::FileEntity, context: &Context) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send>;
+ fn file_post(&self, entity: models::FileEntity, context: &Context) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send>;
fn release_id_get(&self, id: String, context: &Context) -> Box<Future<Item = ReleaseIdGetResponse, Error = ApiError> + Send>;
fn release_lookup_get(&self, doi: String, context: &Context) -> Box<Future<Item = ReleaseLookupGetResponse, Error = ApiError> + Send>;
- fn release_post(&self, body: models::ReleaseEntity, context: &Context) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send>;
+ fn release_post(&self, entity: models::ReleaseEntity, context: &Context) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send>;
fn work_id_get(&self, id: String, context: &Context) -> Box<Future<Item = WorkIdGetResponse, Error = ApiError> + Send>;
- fn work_post(&self, body: models::WorkEntity, context: &Context) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send>;
+ fn work_post(&self, entity: models::WorkEntity, context: &Context) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send>;
}
/// API without a `Context`
@@ -301,19 +301,19 @@ pub trait ApiNoContext {
fn container_lookup_get(&self, issnl: String) -> Box<Future<Item = ContainerLookupGetResponse, Error = ApiError> + Send>;
- fn container_post(&self, body: models::ContainerEntity) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send>;
+ fn container_post(&self, entity: models::ContainerEntity) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send>;
fn creator_id_get(&self, id: String) -> Box<Future<Item = CreatorIdGetResponse, Error = ApiError> + Send>;
fn creator_lookup_get(&self, orcid: String) -> Box<Future<Item = CreatorLookupGetResponse, Error = ApiError> + Send>;
- fn creator_post(&self, body: models::CreatorEntity) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send>;
+ fn creator_post(&self, entity: models::CreatorEntity) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send>;
fn editgroup_id_accept_post(&self, id: i64) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send>;
fn editgroup_id_get(&self, id: i64) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send>;
- fn editgroup_post(&self, body: models::Editgroup) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send>;
+ fn editgroup_post(&self, entity: models::Editgroup) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send>;
fn editor_username_changelog_get(&self, username: String) -> Box<Future<Item = EditorUsernameChangelogGetResponse, Error = ApiError> + Send>;
@@ -323,17 +323,17 @@ pub trait ApiNoContext {
fn file_lookup_get(&self, sha1: String) -> Box<Future<Item = FileLookupGetResponse, Error = ApiError> + Send>;
- fn file_post(&self, body: models::FileEntity) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send>;
+ fn file_post(&self, entity: models::FileEntity) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send>;
fn release_id_get(&self, id: String) -> Box<Future<Item = ReleaseIdGetResponse, Error = ApiError> + Send>;
fn release_lookup_get(&self, doi: String) -> Box<Future<Item = ReleaseLookupGetResponse, Error = ApiError> + Send>;
- fn release_post(&self, body: models::ReleaseEntity) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send>;
+ fn release_post(&self, entity: models::ReleaseEntity) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send>;
fn work_id_get(&self, id: String) -> Box<Future<Item = WorkIdGetResponse, Error = ApiError> + Send>;
- fn work_post(&self, body: models::WorkEntity) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send>;
+ fn work_post(&self, entity: models::WorkEntity) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send>;
}
/// Trait to extend an API to make it easy to bind it to a context.
@@ -360,8 +360,8 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().container_lookup_get(issnl, &self.context())
}
- fn container_post(&self, body: models::ContainerEntity) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send> {
- self.api().container_post(body, &self.context())
+ fn container_post(&self, entity: models::ContainerEntity) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send> {
+ self.api().container_post(entity, &self.context())
}
fn creator_id_get(&self, id: String) -> Box<Future<Item = CreatorIdGetResponse, Error = ApiError> + Send> {
@@ -372,8 +372,8 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().creator_lookup_get(orcid, &self.context())
}
- fn creator_post(&self, body: models::CreatorEntity) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send> {
- self.api().creator_post(body, &self.context())
+ fn creator_post(&self, entity: models::CreatorEntity) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send> {
+ self.api().creator_post(entity, &self.context())
}
fn editgroup_id_accept_post(&self, id: i64) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send> {
@@ -384,8 +384,8 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().editgroup_id_get(id, &self.context())
}
- fn editgroup_post(&self, body: models::Editgroup) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send> {
- self.api().editgroup_post(body, &self.context())
+ fn editgroup_post(&self, entity: models::Editgroup) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send> {
+ self.api().editgroup_post(entity, &self.context())
}
fn editor_username_changelog_get(&self, username: String) -> Box<Future<Item = EditorUsernameChangelogGetResponse, Error = ApiError> + Send> {
@@ -404,8 +404,8 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().file_lookup_get(sha1, &self.context())
}
- fn file_post(&self, body: models::FileEntity) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send> {
- self.api().file_post(body, &self.context())
+ fn file_post(&self, entity: models::FileEntity) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send> {
+ self.api().file_post(entity, &self.context())
}
fn release_id_get(&self, id: String) -> Box<Future<Item = ReleaseIdGetResponse, Error = ApiError> + Send> {
@@ -416,16 +416,16 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().release_lookup_get(doi, &self.context())
}
- fn release_post(&self, body: models::ReleaseEntity) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send> {
- self.api().release_post(body, &self.context())
+ fn release_post(&self, entity: models::ReleaseEntity) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send> {
+ self.api().release_post(entity, &self.context())
}
fn work_id_get(&self, id: String) -> Box<Future<Item = WorkIdGetResponse, Error = ApiError> + Send> {
self.api().work_id_get(id, &self.context())
}
- fn work_post(&self, body: models::WorkEntity) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send> {
- self.api().work_post(body, &self.context())
+ fn work_post(&self, entity: models::WorkEntity) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send> {
+ self.api().work_post(entity, &self.context())
}
}
diff --git a/rust/fatcat-api/src/models.rs b/rust/fatcat-api/src/models.rs
index b05c0fc1..24c66f6b 100644
--- a/rust/fatcat-api/src/models.rs
+++ b/rust/fatcat-api/src/models.rs
@@ -290,37 +290,37 @@ 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_json::Value>,
-
- #[serde(rename = "editgroup_id")]
- pub editgroup_id: i64,
+ #[serde(rename = "edit_id")]
+ pub edit_id: i64,
- #[serde(rename = "redirect_ident")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub redirect_ident: Option<String>,
+ #[serde(rename = "ident")]
+ pub ident: String,
#[serde(rename = "revision")]
#[serde(skip_serializing_if = "Option::is_none")]
pub revision: Option<i64>,
- #[serde(rename = "ident")]
- pub ident: String,
+ #[serde(rename = "redirect_ident")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub redirect_ident: Option<String>,
- #[serde(rename = "edit_id")]
- pub edit_id: i64,
+ #[serde(rename = "editgroup_id")]
+ pub editgroup_id: i64,
+
+ #[serde(rename = "extra")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub extra: Option<serde_json::Value>,
}
impl EntityEdit {
- pub fn new(editgroup_id: i64, ident: String, edit_id: i64) -> EntityEdit {
+ pub fn new(edit_id: i64, ident: String, editgroup_id: i64) -> EntityEdit {
EntityEdit {
- extra: None,
- editgroup_id: editgroup_id,
- redirect_ident: None,
- revision: None,
- ident: ident,
edit_id: edit_id,
+ ident: ident,
+ revision: None,
+ redirect_ident: None,
+ editgroup_id: editgroup_id,
+ extra: None,
}
}
}
diff --git a/rust/fatcat-api/src/server.rs b/rust/fatcat-api/src/server.rs
index ed012478..7fdc5d2a 100644
--- a/rust/fatcat-api/src/server.rs
+++ b/rust/fatcat-api/src/server.rs
@@ -276,27 +276,27 @@ where
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
- let param_body = req.get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - not valid UTF-8: {}", e))))?;
+ let param_entity = req.get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
let mut unused_elements = Vec::new();
- let param_body = if let Some(param_body_raw) = param_body {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_body_raw);
+ let param_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
- let param_body: Option<models::ContainerEntity> =
+ let param_entity: Option<models::ContainerEntity> =
serde_ignored::deserialize(deserializer, |path| {
warn!("Ignoring unknown field in body: {}", path);
unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - doesn't match schema: {}", e))))?;
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
- param_body
+ param_entity
} else {
None
};
- let param_body = param_body.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter body".to_string())))?;
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.container_post(param_body, context).wait() {
+ match api.container_post(param_entity, context).wait() {
Ok(rsp) => match rsp {
ContainerPostResponse::CreatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -554,26 +554,27 @@ where
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
- let param_body = req.get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - not valid UTF-8: {}", e))))?;
+ let param_entity = req.get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
let mut unused_elements = Vec::new();
- let param_body = if let Some(param_body_raw) = param_body {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_body_raw);
+ let param_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
- let param_body: Option<models::CreatorEntity> = serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - doesn't match schema: {}", e))))?;
+ let param_entity: Option<models::CreatorEntity> =
+ serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
- param_body
+ param_entity
} else {
None
};
- let param_body = param_body.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter body".to_string())))?;
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.creator_post(param_body, context).wait() {
+ match api.creator_post(param_entity, context).wait() {
Ok(rsp) => match rsp {
CreatorPostResponse::CreatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -835,26 +836,26 @@ where
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
- let param_body = req.get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - not valid UTF-8: {}", e))))?;
+ let param_entity = req.get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
let mut unused_elements = Vec::new();
- let param_body = if let Some(param_body_raw) = param_body {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_body_raw);
+ let param_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
- let param_body: Option<models::Editgroup> = serde_ignored::deserialize(deserializer, |path| {
+ let param_entity: Option<models::Editgroup> = serde_ignored::deserialize(deserializer, |path| {
warn!("Ignoring unknown field in body: {}", path);
unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - doesn't match schema: {}", e))))?;
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
- param_body
+ param_entity
} else {
None
};
- let param_body = param_body.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter body".to_string())))?;
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.editgroup_post(param_body, context).wait() {
+ match api.editgroup_post(param_entity, context).wait() {
Ok(rsp) => match rsp {
EditgroupPostResponse::SuccessfullyCreated(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -1256,26 +1257,27 @@ where
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
- let param_body = req.get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - not valid UTF-8: {}", e))))?;
+ let param_entity = req.get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
let mut unused_elements = Vec::new();
- let param_body = if let Some(param_body_raw) = param_body {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_body_raw);
+ let param_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
- let param_body: Option<models::FileEntity> = serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - doesn't match schema: {}", e))))?;
+ let param_entity: Option<models::FileEntity> =
+ serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
- param_body
+ param_entity
} else {
None
};
- let param_body = param_body.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter body".to_string())))?;
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.file_post(param_body, context).wait() {
+ match api.file_post(param_entity, context).wait() {
Ok(rsp) => match rsp {
FilePostResponse::CreatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -1533,26 +1535,27 @@ where
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
- let param_body = req.get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - not valid UTF-8: {}", e))))?;
+ let param_entity = req.get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
let mut unused_elements = Vec::new();
- let param_body = if let Some(param_body_raw) = param_body {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_body_raw);
+ let param_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
- let param_body: Option<models::ReleaseEntity> = serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - doesn't match schema: {}", e))))?;
+ let param_entity: Option<models::ReleaseEntity> =
+ serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
- param_body
+ param_entity
} else {
None
};
- let param_body = param_body.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter body".to_string())))?;
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.release_post(param_body, context).wait() {
+ match api.release_post(param_entity, context).wait() {
Ok(rsp) => match rsp {
ReleasePostResponse::CreatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -1726,26 +1729,27 @@ where
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
- let param_body = req.get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - not valid UTF-8: {}", e))))?;
+ let param_entity = req.get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
let mut unused_elements = Vec::new();
- let param_body = if let Some(param_body_raw) = param_body {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_body_raw);
+ let param_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
- let param_body: Option<models::WorkEntity> = serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - doesn't match schema: {}", e))))?;
+ let param_entity: Option<models::WorkEntity> =
+ serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
- param_body
+ param_entity
} else {
None
};
- let param_body = param_body.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter body".to_string())))?;
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.work_post(param_body, context).wait() {
+ match api.work_post(param_entity, context).wait() {
Ok(rsp) => match rsp {
WorkPostResponse::CreatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
diff --git a/rust/fatcat-openapi2.yml b/rust/fatcat-openapi2.yml
index 585932b3..f1b94234 100644
--- a/rust/fatcat-openapi2.yml
+++ b/rust/fatcat-openapi2.yml
@@ -38,29 +38,6 @@ x-entity-props: &ENTITYPROPS
extra:
type: object
additionalProperties: {}
-x-entity-edit-props: &ENTITYEDITPROPS
- edit_id:
- type: integer
- example: 847
- format: int64
- ident:
- type: string
- example: "f1f046a3-45c9-4b99-adce-000000000001"
- revision:
- type: integer
- example: 42
- format: int64
- redirect_ident:
- type: string
- example: "f1f046a3-45c9-4b99-adce-000000000002"
- #format: uuid
- editgroup_id:
- type: integer
- example: 16
- format: int64
- extra:
- type: object
- additionalProperties: {}
definitions:
@@ -196,7 +173,28 @@ definitions:
- ident
- editgroup_id
properties:
- <<: *ENTITYEDITPROPS
+ edit_id:
+ type: integer
+ example: 847
+ format: int64
+ ident:
+ type: string
+ example: "f1f046a3-45c9-4b99-adce-000000000001"
+ revision:
+ type: integer
+ example: 42
+ format: int64
+ redirect_ident:
+ type: string
+ example: "f1f046a3-45c9-4b99-adce-000000000002"
+ #format: uuid
+ editgroup_id:
+ type: integer
+ example: 16
+ format: int64
+ extra:
+ type: object
+ additionalProperties: {}
editor:
type: object
required:
@@ -305,7 +303,7 @@ paths:
/creator:
post:
parameters:
- - name: body
+ - name: entity
in: body
required: true
schema:
@@ -316,6 +314,24 @@ paths:
schema:
$ref: "#/definitions/entity_edit"
<<: *ENTITYRESPONSES
+# /creator/batch:
+# post:
+# parameters:
+# - name: entity_list
+# in: body
+# required: true
+# schema:
+# type: array
+# items:
+# $ref: "#/definitions/creator_entity"
+# responses:
+# 201:
+# description: Created Entities
+# schema:
+# type: array
+# items:
+# $ref: "#/definitions/entity_edit"
+# <<: *ENTITYRESPONSES
/creator/{id}:
parameters:
- name: id
@@ -345,7 +361,7 @@ paths:
/container:
post:
parameters:
- - name: body
+ - name: entity
in: body
required: true
schema:
@@ -385,7 +401,7 @@ paths:
/file:
post:
parameters:
- - name: body
+ - name: entity
in: body
required: true
schema:
@@ -425,7 +441,7 @@ paths:
/release:
post:
parameters:
- - name: body
+ - name: entity
in: body
required: true
schema:
@@ -465,7 +481,7 @@ paths:
/work:
post:
parameters:
- - name: body
+ - name: entity
in: body
required: true
schema:
@@ -532,7 +548,7 @@ paths:
/editgroup:
post:
parameters:
- - name: body
+ - name: entity
in: body
required: true
schema:
diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs
index fc304fb7..bde73da5 100644
--- a/rust/src/api_server.rs
+++ b/rust/src/api_server.rs
@@ -54,10 +54,10 @@ macro_rules! wrap_entity_handlers {
fn $post_fn(
&self,
- body: models::$model,
+ entity: models::$model,
_context: &Context,
) -> Box<Future<Item = $post_resp, Error = ApiError> + Send> {
- let ret = match self.$post_handler(body) {
+ let ret = match self.$post_handler(entity) {
Ok(edit) =>
$post_resp::CreatedEntity(edit),
Err(Error(ErrorKind::Diesel(e), _)) =>
@@ -374,10 +374,10 @@ impl Server {
work_row2entity(Some(ident), rev)
}
- fn container_post_handler(&self, body: models::ContainerEntity) -> Result<EntityEdit> {
+ fn container_post_handler(&self, entity: models::ContainerEntity) -> Result<EntityEdit> {
let conn = self.db_pool.get().expect("db_pool error");
let editor_id = 1; // TODO: auth
- let editgroup_id = match body.editgroup_id {
+ let editgroup_id = match entity.editgroup_id {
None => get_or_create_editgroup(editor_id, &conn).expect("current editgroup"),
Some(param) => param as i64,
};
@@ -392,22 +392,22 @@ impl Server {
INSERT INTO container_edit (editgroup_id, ident_id, rev_id) VALUES
($7, (SELECT ident.id FROM ident), (SELECT rev.id FROM rev))
RETURNING *",
- ).bind::<diesel::sql_types::Text, _>(body.name)
- .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.publisher)
- .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.issnl)
- .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.abbrev)
- .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.coden)
- .bind::<diesel::sql_types::Nullable<diesel::sql_types::Json>, _>(body.extra)
+ ).bind::<diesel::sql_types::Text, _>(entity.name)
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.publisher)
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.issnl)
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.abbrev)
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.coden)
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Json>, _>(entity.extra)
.bind::<diesel::sql_types::BigInt, _>(editgroup_id)
.get_result(&conn)?;
edit.to_model()
}
- fn creator_post_handler(&self, body: models::CreatorEntity) -> Result<EntityEdit> {
+ fn creator_post_handler(&self, entity: models::CreatorEntity) -> Result<EntityEdit> {
let conn = self.db_pool.get().expect("db_pool error");
let editor_id = 1; // TODO: auth
- let editgroup_id = match body.editgroup_id {
+ let editgroup_id = match entity.editgroup_id {
None => get_or_create_editgroup(editor_id, &conn).expect("current editgroup"),
Some(param) => param as i64,
};
@@ -422,19 +422,19 @@ impl Server {
INSERT INTO creator_edit (editgroup_id, ident_id, rev_id) VALUES
($4, (SELECT ident.id FROM ident), (SELECT rev.id FROM rev))
RETURNING *",
- ).bind::<diesel::sql_types::Text, _>(body.full_name)
- .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.orcid)
- .bind::<diesel::sql_types::Nullable<diesel::sql_types::Json>, _>(body.extra)
+ ).bind::<diesel::sql_types::Text, _>(entity.full_name)
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.orcid)
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Json>, _>(entity.extra)
.bind::<diesel::sql_types::BigInt, _>(editgroup_id)
.get_result(&conn)?;
edit.to_model()
}
- fn file_post_handler(&self, body: models::FileEntity) -> Result<EntityEdit> {
+ fn file_post_handler(&self, entity: models::FileEntity) -> Result<EntityEdit> {
let conn = self.db_pool.get().expect("db_pool error");
let editor_id = 1; // TODO: auth
- let editgroup_id = match body.editgroup_id {
+ let editgroup_id = match entity.editgroup_id {
None => get_or_create_editgroup(editor_id, &conn).expect("current editgroup"),
Some(param) => param as i64,
};
@@ -450,15 +450,15 @@ impl Server {
INSERT INTO file_edit (editgroup_id, ident_id, rev_id) VALUES
($6, (SELECT ident.id FROM ident), (SELECT rev.id FROM rev))
RETURNING *",
- ).bind::<diesel::sql_types::Nullable<diesel::sql_types::Int8>, _>(body.size)
- .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.sha1)
- .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.md5)
- .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.url)
- .bind::<diesel::sql_types::Nullable<diesel::sql_types::Json>, _>(body.extra)
+ ).bind::<diesel::sql_types::Nullable<diesel::sql_types::Int8>, _>(entity.size)
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.sha1)
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.md5)
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.url)
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Json>, _>(entity.extra)
.bind::<diesel::sql_types::BigInt, _>(editgroup_id)
.get_result(&conn)?;
- let _releases: Option<Vec<FileReleaseRow>> = match body.releases {
+ let _releases: Option<Vec<FileReleaseRow>> = match entity.releases {
None => None,
Some(release_list) => {
if release_list.len() == 0 {
@@ -483,10 +483,10 @@ impl Server {
edit.to_model()
}
- fn work_post_handler(&self, body: models::WorkEntity) -> Result<EntityEdit> {
+ fn work_post_handler(&self, entity: models::WorkEntity) -> Result<EntityEdit> {
let conn = self.db_pool.get().expect("db_pool error");
let editor_id = 1; // TODO: auth
- let editgroup_id = match body.editgroup_id {
+ let editgroup_id = match entity.editgroup_id {
None => get_or_create_editgroup(editor_id, &conn).expect("current editgroup"),
Some(param) => param as i64,
};
@@ -502,24 +502,24 @@ impl Server {
INSERT INTO work_edit (editgroup_id, ident_id, rev_id) VALUES
($3, (SELECT ident.id FROM ident), (SELECT rev.id FROM rev))
RETURNING *",
- ).bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.work_type)
- .bind::<diesel::sql_types::Nullable<diesel::sql_types::Json>, _>(body.extra)
+ ).bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.work_type)
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Json>, _>(entity.extra)
.bind::<diesel::sql_types::BigInt, _>(editgroup_id)
.get_result(&conn)?;
edit.to_model()
}
- fn release_post_handler(&self, body: models::ReleaseEntity) -> Result<EntityEdit> {
+ fn release_post_handler(&self, entity: models::ReleaseEntity) -> Result<EntityEdit> {
let conn = self.db_pool.get().expect("db_pool error");
let editor_id = 1; // TODO: auth
- let editgroup_id = match body.editgroup_id {
+ let editgroup_id = match entity.editgroup_id {
None => get_or_create_editgroup(editor_id, &conn).expect("current editgroup"),
Some(param) => param as i64,
};
- let work_id = uuid::Uuid::parse_str(&body.work_id).expect("invalid UUID");
- let container_id: Option<uuid::Uuid> = match body.container_id {
+ let work_id = uuid::Uuid::parse_str(&entity.work_id).expect("invalid UUID");
+ let container_id: Option<uuid::Uuid> = match entity.container_id {
Some(id) => Some(uuid::Uuid::parse_str(&id).expect("invalid UUID")),
None => None,
};
@@ -534,23 +534,23 @@ impl Server {
INSERT INTO release_edit (editgroup_id, ident_id, rev_id) VALUES
($13, (SELECT ident.id FROM ident), (SELECT rev.id FROM rev))
RETURNING *",
- ).bind::<diesel::sql_types::Text, _>(body.title)
- .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.release_type)
+ ).bind::<diesel::sql_types::Text, _>(entity.title)
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.release_type)
.bind::<diesel::sql_types::Nullable<diesel::sql_types::Date>, _>(
- body.date.map(|v| v.naive_utc().date()))
- .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.doi)
- .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.isbn13)
- .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.volume)
- .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.pages)
- .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.issue)
+ entity.date.map(|v| v.naive_utc().date()))
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.doi)
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.isbn13)
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.volume)
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.pages)
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.issue)
.bind::<diesel::sql_types::Uuid, _>(work_id)
.bind::<diesel::sql_types::Nullable<diesel::sql_types::Uuid>, _>(container_id)
- .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.publisher)
- .bind::<diesel::sql_types::Nullable<diesel::sql_types::Json>, _>(body.extra)
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.publisher)
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Json>, _>(entity.extra)
.bind::<diesel::sql_types::BigInt, _>(editgroup_id)
.get_result(&conn)?;
- let _refs: Option<Vec<ReleaseRefRow>> = match body.refs {
+ let _refs: Option<Vec<ReleaseRefRow>> = match entity.refs {
None => None,
Some(ref_list) => {
if ref_list.len() == 0 {
@@ -576,7 +576,7 @@ impl Server {
}
};
- let _contribs: Option<Vec<ReleaseContribRow>> = match body.contribs {
+ let _contribs: Option<Vec<ReleaseContribRow>> = match entity.contribs {
None => None,
Some(contrib_list) => {
if contrib_list.len() == 0 {
@@ -813,16 +813,16 @@ impl Api for Server {
fn editgroup_post(
&self,
- body: models::Editgroup,
+ entity: models::Editgroup,
_context: &Context,
) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send> {
let conn = self.db_pool.get().expect("db_pool error");
let row: EditgroupRow = insert_into(editgroup::table)
.values((
- editgroup::editor_id.eq(body.editor_id as i64),
- editgroup::description.eq(body.description),
- editgroup::extra_json.eq(body.extra),
+ editgroup::editor_id.eq(entity.editor_id as i64),
+ editgroup::description.eq(entity.description),
+ editgroup::extra_json.eq(entity.extra),
))
.get_result(&conn)
.expect("error creating edit group");