diff options
-rw-r--r-- | fatcat-openapi2.yml | 12 | ||||
-rw-r--r-- | rust/fatcat-api-spec/README.md | 2 | ||||
-rw-r--r-- | rust/fatcat-api-spec/api.yaml | 12 | ||||
-rw-r--r-- | rust/fatcat-api-spec/api/swagger.yaml | 27 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/client.rs | 21 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/lib.rs | 6 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/mimetypes.rs | 12 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/server.rs | 32 |
8 files changed, 123 insertions, 1 deletions
diff --git a/fatcat-openapi2.yml b/fatcat-openapi2.yml index da582ade..70e8e540 100644 --- a/fatcat-openapi2.yml +++ b/fatcat-openapi2.yml @@ -2573,6 +2573,10 @@ paths: description: Bad Request schema: $ref: "#/definitions/error_response" + 404: # added only for response type consistency + description: Not Found + schema: + $ref: "#/definitions/error_response" 500: description: Generic Error schema: @@ -2657,6 +2661,10 @@ paths: type: array items: $ref: "#/definitions/changelog_entry" + 400: # added only for response type consistency + description: Bad Request + schema: + $ref: "#/definitions/error_response" 500: description: Generic Error schema: @@ -2677,6 +2685,10 @@ paths: description: Found Changelog Entry schema: $ref: "#/definitions/changelog_entry" + 400: # added only for response type consistency + description: Bad Request + schema: + $ref: "#/definitions/error_response" 404: description: Not Found schema: diff --git a/rust/fatcat-api-spec/README.md b/rust/fatcat-api-spec/README.md index 95a39ba3..300cba5f 100644 --- a/rust/fatcat-api-spec/README.md +++ b/rust/fatcat-api-spec/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: 2019-01-09T23:33:10.040Z +- Build date: 2019-01-10T07:48:01.403Z This autogenerated project defines an API crate `fatcat` which contains: * An `Api` trait defining the API in Rust. diff --git a/rust/fatcat-api-spec/api.yaml b/rust/fatcat-api-spec/api.yaml index da582ade..70e8e540 100644 --- a/rust/fatcat-api-spec/api.yaml +++ b/rust/fatcat-api-spec/api.yaml @@ -2573,6 +2573,10 @@ paths: description: Bad Request schema: $ref: "#/definitions/error_response" + 404: # added only for response type consistency + description: Not Found + schema: + $ref: "#/definitions/error_response" 500: description: Generic Error schema: @@ -2657,6 +2661,10 @@ paths: type: array items: $ref: "#/definitions/changelog_entry" + 400: # added only for response type consistency + description: Bad Request + schema: + $ref: "#/definitions/error_response" 500: description: Generic Error schema: @@ -2677,6 +2685,10 @@ paths: description: Found Changelog Entry schema: $ref: "#/definitions/changelog_entry" + 400: # added only for response type consistency + description: Bad Request + schema: + $ref: "#/definitions/error_response" 404: description: Not Found schema: diff --git a/rust/fatcat-api-spec/api/swagger.yaml b/rust/fatcat-api-spec/api/swagger.yaml index 293186c6..0b18add8 100644 --- a/rust/fatcat-api-spec/api/swagger.yaml +++ b/rust/fatcat-api-spec/api/swagger.yaml @@ -6318,6 +6318,15 @@ paths: uppercase_operation_id: "CREATE_EDITGROUP" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "CREATE_EDITGROUP" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 500: description: "Generic Error" schema: @@ -6508,6 +6517,15 @@ paths: uppercase_operation_id: "GET_CHANGELOG" uppercase_data_type: "VEC<CHANGELOGENTRY>" producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "GET_CHANGELOG" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 500: description: "Generic Error" schema: @@ -6545,6 +6563,15 @@ paths: uppercase_operation_id: "GET_CHANGELOG_ENTRY" uppercase_data_type: "CHANGELOGENTRY" producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "GET_CHANGELOG_ENTRY" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: diff --git a/rust/fatcat-api-spec/src/client.rs b/rust/fatcat-api-spec/src/client.rs index 5937b7f2..c5cf4297 100644 --- a/rust/fatcat-api-spec/src/client.rs +++ b/rust/fatcat-api-spec/src/client.rs @@ -2570,6 +2570,13 @@ impl Api for Client { Ok(CreateEditgroupResponse::Forbidden(body)) } + 404 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<models::ErrorResponse>(&buf)?; + + Ok(CreateEditgroupResponse::NotFound(body)) + } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -2619,6 +2626,13 @@ impl Api for Client { Ok(GetChangelogResponse::Success(body)) } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<models::ErrorResponse>(&buf)?; + + Ok(GetChangelogResponse::BadRequest(body)) + } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -2669,6 +2683,13 @@ impl Api for Client { Ok(GetChangelogEntryResponse::FoundChangelogEntry(body)) } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<models::ErrorResponse>(&buf)?; + + Ok(GetChangelogEntryResponse::BadRequest(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; diff --git a/rust/fatcat-api-spec/src/lib.rs b/rust/fatcat-api-spec/src/lib.rs index cd281a3d..3f1afa67 100644 --- a/rust/fatcat-api-spec/src/lib.rs +++ b/rust/fatcat-api-spec/src/lib.rs @@ -448,6 +448,8 @@ pub enum CreateEditgroupResponse { NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Forbidden Forbidden(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } @@ -456,6 +458,8 @@ pub enum CreateEditgroupResponse { pub enum GetChangelogResponse { /// Success Success(Vec<models::ChangelogEntry>), + /// Bad Request + BadRequest(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } @@ -464,6 +468,8 @@ pub enum GetChangelogResponse { pub enum GetChangelogEntryResponse { /// Found Changelog Entry FoundChangelogEntry(models::ChangelogEntry), + /// Bad Request + BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error diff --git a/rust/fatcat-api-spec/src/mimetypes.rs b/rust/fatcat-api-spec/src/mimetypes.rs index 83add9e3..11159610 100644 --- a/rust/fatcat-api-spec/src/mimetypes.rs +++ b/rust/fatcat-api-spec/src/mimetypes.rs @@ -602,6 +602,10 @@ pub mod responses { } /// Create Mime objects for the response content types for CreateEditgroup lazy_static! { + pub static ref CREATE_EDITGROUP_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateEditgroup + lazy_static! { pub static ref CREATE_EDITGROUP_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetChangelog @@ -610,6 +614,10 @@ pub mod responses { } /// Create Mime objects for the response content types for GetChangelog lazy_static! { + pub static ref GET_CHANGELOG_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetChangelog + lazy_static! { pub static ref GET_CHANGELOG_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetChangelogEntry @@ -618,6 +626,10 @@ pub mod responses { } /// Create Mime objects for the response content types for GetChangelogEntry lazy_static! { + pub static ref GET_CHANGELOG_ENTRY_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetChangelogEntry + lazy_static! { pub static ref GET_CHANGELOG_ENTRY_NOT_FOUND: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetChangelogEntry diff --git a/rust/fatcat-api-spec/src/server.rs b/rust/fatcat-api-spec/src/server.rs index 2f1c5d27..03875a38 100644 --- a/rust/fatcat-api-spec/src/server.rs +++ b/rust/fatcat-api-spec/src/server.rs @@ -3431,6 +3431,18 @@ where } Ok(response) } + CreateEditgroupResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_EDITGROUP_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } CreateEditgroupResponse::GenericError(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -3491,6 +3503,16 @@ where Ok(response) } + GetChangelogResponse::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::GET_CHANGELOG_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } GetChangelogResponse::GenericError(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -3560,6 +3582,16 @@ where Ok(response) } + GetChangelogEntryResponse::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::GET_CHANGELOG_ENTRY_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } GetChangelogEntryResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); |