From e53215bc0c0126b624bf92df52a897a4603e044b Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 31 Aug 2018 14:36:44 -0700 Subject: add bad request response type for eg accept --- rust/fatcat-api/README.md | 2 +- rust/fatcat-api/api.yaml | 4 ++++ rust/fatcat-api/api/swagger.yaml | 6 +++--- rust/fatcat-api/src/client.rs | 2 +- rust/fatcat-api/src/lib.rs | 4 ++-- rust/fatcat-api/src/mimetypes.rs | 2 +- rust/fatcat-api/src/server.rs | 4 ++-- 7 files changed, 14 insertions(+), 10 deletions(-) (limited to 'rust') diff --git a/rust/fatcat-api/README.md b/rust/fatcat-api/README.md index 1e382370..ba2f6186 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-08-16T16:42:27.600Z +- Build date: 2018-08-31T21:31:20.591Z 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 524333ce..c02d4f03 100644 --- a/rust/fatcat-api/api.yaml +++ b/rust/fatcat-api/api.yaml @@ -1001,6 +1001,10 @@ paths: description: Unmergable schema: $ref: "#/definitions/error_response" + 400: + description: Bad Request + schema: + $ref: "#/definitions/error_response" 404: description: Not Found schema: diff --git a/rust/fatcat-api/api/swagger.yaml b/rust/fatcat-api/api/swagger.yaml index 021594c0..d54aafc4 100644 --- a/rust/fatcat-api/api/swagger.yaml +++ b/rust/fatcat-api/api/swagger.yaml @@ -1808,11 +1808,11 @@ paths: uppercase_data_type: "SUCCESS" producesJson: true 400: - description: "Unmergable" + description: "Bad Request" schema: $ref: "#/definitions/error_response" - x-responseId: "Unmergable" - x-uppercaseResponseId: "UNMERGABLE" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" uppercase_operation_id: "ACCEPT_EDITGROUP" uppercase_data_type: "ERRORRESPONSE" producesJson: true diff --git a/rust/fatcat-api/src/client.rs b/rust/fatcat-api/src/client.rs index bc1992de..4140da76 100644 --- a/rust/fatcat-api/src/client.rs +++ b/rust/fatcat-api/src/client.rs @@ -191,7 +191,7 @@ impl Api for Client { response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(AcceptEditgroupResponse::Unmergable(body)) + Ok(AcceptEditgroupResponse::BadRequest(body)) } 404 => { let mut buf = String::new(); diff --git a/rust/fatcat-api/src/lib.rs b/rust/fatcat-api/src/lib.rs index fac8ecac..81b2fbfa 100644 --- a/rust/fatcat-api/src/lib.rs +++ b/rust/fatcat-api/src/lib.rs @@ -36,8 +36,8 @@ pub use swagger::{ApiError, Context, ContextWrapper}; pub enum AcceptEditgroupResponse { /// Merged Successfully MergedSuccessfully(models::Success), - /// Unmergable - Unmergable(models::ErrorResponse), + /// Bad Request + BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error diff --git a/rust/fatcat-api/src/mimetypes.rs b/rust/fatcat-api/src/mimetypes.rs index 53b582dc..2af30994 100644 --- a/rust/fatcat-api/src/mimetypes.rs +++ b/rust/fatcat-api/src/mimetypes.rs @@ -10,7 +10,7 @@ pub mod responses { } /// Create Mime objects for the response content types for AcceptEditgroup lazy_static! { - pub static ref ACCEPT_EDITGROUP_UNMERGABLE: Mime = mime!(Application / Json); + pub static ref ACCEPT_EDITGROUP_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for AcceptEditgroup lazy_static! { diff --git a/rust/fatcat-api/src/server.rs b/rust/fatcat-api/src/server.rs index 68e08515..90e0f4e0 100644 --- a/rust/fatcat-api/src/server.rs +++ b/rust/fatcat-api/src/server.rs @@ -130,11 +130,11 @@ where Ok(response) } - AcceptEditgroupResponse::Unmergable(body) => { + AcceptEditgroupResponse::BadRequest(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(400), body_string)); - response.headers.set(ContentType(mimetypes::responses::ACCEPT_EDITGROUP_UNMERGABLE.clone())); + response.headers.set(ContentType(mimetypes::responses::ACCEPT_EDITGROUP_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); -- cgit v1.2.3