From 25b12a9d5802684a2e316b01457b9a159970a5c2 Mon Sep 17 00:00:00 2001 From: Michael Edwards <medwards@walledcity.ca> Date: Fri, 3 May 2019 17:16:47 +0200 Subject: [PATCH 1/2] Idiomatic Rust returns for Error conversions --- .../src/main/resources/rust/reqwest/api_mod.mustache | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/rust/reqwest/api_mod.mustache b/modules/openapi-generator/src/main/resources/rust/reqwest/api_mod.mustache index 80c30e7dcb6..318b0f7a0db 100644 --- a/modules/openapi-generator/src/main/resources/rust/reqwest/api_mod.mustache +++ b/modules/openapi-generator/src/main/resources/rust/reqwest/api_mod.mustache @@ -10,19 +10,19 @@ pub enum Error { impl From<reqwest::Error> for Error { fn from(e: reqwest::Error) -> Self { - return Error::Reqwest(e) + Error::Reqwest(e) } } impl From<serde_json::Error> for Error { fn from(e: serde_json::Error) -> Self { - return Error::Serde(e) + Error::Serde(e) } } impl From<std::io::Error> for Error { fn from(e: std::io::Error) -> Self { - return Error::Io(e) + Error::Io(e) } } -- GitLab From 26ea168c6a99a710f56d5efd10433e8895ced1cd Mon Sep 17 00:00:00 2001 From: Benjamin Gill <benjamin.gill@digital.cabinet-office.gov.uk> Date: Fri, 7 Jun 2019 17:39:06 +0100 Subject: [PATCH 2/2] Regenerate Rust samples --- .../client/petstore/rust-reqwest/.openapi-generator/VERSION | 2 +- samples/client/petstore/rust-reqwest/docs/UserApi.md | 4 ++-- .../client/petstore/rust-reqwest/src/apis/configuration.rs | 2 +- samples/client/petstore/rust-reqwest/src/apis/mod.rs | 6 +++--- samples/client/petstore/rust-reqwest/src/apis/pet_api.rs | 2 +- samples/client/petstore/rust-reqwest/src/apis/store_api.rs | 2 +- samples/client/petstore/rust-reqwest/src/apis/user_api.rs | 2 +- .../client/petstore/rust-reqwest/src/models/api_response.rs | 2 +- samples/client/petstore/rust-reqwest/src/models/category.rs | 2 +- samples/client/petstore/rust-reqwest/src/models/order.rs | 2 +- samples/client/petstore/rust-reqwest/src/models/pet.rs | 2 +- samples/client/petstore/rust-reqwest/src/models/tag.rs | 2 +- samples/client/petstore/rust-reqwest/src/models/user.rs | 2 +- samples/client/petstore/rust/.openapi-generator/VERSION | 2 +- samples/client/petstore/rust/docs/UserApi.md | 4 ++-- samples/client/petstore/rust/src/apis/configuration.rs | 2 +- samples/client/petstore/rust/src/apis/pet_api.rs | 2 +- samples/client/petstore/rust/src/apis/store_api.rs | 2 +- samples/client/petstore/rust/src/apis/user_api.rs | 2 +- samples/client/petstore/rust/src/models/api_response.rs | 2 +- samples/client/petstore/rust/src/models/category.rs | 2 +- samples/client/petstore/rust/src/models/order.rs | 2 +- samples/client/petstore/rust/src/models/pet.rs | 2 +- samples/client/petstore/rust/src/models/tag.rs | 2 +- samples/client/petstore/rust/src/models/user.rs | 2 +- 25 files changed, 29 insertions(+), 29 deletions(-) diff --git a/samples/client/petstore/rust-reqwest/.openapi-generator/VERSION b/samples/client/petstore/rust-reqwest/.openapi-generator/VERSION index afa63656064..d96260ba335 100644 --- a/samples/client/petstore/rust-reqwest/.openapi-generator/VERSION +++ b/samples/client/petstore/rust-reqwest/.openapi-generator/VERSION @@ -1 +1 @@ -4.0.0-SNAPSHOT \ No newline at end of file +4.0.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/rust-reqwest/docs/UserApi.md b/samples/client/petstore/rust-reqwest/docs/UserApi.md index 17d278b4b5c..d469a52df88 100644 --- a/samples/client/petstore/rust-reqwest/docs/UserApi.md +++ b/samples/client/petstore/rust-reqwest/docs/UserApi.md @@ -55,7 +55,7 @@ Creates list of users with given input array Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Vec<::models::User>**](array.md)| List of user object | + **body** | [**Vec<::models::User>**](User.md)| List of user object | ### Return type @@ -83,7 +83,7 @@ Creates list of users with given input array Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Vec<::models::User>**](array.md)| List of user object | + **body** | [**Vec<::models::User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/rust-reqwest/src/apis/configuration.rs b/samples/client/petstore/rust-reqwest/src/apis/configuration.rs index 9493b6ff9ec..4194f7a52d1 100644 --- a/samples/client/petstore/rust-reqwest/src/apis/configuration.rs +++ b/samples/client/petstore/rust-reqwest/src/apis/configuration.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust-reqwest/src/apis/mod.rs b/samples/client/petstore/rust-reqwest/src/apis/mod.rs index 99d5b323764..8ca9138588c 100644 --- a/samples/client/petstore/rust-reqwest/src/apis/mod.rs +++ b/samples/client/petstore/rust-reqwest/src/apis/mod.rs @@ -10,19 +10,19 @@ pub enum Error { impl From<reqwest::Error> for Error { fn from(e: reqwest::Error) -> Self { - return Error::Reqwest(e) + Error::Reqwest(e) } } impl From<serde_json::Error> for Error { fn from(e: serde_json::Error) -> Self { - return Error::Serde(e) + Error::Serde(e) } } impl From<std::io::Error> for Error { fn from(e: std::io::Error) -> Self { - return Error::Io(e) + Error::Io(e) } } diff --git a/samples/client/petstore/rust-reqwest/src/apis/pet_api.rs b/samples/client/petstore/rust-reqwest/src/apis/pet_api.rs index 2bf993408e2..53d2b82ea72 100644 --- a/samples/client/petstore/rust-reqwest/src/apis/pet_api.rs +++ b/samples/client/petstore/rust-reqwest/src/apis/pet_api.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust-reqwest/src/apis/store_api.rs b/samples/client/petstore/rust-reqwest/src/apis/store_api.rs index 787072191f1..d9d60f09960 100644 --- a/samples/client/petstore/rust-reqwest/src/apis/store_api.rs +++ b/samples/client/petstore/rust-reqwest/src/apis/store_api.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust-reqwest/src/apis/user_api.rs b/samples/client/petstore/rust-reqwest/src/apis/user_api.rs index ea877eb0378..68d4c9f1266 100644 --- a/samples/client/petstore/rust-reqwest/src/apis/user_api.rs +++ b/samples/client/petstore/rust-reqwest/src/apis/user_api.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust-reqwest/src/models/api_response.rs b/samples/client/petstore/rust-reqwest/src/models/api_response.rs index c256dd541f2..7884fba590e 100644 --- a/samples/client/petstore/rust-reqwest/src/models/api_response.rs +++ b/samples/client/petstore/rust-reqwest/src/models/api_response.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust-reqwest/src/models/category.rs b/samples/client/petstore/rust-reqwest/src/models/category.rs index c65206929e3..804f9f4c707 100644 --- a/samples/client/petstore/rust-reqwest/src/models/category.rs +++ b/samples/client/petstore/rust-reqwest/src/models/category.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust-reqwest/src/models/order.rs b/samples/client/petstore/rust-reqwest/src/models/order.rs index b3cfb487b8d..118dc310767 100644 --- a/samples/client/petstore/rust-reqwest/src/models/order.rs +++ b/samples/client/petstore/rust-reqwest/src/models/order.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust-reqwest/src/models/pet.rs b/samples/client/petstore/rust-reqwest/src/models/pet.rs index 73189d5bcfc..64dae06e454 100644 --- a/samples/client/petstore/rust-reqwest/src/models/pet.rs +++ b/samples/client/petstore/rust-reqwest/src/models/pet.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust-reqwest/src/models/tag.rs b/samples/client/petstore/rust-reqwest/src/models/tag.rs index cb76addf6e6..503fb7f61bd 100644 --- a/samples/client/petstore/rust-reqwest/src/models/tag.rs +++ b/samples/client/petstore/rust-reqwest/src/models/tag.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust-reqwest/src/models/user.rs b/samples/client/petstore/rust-reqwest/src/models/user.rs index 08bb9db1b6c..6bfa6e2167a 100644 --- a/samples/client/petstore/rust-reqwest/src/models/user.rs +++ b/samples/client/petstore/rust-reqwest/src/models/user.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust/.openapi-generator/VERSION b/samples/client/petstore/rust/.openapi-generator/VERSION index afa63656064..d96260ba335 100644 --- a/samples/client/petstore/rust/.openapi-generator/VERSION +++ b/samples/client/petstore/rust/.openapi-generator/VERSION @@ -1 +1 @@ -4.0.0-SNAPSHOT \ No newline at end of file +4.0.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/rust/docs/UserApi.md b/samples/client/petstore/rust/docs/UserApi.md index 2ec2362730d..ffa733d64de 100644 --- a/samples/client/petstore/rust/docs/UserApi.md +++ b/samples/client/petstore/rust/docs/UserApi.md @@ -55,7 +55,7 @@ Creates list of users with given input array Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Vec<::models::User>**](array.md)| List of user object | + **body** | [**Vec<::models::User>**](User.md)| List of user object | ### Return type @@ -83,7 +83,7 @@ Creates list of users with given input array Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Vec<::models::User>**](array.md)| List of user object | + **body** | [**Vec<::models::User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/rust/src/apis/configuration.rs b/samples/client/petstore/rust/src/apis/configuration.rs index 4b703512133..c282a0c30df 100644 --- a/samples/client/petstore/rust/src/apis/configuration.rs +++ b/samples/client/petstore/rust/src/apis/configuration.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust/src/apis/pet_api.rs b/samples/client/petstore/rust/src/apis/pet_api.rs index fddbf5a569d..0c98efec5cf 100644 --- a/samples/client/petstore/rust/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/src/apis/pet_api.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust/src/apis/store_api.rs b/samples/client/petstore/rust/src/apis/store_api.rs index a68411466ca..46f0bf53cf4 100644 --- a/samples/client/petstore/rust/src/apis/store_api.rs +++ b/samples/client/petstore/rust/src/apis/store_api.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust/src/apis/user_api.rs b/samples/client/petstore/rust/src/apis/user_api.rs index 896bcbd5112..ba3ad140b46 100644 --- a/samples/client/petstore/rust/src/apis/user_api.rs +++ b/samples/client/petstore/rust/src/apis/user_api.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust/src/models/api_response.rs b/samples/client/petstore/rust/src/models/api_response.rs index c256dd541f2..7884fba590e 100644 --- a/samples/client/petstore/rust/src/models/api_response.rs +++ b/samples/client/petstore/rust/src/models/api_response.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust/src/models/category.rs b/samples/client/petstore/rust/src/models/category.rs index c65206929e3..804f9f4c707 100644 --- a/samples/client/petstore/rust/src/models/category.rs +++ b/samples/client/petstore/rust/src/models/category.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust/src/models/order.rs b/samples/client/petstore/rust/src/models/order.rs index b3cfb487b8d..118dc310767 100644 --- a/samples/client/petstore/rust/src/models/order.rs +++ b/samples/client/petstore/rust/src/models/order.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust/src/models/pet.rs b/samples/client/petstore/rust/src/models/pet.rs index 73189d5bcfc..64dae06e454 100644 --- a/samples/client/petstore/rust/src/models/pet.rs +++ b/samples/client/petstore/rust/src/models/pet.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust/src/models/tag.rs b/samples/client/petstore/rust/src/models/tag.rs index cb76addf6e6..503fb7f61bd 100644 --- a/samples/client/petstore/rust/src/models/tag.rs +++ b/samples/client/petstore/rust/src/models/tag.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust/src/models/user.rs b/samples/client/petstore/rust/src/models/user.rs index 08bb9db1b6c..6bfa6e2167a 100644 --- a/samples/client/petstore/rust/src/models/user.rs +++ b/samples/client/petstore/rust/src/models/user.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ -- GitLab