diff --git a/modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml b/modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml index a22fbc7896c..8cbd1e18b15 100644 --- a/modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml @@ -777,3 +777,17 @@ components: uuid: type: string format: uuid + ActionContainer: + required: + - action + type: object + properties: + action: + allOf: + - $ref: '#/components/schemas/Baz' + - nullable: false + Baz: + enum: + - A + - B + type: string diff --git a/samples/client/petstore/rust/hyper/petstore/.openapi-generator/FILES b/samples/client/petstore/rust/hyper/petstore/.openapi-generator/FILES index 5345a60cd98..639c6877625 100644 --- a/samples/client/petstore/rust/hyper/petstore/.openapi-generator/FILES +++ b/samples/client/petstore/rust/hyper/petstore/.openapi-generator/FILES @@ -2,7 +2,9 @@ .travis.yml Cargo.toml README.md +docs/ActionContainer.md docs/ApiResponse.md +docs/Baz.md docs/Category.md docs/FakeApi.md docs/Order.md @@ -23,7 +25,9 @@ src/apis/request.rs src/apis/store_api.rs src/apis/user_api.rs src/lib.rs +src/models/action_container.rs src/models/api_response.rs +src/models/baz.rs src/models/category.rs src/models/mod.rs src/models/order.rs diff --git a/samples/client/petstore/rust/hyper/petstore/README.md b/samples/client/petstore/rust/hyper/petstore/README.md index 2fe69e24cc8..b068ac70fa7 100644 --- a/samples/client/petstore/rust/hyper/petstore/README.md +++ b/samples/client/petstore/rust/hyper/petstore/README.md @@ -50,7 +50,9 @@ Class | Method | HTTP request | Description ## Documentation For Models + - [ActionContainer](docs/ActionContainer.md) - [ApiResponse](docs/ApiResponse.md) + - [Baz](docs/Baz.md) - [Category](docs/Category.md) - [Order](docs/Order.md) - [Pet](docs/Pet.md) diff --git a/samples/client/petstore/rust/hyper/petstore/docs/ActionContainer.md b/samples/client/petstore/rust/hyper/petstore/docs/ActionContainer.md new file mode 100644 index 00000000000..d705faa58f2 --- /dev/null +++ b/samples/client/petstore/rust/hyper/petstore/docs/ActionContainer.md @@ -0,0 +1,11 @@ +# ActionContainer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**action** | Option<[**crate::models::Baz**](Baz.md)> | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/hyper/petstore/docs/Baz.md b/samples/client/petstore/rust/hyper/petstore/docs/Baz.md new file mode 100644 index 00000000000..68c84b1b1b0 --- /dev/null +++ b/samples/client/petstore/rust/hyper/petstore/docs/Baz.md @@ -0,0 +1,10 @@ +# Baz + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/action_container.rs b/samples/client/petstore/rust/hyper/petstore/src/models/action_container.rs new file mode 100644 index 00000000000..b63126c05e9 --- /dev/null +++ b/samples/client/petstore/rust/hyper/petstore/src/models/action_container.rs @@ -0,0 +1,28 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct ActionContainer { + #[serde(rename = "action")] + pub action: Option>, +} + +impl ActionContainer { + pub fn new(action: Option) -> ActionContainer { + ActionContainer { + action: if let Some(x) = action {Some(Box::new(x))} else {None}, + } + } +} + + diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/baz.rs b/samples/client/petstore/rust/hyper/petstore/src/models/baz.rs new file mode 100644 index 00000000000..8a07bf66198 --- /dev/null +++ b/samples/client/petstore/rust/hyper/petstore/src/models/baz.rs @@ -0,0 +1,39 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Baz { + #[serde(rename = "A")] + A, + #[serde(rename = "B")] + B, + +} + +impl ToString for Baz { + fn to_string(&self) -> String { + match self { + Self::A => String::from("A"), + Self::B => String::from("B"), + } + } +} + +impl Default for Baz { + fn default() -> Baz { + Self::A + } +} + + + + diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/mod.rs b/samples/client/petstore/rust/hyper/petstore/src/models/mod.rs index 37334443da2..10b2293873f 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/mod.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/mod.rs @@ -1,5 +1,9 @@ +pub mod action_container; +pub use self::action_container::ActionContainer; pub mod api_response; pub use self::api_response::ApiResponse; +pub mod baz; +pub use self::baz::Baz; pub mod category; pub use self::category::Category; pub mod order; diff --git a/samples/client/petstore/rust/reqwest/petstore/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest/petstore/.openapi-generator/FILES index 75bd989a45f..dc1444953f7 100644 --- a/samples/client/petstore/rust/reqwest/petstore/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest/petstore/.openapi-generator/FILES @@ -2,7 +2,9 @@ .travis.yml Cargo.toml README.md +docs/ActionContainer.md docs/ApiResponse.md +docs/Baz.md docs/Category.md docs/FakeApi.md docs/Order.md @@ -21,7 +23,9 @@ src/apis/pet_api.rs src/apis/store_api.rs src/apis/user_api.rs src/lib.rs +src/models/action_container.rs src/models/api_response.rs +src/models/baz.rs src/models/category.rs src/models/mod.rs src/models/order.rs diff --git a/samples/client/petstore/rust/reqwest/petstore/README.md b/samples/client/petstore/rust/reqwest/petstore/README.md index af68b013a2d..cd952b20964 100644 --- a/samples/client/petstore/rust/reqwest/petstore/README.md +++ b/samples/client/petstore/rust/reqwest/petstore/README.md @@ -50,7 +50,9 @@ Class | Method | HTTP request | Description ## Documentation For Models + - [ActionContainer](docs/ActionContainer.md) - [ApiResponse](docs/ApiResponse.md) + - [Baz](docs/Baz.md) - [Category](docs/Category.md) - [Order](docs/Order.md) - [Pet](docs/Pet.md) diff --git a/samples/client/petstore/rust/reqwest/petstore/docs/ActionContainer.md b/samples/client/petstore/rust/reqwest/petstore/docs/ActionContainer.md new file mode 100644 index 00000000000..d705faa58f2 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore/docs/ActionContainer.md @@ -0,0 +1,11 @@ +# ActionContainer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**action** | Option<[**crate::models::Baz**](Baz.md)> | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/reqwest/petstore/docs/Baz.md b/samples/client/petstore/rust/reqwest/petstore/docs/Baz.md new file mode 100644 index 00000000000..68c84b1b1b0 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore/docs/Baz.md @@ -0,0 +1,10 @@ +# Baz + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/action_container.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/action_container.rs new file mode 100644 index 00000000000..b63126c05e9 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/action_container.rs @@ -0,0 +1,28 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct ActionContainer { + #[serde(rename = "action")] + pub action: Option>, +} + +impl ActionContainer { + pub fn new(action: Option) -> ActionContainer { + ActionContainer { + action: if let Some(x) = action {Some(Box::new(x))} else {None}, + } + } +} + + diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/baz.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/baz.rs new file mode 100644 index 00000000000..8a07bf66198 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/baz.rs @@ -0,0 +1,39 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Baz { + #[serde(rename = "A")] + A, + #[serde(rename = "B")] + B, + +} + +impl ToString for Baz { + fn to_string(&self) -> String { + match self { + Self::A => String::from("A"), + Self::B => String::from("B"), + } + } +} + +impl Default for Baz { + fn default() -> Baz { + Self::A + } +} + + + + diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/mod.rs index 37334443da2..10b2293873f 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/mod.rs @@ -1,5 +1,9 @@ +pub mod action_container; +pub use self::action_container::ActionContainer; pub mod api_response; pub use self::api_response::ApiResponse; +pub mod baz; +pub use self::baz::Baz; pub mod category; pub use self::category::Category; pub mod order;