diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java index c32627a62a3..eda548cef8a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java @@ -922,6 +922,9 @@ public class OpenAPINormalizer { } protected Schema normalizeOneOf(Schema schema, Set visitedSchemas) { + // Remove duplicate oneOf entries + ModelUtils.deduplicateOneOfSchema(schema); + // simplify first as the schema may no longer be a oneOf after processing the rule below schema = processSimplifyOneOf(schema); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java index e1f9a932588..c499dec694c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java @@ -2243,6 +2243,23 @@ public class ModelUtils { return schema; } + /** + * Removes duplicate `oneOf` from a given schema if it does not also have a discriminator. + * + * @param schema Schema + */ + public static void deduplicateOneOfSchema(Schema schema) { + if (schema.getOneOf() == null) { + return; + } + if (schema.getDiscriminator() != null) { + return; // Duplicate oneOf are allowed if there is a discriminator that can be used to separate them. + } + + Set deduplicated = new LinkedHashSet<>(schema.getOneOf()); + schema.setOneOf(new ArrayList<>(deduplicated)); + } + /** * Check if the schema is of type 'null' or schema itself is pointing to null *

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 3e49f5606d1..64de2e9e67c 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 @@ -1107,3 +1107,16 @@ components: allOf: - $ref: '#/components/schemas/existing_tags_array' - description: This is a test for allOf with metadata only fields + DuplicateOneOf: + type: object + oneOf: + - $ref: '#/components/schemas/Order' + - $ref: '#/components/schemas/Order' + WithInnerOneOf: + type: object + properties: + foo: + type: object + oneOf: + - $ref: '#/components/schemas/Order' + - $ref: '#/components/schemas/Order' diff --git a/samples/client/petstore/rust/hyper/petstore/.openapi-generator/FILES b/samples/client/petstore/rust/hyper/petstore/.openapi-generator/FILES index 207b30d42fd..f56a8ace96e 100644 --- a/samples/client/petstore/rust/hyper/petstore/.openapi-generator/FILES +++ b/samples/client/petstore/rust/hyper/petstore/.openapi-generator/FILES @@ -32,6 +32,7 @@ docs/UniqueItemArrayTesting.md docs/User.md docs/UserApi.md docs/Vehicle.md +docs/WithInnerOneOf.md git_push.sh src/apis/client.rs src/apis/configuration.rs @@ -69,3 +70,4 @@ src/models/type_testing.rs src/models/unique_item_array_testing.rs src/models/user.rs src/models/vehicle.rs +src/models/with_inner_one_of.rs diff --git a/samples/client/petstore/rust/hyper/petstore/README.md b/samples/client/petstore/rust/hyper/petstore/README.md index cfd13021354..164048d493b 100644 --- a/samples/client/petstore/rust/hyper/petstore/README.md +++ b/samples/client/petstore/rust/hyper/petstore/README.md @@ -80,6 +80,7 @@ Class | Method | HTTP request | Description - [UniqueItemArrayTesting](docs/UniqueItemArrayTesting.md) - [User](docs/User.md) - [Vehicle](docs/Vehicle.md) + - [WithInnerOneOf](docs/WithInnerOneOf.md) To get access to the crate's generated documentation, use: diff --git a/samples/client/petstore/rust/hyper/petstore/docs/DuplicateOneOf.md b/samples/client/petstore/rust/hyper/petstore/docs/DuplicateOneOf.md new file mode 100644 index 00000000000..22b6b00f001 --- /dev/null +++ b/samples/client/petstore/rust/hyper/petstore/docs/DuplicateOneOf.md @@ -0,0 +1,11 @@ +# DuplicateOneOf + +## Enum Variants + +| Name | Description | +|---- | -----| +| Order | | + +[[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/WithInnerOneOf.md b/samples/client/petstore/rust/hyper/petstore/docs/WithInnerOneOf.md new file mode 100644 index 00000000000..93c6ada0387 --- /dev/null +++ b/samples/client/petstore/rust/hyper/petstore/docs/WithInnerOneOf.md @@ -0,0 +1,11 @@ +# WithInnerOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**foo** | Option<[**models::Order**](Order.md)> | | [optional] + +[[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/WithInnerOneOfFoo.md b/samples/client/petstore/rust/hyper/petstore/docs/WithInnerOneOfFoo.md new file mode 100644 index 00000000000..fcf524123ac --- /dev/null +++ b/samples/client/petstore/rust/hyper/petstore/docs/WithInnerOneOfFoo.md @@ -0,0 +1,11 @@ +# WithInnerOneOfFoo + +## Enum Variants + +| Name | Description | +|---- | -----| +| Order | | + +[[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/duplicate_one_of.rs b/samples/client/petstore/rust/hyper/petstore/src/models/duplicate_one_of.rs new file mode 100644 index 00000000000..e1039b65bcf --- /dev/null +++ b/samples/client/petstore/rust/hyper/petstore/src/models/duplicate_one_of.rs @@ -0,0 +1,41 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DuplicateOneOf { + Order(Box), +} + +impl Default for DuplicateOneOf { + fn default() -> Self { + Self::Order(Default::default()) + } +} +/// Order Status +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + Delivered, +} + +impl Default for Status { + fn default() -> Status { + Self::Placed + } +} + 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 aada8fbd0f5..7cdaa063edb 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/mod.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/mod.rs @@ -48,6 +48,8 @@ pub mod user; pub use self::user::User; pub mod vehicle; pub use self::vehicle::Vehicle; +pub mod with_inner_one_of; +pub use self::with_inner_one_of::WithInnerOneOf; use serde::{Deserialize, Deserializer, Serializer}; use serde_with::{de::DeserializeAsWrap, ser::SerializeAsWrap, DeserializeAs, SerializeAs}; use std::marker::PhantomData; diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/with_inner_one_of.rs b/samples/client/petstore/rust/hyper/petstore/src/models/with_inner_one_of.rs new file mode 100644 index 00000000000..a00c4e1c375 --- /dev/null +++ b/samples/client/petstore/rust/hyper/petstore/src/models/with_inner_one_of.rs @@ -0,0 +1,27 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct WithInnerOneOf { + #[serde(rename = "foo", skip_serializing_if = "Option::is_none")] + pub foo: Option>, +} + +impl WithInnerOneOf { + pub fn new() -> WithInnerOneOf { + WithInnerOneOf { + foo: None, + } + } +} + diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/with_inner_one_of_foo.rs b/samples/client/petstore/rust/hyper/petstore/src/models/with_inner_one_of_foo.rs new file mode 100644 index 00000000000..26ed4ce5f11 --- /dev/null +++ b/samples/client/petstore/rust/hyper/petstore/src/models/with_inner_one_of_foo.rs @@ -0,0 +1,41 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum WithInnerOneOfFoo { + Order(Box), +} + +impl Default for WithInnerOneOfFoo { + fn default() -> Self { + Self::Order(Default::default()) + } +} +/// Order Status +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + Delivered, +} + +impl Default for Status { + fn default() -> Status { + Self::Placed + } +} + diff --git a/samples/client/petstore/rust/hyper0x/petstore/.openapi-generator/FILES b/samples/client/petstore/rust/hyper0x/petstore/.openapi-generator/FILES index 917d2d668aa..bb1f8da36d1 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/.openapi-generator/FILES +++ b/samples/client/petstore/rust/hyper0x/petstore/.openapi-generator/FILES @@ -32,6 +32,7 @@ docs/UniqueItemArrayTesting.md docs/User.md docs/UserApi.md docs/Vehicle.md +docs/WithInnerOneOf.md git_push.sh src/apis/configuration.rs src/apis/fake_api.rs @@ -67,3 +68,4 @@ src/models/type_testing.rs src/models/unique_item_array_testing.rs src/models/user.rs src/models/vehicle.rs +src/models/with_inner_one_of.rs diff --git a/samples/client/petstore/rust/hyper0x/petstore/README.md b/samples/client/petstore/rust/hyper0x/petstore/README.md index 004e40b277c..567353a1d2d 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/README.md +++ b/samples/client/petstore/rust/hyper0x/petstore/README.md @@ -80,6 +80,7 @@ Class | Method | HTTP request | Description - [UniqueItemArrayTesting](docs/UniqueItemArrayTesting.md) - [User](docs/User.md) - [Vehicle](docs/Vehicle.md) + - [WithInnerOneOf](docs/WithInnerOneOf.md) To get access to the crate's generated documentation, use: diff --git a/samples/client/petstore/rust/hyper0x/petstore/docs/DuplicateOneOf.md b/samples/client/petstore/rust/hyper0x/petstore/docs/DuplicateOneOf.md new file mode 100644 index 00000000000..22b6b00f001 --- /dev/null +++ b/samples/client/petstore/rust/hyper0x/petstore/docs/DuplicateOneOf.md @@ -0,0 +1,11 @@ +# DuplicateOneOf + +## Enum Variants + +| Name | Description | +|---- | -----| +| Order | | + +[[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/hyper0x/petstore/docs/WithInnerOneOf.md b/samples/client/petstore/rust/hyper0x/petstore/docs/WithInnerOneOf.md new file mode 100644 index 00000000000..93c6ada0387 --- /dev/null +++ b/samples/client/petstore/rust/hyper0x/petstore/docs/WithInnerOneOf.md @@ -0,0 +1,11 @@ +# WithInnerOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**foo** | Option<[**models::Order**](Order.md)> | | [optional] + +[[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/hyper0x/petstore/docs/WithInnerOneOfFoo.md b/samples/client/petstore/rust/hyper0x/petstore/docs/WithInnerOneOfFoo.md new file mode 100644 index 00000000000..fcf524123ac --- /dev/null +++ b/samples/client/petstore/rust/hyper0x/petstore/docs/WithInnerOneOfFoo.md @@ -0,0 +1,11 @@ +# WithInnerOneOfFoo + +## Enum Variants + +| Name | Description | +|---- | -----| +| Order | | + +[[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/hyper0x/petstore/src/models/duplicate_one_of.rs b/samples/client/petstore/rust/hyper0x/petstore/src/models/duplicate_one_of.rs new file mode 100644 index 00000000000..e1039b65bcf --- /dev/null +++ b/samples/client/petstore/rust/hyper0x/petstore/src/models/duplicate_one_of.rs @@ -0,0 +1,41 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DuplicateOneOf { + Order(Box), +} + +impl Default for DuplicateOneOf { + fn default() -> Self { + Self::Order(Default::default()) + } +} +/// Order Status +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + Delivered, +} + +impl Default for Status { + fn default() -> Status { + Self::Placed + } +} + diff --git a/samples/client/petstore/rust/hyper0x/petstore/src/models/mod.rs b/samples/client/petstore/rust/hyper0x/petstore/src/models/mod.rs index aada8fbd0f5..7cdaa063edb 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/src/models/mod.rs +++ b/samples/client/petstore/rust/hyper0x/petstore/src/models/mod.rs @@ -48,6 +48,8 @@ pub mod user; pub use self::user::User; pub mod vehicle; pub use self::vehicle::Vehicle; +pub mod with_inner_one_of; +pub use self::with_inner_one_of::WithInnerOneOf; use serde::{Deserialize, Deserializer, Serializer}; use serde_with::{de::DeserializeAsWrap, ser::SerializeAsWrap, DeserializeAs, SerializeAs}; use std::marker::PhantomData; diff --git a/samples/client/petstore/rust/hyper0x/petstore/src/models/with_inner_one_of.rs b/samples/client/petstore/rust/hyper0x/petstore/src/models/with_inner_one_of.rs new file mode 100644 index 00000000000..a00c4e1c375 --- /dev/null +++ b/samples/client/petstore/rust/hyper0x/petstore/src/models/with_inner_one_of.rs @@ -0,0 +1,27 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct WithInnerOneOf { + #[serde(rename = "foo", skip_serializing_if = "Option::is_none")] + pub foo: Option>, +} + +impl WithInnerOneOf { + pub fn new() -> WithInnerOneOf { + WithInnerOneOf { + foo: None, + } + } +} + diff --git a/samples/client/petstore/rust/hyper0x/petstore/src/models/with_inner_one_of_foo.rs b/samples/client/petstore/rust/hyper0x/petstore/src/models/with_inner_one_of_foo.rs new file mode 100644 index 00000000000..26ed4ce5f11 --- /dev/null +++ b/samples/client/petstore/rust/hyper0x/petstore/src/models/with_inner_one_of_foo.rs @@ -0,0 +1,41 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum WithInnerOneOfFoo { + Order(Box), +} + +impl Default for WithInnerOneOfFoo { + fn default() -> Self { + Self::Order(Default::default()) + } +} +/// Order Status +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + Delivered, +} + +impl Default for Status { + fn default() -> Status { + Self::Placed + } +} + diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest-trait/petstore/.openapi-generator/FILES index 917d2d668aa..bb1f8da36d1 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest-trait/petstore/.openapi-generator/FILES @@ -32,6 +32,7 @@ docs/UniqueItemArrayTesting.md docs/User.md docs/UserApi.md docs/Vehicle.md +docs/WithInnerOneOf.md git_push.sh src/apis/configuration.rs src/apis/fake_api.rs @@ -67,3 +68,4 @@ src/models/type_testing.rs src/models/unique_item_array_testing.rs src/models/user.rs src/models/vehicle.rs +src/models/with_inner_one_of.rs diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/README.md b/samples/client/petstore/rust/reqwest-trait/petstore/README.md index d0e487fa629..c9cc16b3075 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/README.md +++ b/samples/client/petstore/rust/reqwest-trait/petstore/README.md @@ -80,6 +80,7 @@ Class | Method | HTTP request | Description - [UniqueItemArrayTesting](docs/UniqueItemArrayTesting.md) - [User](docs/User.md) - [Vehicle](docs/Vehicle.md) + - [WithInnerOneOf](docs/WithInnerOneOf.md) To get access to the crate's generated documentation, use: diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/docs/DuplicateOneOf.md b/samples/client/petstore/rust/reqwest-trait/petstore/docs/DuplicateOneOf.md new file mode 100644 index 00000000000..22b6b00f001 --- /dev/null +++ b/samples/client/petstore/rust/reqwest-trait/petstore/docs/DuplicateOneOf.md @@ -0,0 +1,11 @@ +# DuplicateOneOf + +## Enum Variants + +| Name | Description | +|---- | -----| +| Order | | + +[[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-trait/petstore/docs/WithInnerOneOf.md b/samples/client/petstore/rust/reqwest-trait/petstore/docs/WithInnerOneOf.md new file mode 100644 index 00000000000..93c6ada0387 --- /dev/null +++ b/samples/client/petstore/rust/reqwest-trait/petstore/docs/WithInnerOneOf.md @@ -0,0 +1,11 @@ +# WithInnerOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**foo** | Option<[**models::Order**](Order.md)> | | [optional] + +[[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-trait/petstore/docs/WithInnerOneOfFoo.md b/samples/client/petstore/rust/reqwest-trait/petstore/docs/WithInnerOneOfFoo.md new file mode 100644 index 00000000000..fcf524123ac --- /dev/null +++ b/samples/client/petstore/rust/reqwest-trait/petstore/docs/WithInnerOneOfFoo.md @@ -0,0 +1,11 @@ +# WithInnerOneOfFoo + +## Enum Variants + +| Name | Description | +|---- | -----| +| Order | | + +[[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-trait/petstore/src/models/duplicate_one_of.rs b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/duplicate_one_of.rs new file mode 100644 index 00000000000..ad47a777dae --- /dev/null +++ b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/duplicate_one_of.rs @@ -0,0 +1,41 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DuplicateOneOf { + Order(Box), +} + +impl Default for DuplicateOneOf { + fn default() -> Self { + Self::Order(Default::default()) + } +} +/// Order Status +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + shipped, +} + +impl Default for Status { + fn default() -> Status { + Self::Placed + } +} + diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/src/models/mod.rs b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/mod.rs index aada8fbd0f5..7cdaa063edb 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/mod.rs @@ -48,6 +48,8 @@ pub mod user; pub use self::user::User; pub mod vehicle; pub use self::vehicle::Vehicle; +pub mod with_inner_one_of; +pub use self::with_inner_one_of::WithInnerOneOf; use serde::{Deserialize, Deserializer, Serializer}; use serde_with::{de::DeserializeAsWrap, ser::SerializeAsWrap, DeserializeAs, SerializeAs}; use std::marker::PhantomData; diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/src/models/with_inner_one_of.rs b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/with_inner_one_of.rs new file mode 100644 index 00000000000..a00c4e1c375 --- /dev/null +++ b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/with_inner_one_of.rs @@ -0,0 +1,27 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct WithInnerOneOf { + #[serde(rename = "foo", skip_serializing_if = "Option::is_none")] + pub foo: Option>, +} + +impl WithInnerOneOf { + pub fn new() -> WithInnerOneOf { + WithInnerOneOf { + foo: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/src/models/with_inner_one_of_foo.rs b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/with_inner_one_of_foo.rs new file mode 100644 index 00000000000..9917806aa62 --- /dev/null +++ b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/with_inner_one_of_foo.rs @@ -0,0 +1,41 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum WithInnerOneOfFoo { + Order(Box), +} + +impl Default for WithInnerOneOfFoo { + fn default() -> Self { + Self::Order(Default::default()) + } +} +/// Order Status +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + shipped, +} + +impl Default for Status { + fn default() -> Status { + Self::Placed + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest/petstore-async-middleware/.openapi-generator/FILES index 917d2d668aa..bb1f8da36d1 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/.openapi-generator/FILES @@ -32,6 +32,7 @@ docs/UniqueItemArrayTesting.md docs/User.md docs/UserApi.md docs/Vehicle.md +docs/WithInnerOneOf.md git_push.sh src/apis/configuration.rs src/apis/fake_api.rs @@ -67,3 +68,4 @@ src/models/type_testing.rs src/models/unique_item_array_testing.rs src/models/user.rs src/models/vehicle.rs +src/models/with_inner_one_of.rs diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/README.md b/samples/client/petstore/rust/reqwest/petstore-async-middleware/README.md index ff02477fd89..a3bd1d24642 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/README.md +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/README.md @@ -80,6 +80,7 @@ Class | Method | HTTP request | Description - [UniqueItemArrayTesting](docs/UniqueItemArrayTesting.md) - [User](docs/User.md) - [Vehicle](docs/Vehicle.md) + - [WithInnerOneOf](docs/WithInnerOneOf.md) To get access to the crate's generated documentation, use: diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/DuplicateOneOf.md b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/DuplicateOneOf.md new file mode 100644 index 00000000000..22b6b00f001 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/DuplicateOneOf.md @@ -0,0 +1,11 @@ +# DuplicateOneOf + +## Enum Variants + +| Name | Description | +|---- | -----| +| Order | | + +[[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-async-middleware/docs/WithInnerOneOf.md b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/WithInnerOneOf.md new file mode 100644 index 00000000000..93c6ada0387 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/WithInnerOneOf.md @@ -0,0 +1,11 @@ +# WithInnerOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**foo** | Option<[**models::Order**](Order.md)> | | [optional] + +[[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-async-middleware/docs/WithInnerOneOfFoo.md b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/WithInnerOneOfFoo.md new file mode 100644 index 00000000000..fcf524123ac --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/WithInnerOneOfFoo.md @@ -0,0 +1,11 @@ +# WithInnerOneOfFoo + +## Enum Variants + +| Name | Description | +|---- | -----| +| Order | | + +[[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-async-middleware/src/models/duplicate_one_of.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/duplicate_one_of.rs new file mode 100644 index 00000000000..e1039b65bcf --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/duplicate_one_of.rs @@ -0,0 +1,41 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DuplicateOneOf { + Order(Box), +} + +impl Default for DuplicateOneOf { + fn default() -> Self { + Self::Order(Default::default()) + } +} +/// Order Status +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + Delivered, +} + +impl Default for Status { + fn default() -> Status { + Self::Placed + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/mod.rs index aada8fbd0f5..7cdaa063edb 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/mod.rs @@ -48,6 +48,8 @@ pub mod user; pub use self::user::User; pub mod vehicle; pub use self::vehicle::Vehicle; +pub mod with_inner_one_of; +pub use self::with_inner_one_of::WithInnerOneOf; use serde::{Deserialize, Deserializer, Serializer}; use serde_with::{de::DeserializeAsWrap, ser::SerializeAsWrap, DeserializeAs, SerializeAs}; use std::marker::PhantomData; diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/with_inner_one_of.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/with_inner_one_of.rs new file mode 100644 index 00000000000..a00c4e1c375 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/with_inner_one_of.rs @@ -0,0 +1,27 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct WithInnerOneOf { + #[serde(rename = "foo", skip_serializing_if = "Option::is_none")] + pub foo: Option>, +} + +impl WithInnerOneOf { + pub fn new() -> WithInnerOneOf { + WithInnerOneOf { + foo: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/with_inner_one_of_foo.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/with_inner_one_of_foo.rs new file mode 100644 index 00000000000..26ed4ce5f11 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/with_inner_one_of_foo.rs @@ -0,0 +1,41 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum WithInnerOneOfFoo { + Order(Box), +} + +impl Default for WithInnerOneOfFoo { + fn default() -> Self { + Self::Order(Default::default()) + } +} +/// Order Status +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + Delivered, +} + +impl Default for Status { + fn default() -> Status { + Self::Placed + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/.openapi-generator/FILES index 917d2d668aa..bb1f8da36d1 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/.openapi-generator/FILES @@ -32,6 +32,7 @@ docs/UniqueItemArrayTesting.md docs/User.md docs/UserApi.md docs/Vehicle.md +docs/WithInnerOneOf.md git_push.sh src/apis/configuration.rs src/apis/fake_api.rs @@ -67,3 +68,4 @@ src/models/type_testing.rs src/models/unique_item_array_testing.rs src/models/user.rs src/models/vehicle.rs +src/models/with_inner_one_of.rs diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/README.md b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/README.md index f9a3f3064a9..b717783e955 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/README.md +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/README.md @@ -80,6 +80,7 @@ Class | Method | HTTP request | Description - [UniqueItemArrayTesting](docs/UniqueItemArrayTesting.md) - [User](docs/User.md) - [Vehicle](docs/Vehicle.md) + - [WithInnerOneOf](docs/WithInnerOneOf.md) To get access to the crate's generated documentation, use: diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/DuplicateOneOf.md b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/DuplicateOneOf.md new file mode 100644 index 00000000000..22b6b00f001 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/DuplicateOneOf.md @@ -0,0 +1,11 @@ +# DuplicateOneOf + +## Enum Variants + +| Name | Description | +|---- | -----| +| Order | | + +[[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-async-tokensource/docs/WithInnerOneOf.md b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/WithInnerOneOf.md new file mode 100644 index 00000000000..93c6ada0387 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/WithInnerOneOf.md @@ -0,0 +1,11 @@ +# WithInnerOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**foo** | Option<[**models::Order**](Order.md)> | | [optional] + +[[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-async-tokensource/docs/WithInnerOneOfFoo.md b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/WithInnerOneOfFoo.md new file mode 100644 index 00000000000..fcf524123ac --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/WithInnerOneOfFoo.md @@ -0,0 +1,11 @@ +# WithInnerOneOfFoo + +## Enum Variants + +| Name | Description | +|---- | -----| +| Order | | + +[[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-async-tokensource/src/models/duplicate_one_of.rs b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/duplicate_one_of.rs new file mode 100644 index 00000000000..e1039b65bcf --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/duplicate_one_of.rs @@ -0,0 +1,41 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DuplicateOneOf { + Order(Box), +} + +impl Default for DuplicateOneOf { + fn default() -> Self { + Self::Order(Default::default()) + } +} +/// Order Status +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + Delivered, +} + +impl Default for Status { + fn default() -> Status { + Self::Placed + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/mod.rs index aada8fbd0f5..7cdaa063edb 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/mod.rs @@ -48,6 +48,8 @@ pub mod user; pub use self::user::User; pub mod vehicle; pub use self::vehicle::Vehicle; +pub mod with_inner_one_of; +pub use self::with_inner_one_of::WithInnerOneOf; use serde::{Deserialize, Deserializer, Serializer}; use serde_with::{de::DeserializeAsWrap, ser::SerializeAsWrap, DeserializeAs, SerializeAs}; use std::marker::PhantomData; diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/with_inner_one_of.rs b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/with_inner_one_of.rs new file mode 100644 index 00000000000..a00c4e1c375 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/with_inner_one_of.rs @@ -0,0 +1,27 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct WithInnerOneOf { + #[serde(rename = "foo", skip_serializing_if = "Option::is_none")] + pub foo: Option>, +} + +impl WithInnerOneOf { + pub fn new() -> WithInnerOneOf { + WithInnerOneOf { + foo: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/with_inner_one_of_foo.rs b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/with_inner_one_of_foo.rs new file mode 100644 index 00000000000..26ed4ce5f11 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/with_inner_one_of_foo.rs @@ -0,0 +1,41 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum WithInnerOneOfFoo { + Order(Box), +} + +impl Default for WithInnerOneOfFoo { + fn default() -> Self { + Self::Order(Default::default()) + } +} +/// Order Status +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + Delivered, +} + +impl Default for Status { + fn default() -> Status { + Self::Placed + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-async/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest/petstore-async/.openapi-generator/FILES index 917d2d668aa..bb1f8da36d1 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest/petstore-async/.openapi-generator/FILES @@ -32,6 +32,7 @@ docs/UniqueItemArrayTesting.md docs/User.md docs/UserApi.md docs/Vehicle.md +docs/WithInnerOneOf.md git_push.sh src/apis/configuration.rs src/apis/fake_api.rs @@ -67,3 +68,4 @@ src/models/type_testing.rs src/models/unique_item_array_testing.rs src/models/user.rs src/models/vehicle.rs +src/models/with_inner_one_of.rs diff --git a/samples/client/petstore/rust/reqwest/petstore-async/README.md b/samples/client/petstore/rust/reqwest/petstore-async/README.md index 1b9b248b3b1..69502f2f6be 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/README.md +++ b/samples/client/petstore/rust/reqwest/petstore-async/README.md @@ -80,6 +80,7 @@ Class | Method | HTTP request | Description - [UniqueItemArrayTesting](docs/UniqueItemArrayTesting.md) - [User](docs/User.md) - [Vehicle](docs/Vehicle.md) + - [WithInnerOneOf](docs/WithInnerOneOf.md) To get access to the crate's generated documentation, use: diff --git a/samples/client/petstore/rust/reqwest/petstore-async/docs/DuplicateOneOf.md b/samples/client/petstore/rust/reqwest/petstore-async/docs/DuplicateOneOf.md new file mode 100644 index 00000000000..22b6b00f001 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async/docs/DuplicateOneOf.md @@ -0,0 +1,11 @@ +# DuplicateOneOf + +## Enum Variants + +| Name | Description | +|---- | -----| +| Order | | + +[[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-async/docs/WithInnerOneOf.md b/samples/client/petstore/rust/reqwest/petstore-async/docs/WithInnerOneOf.md new file mode 100644 index 00000000000..93c6ada0387 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async/docs/WithInnerOneOf.md @@ -0,0 +1,11 @@ +# WithInnerOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**foo** | Option<[**models::Order**](Order.md)> | | [optional] + +[[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-async/docs/WithInnerOneOfFoo.md b/samples/client/petstore/rust/reqwest/petstore-async/docs/WithInnerOneOfFoo.md new file mode 100644 index 00000000000..fcf524123ac --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async/docs/WithInnerOneOfFoo.md @@ -0,0 +1,11 @@ +# WithInnerOneOfFoo + +## Enum Variants + +| Name | Description | +|---- | -----| +| Order | | + +[[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-async/src/models/duplicate_one_of.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/duplicate_one_of.rs new file mode 100644 index 00000000000..e1039b65bcf --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/duplicate_one_of.rs @@ -0,0 +1,41 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DuplicateOneOf { + Order(Box), +} + +impl Default for DuplicateOneOf { + fn default() -> Self { + Self::Order(Default::default()) + } +} +/// Order Status +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + Delivered, +} + +impl Default for Status { + fn default() -> Status { + Self::Placed + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/mod.rs index aada8fbd0f5..7cdaa063edb 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/mod.rs @@ -48,6 +48,8 @@ pub mod user; pub use self::user::User; pub mod vehicle; pub use self::vehicle::Vehicle; +pub mod with_inner_one_of; +pub use self::with_inner_one_of::WithInnerOneOf; use serde::{Deserialize, Deserializer, Serializer}; use serde_with::{de::DeserializeAsWrap, ser::SerializeAsWrap, DeserializeAs, SerializeAs}; use std::marker::PhantomData; diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/with_inner_one_of.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/with_inner_one_of.rs new file mode 100644 index 00000000000..a00c4e1c375 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/with_inner_one_of.rs @@ -0,0 +1,27 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct WithInnerOneOf { + #[serde(rename = "foo", skip_serializing_if = "Option::is_none")] + pub foo: Option>, +} + +impl WithInnerOneOf { + pub fn new() -> WithInnerOneOf { + WithInnerOneOf { + foo: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/with_inner_one_of_foo.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/with_inner_one_of_foo.rs new file mode 100644 index 00000000000..26ed4ce5f11 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/with_inner_one_of_foo.rs @@ -0,0 +1,41 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum WithInnerOneOfFoo { + Order(Box), +} + +impl Default for WithInnerOneOfFoo { + fn default() -> Self { + Self::Order(Default::default()) + } +} +/// Order Status +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + Delivered, +} + +impl Default for Status { + fn default() -> Status { + Self::Placed + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest/petstore-avoid-box/.openapi-generator/FILES index 917d2d668aa..bb1f8da36d1 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/.openapi-generator/FILES @@ -32,6 +32,7 @@ docs/UniqueItemArrayTesting.md docs/User.md docs/UserApi.md docs/Vehicle.md +docs/WithInnerOneOf.md git_push.sh src/apis/configuration.rs src/apis/fake_api.rs @@ -67,3 +68,4 @@ src/models/type_testing.rs src/models/unique_item_array_testing.rs src/models/user.rs src/models/vehicle.rs +src/models/with_inner_one_of.rs diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/README.md b/samples/client/petstore/rust/reqwest/petstore-avoid-box/README.md index ccd59027dd2..48fdd05c464 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/README.md +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/README.md @@ -80,6 +80,7 @@ Class | Method | HTTP request | Description - [UniqueItemArrayTesting](docs/UniqueItemArrayTesting.md) - [User](docs/User.md) - [Vehicle](docs/Vehicle.md) + - [WithInnerOneOf](docs/WithInnerOneOf.md) To get access to the crate's generated documentation, use: diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/DuplicateOneOf.md b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/DuplicateOneOf.md new file mode 100644 index 00000000000..22b6b00f001 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/DuplicateOneOf.md @@ -0,0 +1,11 @@ +# DuplicateOneOf + +## Enum Variants + +| Name | Description | +|---- | -----| +| Order | | + +[[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-avoid-box/docs/WithInnerOneOf.md b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/WithInnerOneOf.md new file mode 100644 index 00000000000..93c6ada0387 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/WithInnerOneOf.md @@ -0,0 +1,11 @@ +# WithInnerOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**foo** | Option<[**models::Order**](Order.md)> | | [optional] + +[[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-avoid-box/docs/WithInnerOneOfFoo.md b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/WithInnerOneOfFoo.md new file mode 100644 index 00000000000..fcf524123ac --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/WithInnerOneOfFoo.md @@ -0,0 +1,11 @@ +# WithInnerOneOfFoo + +## Enum Variants + +| Name | Description | +|---- | -----| +| Order | | + +[[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-avoid-box/src/models/duplicate_one_of.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/duplicate_one_of.rs new file mode 100644 index 00000000000..383d7222812 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/duplicate_one_of.rs @@ -0,0 +1,41 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DuplicateOneOf { + Order(models::Order), +} + +impl Default for DuplicateOneOf { + fn default() -> Self { + Self::Order(Default::default()) + } +} +/// Order Status +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + Delivered, +} + +impl Default for Status { + fn default() -> Status { + Self::Placed + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/mod.rs index aada8fbd0f5..7cdaa063edb 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/mod.rs @@ -48,6 +48,8 @@ pub mod user; pub use self::user::User; pub mod vehicle; pub use self::vehicle::Vehicle; +pub mod with_inner_one_of; +pub use self::with_inner_one_of::WithInnerOneOf; use serde::{Deserialize, Deserializer, Serializer}; use serde_with::{de::DeserializeAsWrap, ser::SerializeAsWrap, DeserializeAs, SerializeAs}; use std::marker::PhantomData; diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/with_inner_one_of.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/with_inner_one_of.rs new file mode 100644 index 00000000000..d866dda9523 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/with_inner_one_of.rs @@ -0,0 +1,27 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct WithInnerOneOf { + #[serde(rename = "foo", skip_serializing_if = "Option::is_none")] + pub foo: Option, +} + +impl WithInnerOneOf { + pub fn new() -> WithInnerOneOf { + WithInnerOneOf { + foo: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/with_inner_one_of_foo.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/with_inner_one_of_foo.rs new file mode 100644 index 00000000000..a0263960c69 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/with_inner_one_of_foo.rs @@ -0,0 +1,41 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum WithInnerOneOfFoo { + Order(models::Order), +} + +impl Default for WithInnerOneOfFoo { + fn default() -> Self { + Self::Order(Default::default()) + } +} +/// Order Status +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + Delivered, +} + +impl Default for Status { + fn default() -> Status { + Self::Placed + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/.openapi-generator/FILES index 917d2d668aa..bb1f8da36d1 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/.openapi-generator/FILES @@ -32,6 +32,7 @@ docs/UniqueItemArrayTesting.md docs/User.md docs/UserApi.md docs/Vehicle.md +docs/WithInnerOneOf.md git_push.sh src/apis/configuration.rs src/apis/fake_api.rs @@ -67,3 +68,4 @@ src/models/type_testing.rs src/models/unique_item_array_testing.rs src/models/user.rs src/models/vehicle.rs +src/models/with_inner_one_of.rs diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/README.md b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/README.md index 7796e5b6cdb..fb71914ebef 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/README.md +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/README.md @@ -80,6 +80,7 @@ Class | Method | HTTP request | Description - [UniqueItemArrayTesting](docs/UniqueItemArrayTesting.md) - [User](docs/User.md) - [Vehicle](docs/Vehicle.md) + - [WithInnerOneOf](docs/WithInnerOneOf.md) To get access to the crate's generated documentation, use: diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/DuplicateOneOf.md b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/DuplicateOneOf.md new file mode 100644 index 00000000000..22b6b00f001 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/DuplicateOneOf.md @@ -0,0 +1,11 @@ +# DuplicateOneOf + +## Enum Variants + +| Name | Description | +|---- | -----| +| Order | | + +[[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-awsv4signature/docs/WithInnerOneOf.md b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/WithInnerOneOf.md new file mode 100644 index 00000000000..93c6ada0387 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/WithInnerOneOf.md @@ -0,0 +1,11 @@ +# WithInnerOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**foo** | Option<[**models::Order**](Order.md)> | | [optional] + +[[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-awsv4signature/docs/WithInnerOneOfFoo.md b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/WithInnerOneOfFoo.md new file mode 100644 index 00000000000..fcf524123ac --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/WithInnerOneOfFoo.md @@ -0,0 +1,11 @@ +# WithInnerOneOfFoo + +## Enum Variants + +| Name | Description | +|---- | -----| +| Order | | + +[[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-awsv4signature/src/models/duplicate_one_of.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/duplicate_one_of.rs new file mode 100644 index 00000000000..e1039b65bcf --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/duplicate_one_of.rs @@ -0,0 +1,41 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DuplicateOneOf { + Order(Box), +} + +impl Default for DuplicateOneOf { + fn default() -> Self { + Self::Order(Default::default()) + } +} +/// Order Status +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + Delivered, +} + +impl Default for Status { + fn default() -> Status { + Self::Placed + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/mod.rs index aada8fbd0f5..7cdaa063edb 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/mod.rs @@ -48,6 +48,8 @@ pub mod user; pub use self::user::User; pub mod vehicle; pub use self::vehicle::Vehicle; +pub mod with_inner_one_of; +pub use self::with_inner_one_of::WithInnerOneOf; use serde::{Deserialize, Deserializer, Serializer}; use serde_with::{de::DeserializeAsWrap, ser::SerializeAsWrap, DeserializeAs, SerializeAs}; use std::marker::PhantomData; diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/with_inner_one_of.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/with_inner_one_of.rs new file mode 100644 index 00000000000..a00c4e1c375 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/with_inner_one_of.rs @@ -0,0 +1,27 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct WithInnerOneOf { + #[serde(rename = "foo", skip_serializing_if = "Option::is_none")] + pub foo: Option>, +} + +impl WithInnerOneOf { + pub fn new() -> WithInnerOneOf { + WithInnerOneOf { + foo: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/with_inner_one_of_foo.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/with_inner_one_of_foo.rs new file mode 100644 index 00000000000..26ed4ce5f11 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/with_inner_one_of_foo.rs @@ -0,0 +1,41 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum WithInnerOneOfFoo { + Order(Box), +} + +impl Default for WithInnerOneOfFoo { + fn default() -> Self { + Self::Order(Default::default()) + } +} +/// Order Status +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + Delivered, +} + +impl Default for Status { + fn default() -> Status { + Self::Placed + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/.openapi-generator/FILES index f30b5806dff..abb373467d5 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/.openapi-generator/FILES @@ -28,6 +28,7 @@ docs/FooTypeTesting.md docs/FooUniqueItemArrayTesting.md docs/FooUser.md docs/FooVehicle.md +docs/FooWithInnerOneOf.md docs/PetApi.md docs/StoreApi.md docs/TestingApi.md @@ -66,4 +67,5 @@ src/models/foo_type_testing.rs src/models/foo_unique_item_array_testing.rs src/models/foo_user.rs src/models/foo_vehicle.rs +src/models/foo_with_inner_one_of.rs src/models/mod.rs diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/README.md b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/README.md index 22beee371b7..a89804b595f 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/README.md +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/README.md @@ -80,6 +80,7 @@ Class | Method | HTTP request | Description - [FooUniqueItemArrayTesting](docs/FooUniqueItemArrayTesting.md) - [FooUser](docs/FooUser.md) - [FooVehicle](docs/FooVehicle.md) + - [FooWithInnerOneOf](docs/FooWithInnerOneOf.md) To get access to the crate's generated documentation, use: diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooDuplicateOneOf.md b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooDuplicateOneOf.md new file mode 100644 index 00000000000..4211ad2165b --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooDuplicateOneOf.md @@ -0,0 +1,11 @@ +# FooDuplicateOneOf + +## Enum Variants + +| Name | Description | +|---- | -----| +| FooOrder | | + +[[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-model-name-prefix/docs/FooWithInnerOneOf.md b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooWithInnerOneOf.md new file mode 100644 index 00000000000..00bfa96be53 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooWithInnerOneOf.md @@ -0,0 +1,11 @@ +# FooWithInnerOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**foo** | Option<[**models::FooOrder**](Order.md)> | | [optional] + +[[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-model-name-prefix/docs/FooWithInnerOneOfFoo.md b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooWithInnerOneOfFoo.md new file mode 100644 index 00000000000..ab75509a196 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooWithInnerOneOfFoo.md @@ -0,0 +1,11 @@ +# FooWithInnerOneOfFoo + +## Enum Variants + +| Name | Description | +|---- | -----| +| FooOrder | | + +[[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-model-name-prefix/src/models/foo_duplicate_one_of.rs b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo_duplicate_one_of.rs new file mode 100644 index 00000000000..088a6056eea --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo_duplicate_one_of.rs @@ -0,0 +1,41 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum FooDuplicateOneOf { + FooOrder(Box), +} + +impl Default for FooDuplicateOneOf { + fn default() -> Self { + Self::FooOrder(Default::default()) + } +} +/// Order Status +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + shipped, +} + +impl Default for Status { + fn default() -> Status { + Self::Placed + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo_with_inner_one_of.rs b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo_with_inner_one_of.rs new file mode 100644 index 00000000000..bfb6a694e5b --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo_with_inner_one_of.rs @@ -0,0 +1,27 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct FooWithInnerOneOf { + #[serde(rename = "foo", skip_serializing_if = "Option::is_none")] + pub foo: Option>, +} + +impl FooWithInnerOneOf { + pub fn new() -> FooWithInnerOneOf { + FooWithInnerOneOf { + foo: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo_with_inner_one_of_foo.rs b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo_with_inner_one_of_foo.rs new file mode 100644 index 00000000000..8dea145e398 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo_with_inner_one_of_foo.rs @@ -0,0 +1,41 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum FooWithInnerOneOfFoo { + FooOrder(Box), +} + +impl Default for FooWithInnerOneOfFoo { + fn default() -> Self { + Self::FooOrder(Default::default()) + } +} +/// Order Status +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + shipped, +} + +impl Default for Status { + fn default() -> Status { + Self::Placed + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/mod.rs index 4bf93a9d6c4..b08f685662b 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/mod.rs @@ -48,6 +48,8 @@ pub mod foo_user; pub use self::foo_user::FooUser; pub mod foo_vehicle; pub use self::foo_vehicle::FooVehicle; +pub mod foo_with_inner_one_of; +pub use self::foo_with_inner_one_of::FooWithInnerOneOf; use serde::{Deserialize, Deserializer, Serializer}; use serde_with::{de::DeserializeAsWrap, ser::SerializeAsWrap, DeserializeAs, SerializeAs}; use std::marker::PhantomData; diff --git a/samples/client/petstore/rust/reqwest/petstore/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest/petstore/.openapi-generator/FILES index 917d2d668aa..bb1f8da36d1 100644 --- a/samples/client/petstore/rust/reqwest/petstore/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest/petstore/.openapi-generator/FILES @@ -32,6 +32,7 @@ docs/UniqueItemArrayTesting.md docs/User.md docs/UserApi.md docs/Vehicle.md +docs/WithInnerOneOf.md git_push.sh src/apis/configuration.rs src/apis/fake_api.rs @@ -67,3 +68,4 @@ src/models/type_testing.rs src/models/unique_item_array_testing.rs src/models/user.rs src/models/vehicle.rs +src/models/with_inner_one_of.rs diff --git a/samples/client/petstore/rust/reqwest/petstore/README.md b/samples/client/petstore/rust/reqwest/petstore/README.md index d0e487fa629..c9cc16b3075 100644 --- a/samples/client/petstore/rust/reqwest/petstore/README.md +++ b/samples/client/petstore/rust/reqwest/petstore/README.md @@ -80,6 +80,7 @@ Class | Method | HTTP request | Description - [UniqueItemArrayTesting](docs/UniqueItemArrayTesting.md) - [User](docs/User.md) - [Vehicle](docs/Vehicle.md) + - [WithInnerOneOf](docs/WithInnerOneOf.md) To get access to the crate's generated documentation, use: diff --git a/samples/client/petstore/rust/reqwest/petstore/docs/DuplicateOneOf.md b/samples/client/petstore/rust/reqwest/petstore/docs/DuplicateOneOf.md new file mode 100644 index 00000000000..22b6b00f001 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore/docs/DuplicateOneOf.md @@ -0,0 +1,11 @@ +# DuplicateOneOf + +## Enum Variants + +| Name | Description | +|---- | -----| +| Order | | + +[[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/WithInnerOneOf.md b/samples/client/petstore/rust/reqwest/petstore/docs/WithInnerOneOf.md new file mode 100644 index 00000000000..93c6ada0387 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore/docs/WithInnerOneOf.md @@ -0,0 +1,11 @@ +# WithInnerOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**foo** | Option<[**models::Order**](Order.md)> | | [optional] + +[[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/WithInnerOneOfFoo.md b/samples/client/petstore/rust/reqwest/petstore/docs/WithInnerOneOfFoo.md new file mode 100644 index 00000000000..fcf524123ac --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore/docs/WithInnerOneOfFoo.md @@ -0,0 +1,11 @@ +# WithInnerOneOfFoo + +## Enum Variants + +| Name | Description | +|---- | -----| +| Order | | + +[[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/duplicate_one_of.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/duplicate_one_of.rs new file mode 100644 index 00000000000..ad47a777dae --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/duplicate_one_of.rs @@ -0,0 +1,41 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DuplicateOneOf { + Order(Box), +} + +impl Default for DuplicateOneOf { + fn default() -> Self { + Self::Order(Default::default()) + } +} +/// Order Status +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + shipped, +} + +impl Default for Status { + fn default() -> Status { + Self::Placed + } +} + 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 aada8fbd0f5..7cdaa063edb 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/mod.rs @@ -48,6 +48,8 @@ pub mod user; pub use self::user::User; pub mod vehicle; pub use self::vehicle::Vehicle; +pub mod with_inner_one_of; +pub use self::with_inner_one_of::WithInnerOneOf; use serde::{Deserialize, Deserializer, Serializer}; use serde_with::{de::DeserializeAsWrap, ser::SerializeAsWrap, DeserializeAs, SerializeAs}; use std::marker::PhantomData; diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/with_inner_one_of.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/with_inner_one_of.rs new file mode 100644 index 00000000000..a00c4e1c375 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/with_inner_one_of.rs @@ -0,0 +1,27 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct WithInnerOneOf { + #[serde(rename = "foo", skip_serializing_if = "Option::is_none")] + pub foo: Option>, +} + +impl WithInnerOneOf { + pub fn new() -> WithInnerOneOf { + WithInnerOneOf { + foo: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/with_inner_one_of_foo.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/with_inner_one_of_foo.rs new file mode 100644 index 00000000000..9917806aa62 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/with_inner_one_of_foo.rs @@ -0,0 +1,41 @@ +/* + * 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 + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum WithInnerOneOfFoo { + Order(Box), +} + +impl Default for WithInnerOneOfFoo { + fn default() -> Self { + Self::Order(Default::default()) + } +} +/// Order Status +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + shipped, +} + +impl Default for Status { + fn default() -> Status { + Self::Placed + } +} +