diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 2cf47ef4748..741c6680f1b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -7196,7 +7196,7 @@ public class DefaultCodegen implements CodegenConfig { Schema original = null; // check if it's allOf (only 1 sub schema) with or without default/nullable/etc set in the top level if (ModelUtils.isAllOf(schema) && schema.getAllOf().size() == 1 && - ModelUtils.getType(schema) == null) { + (ModelUtils.getType(schema) == null || "object".equals(ModelUtils.getType(schema)))) { if (schema.getAllOf().get(0) instanceof Schema) { original = schema; schema = (Schema) schema.getAllOf().get(0); @@ -7849,7 +7849,7 @@ public class DefaultCodegen implements CodegenConfig { Schema original = null; // check if it's allOf (only 1 sub schema) with or without default/nullable/etc set in the top level if (ModelUtils.isAllOf(schema) && schema.getAllOf().size() == 1 && - ModelUtils.getType(schema) == null) { + (ModelUtils.getType(schema) == null || "object".equals(ModelUtils.getType(schema)))) { if (schema.getAllOf().get(0) instanceof Schema) { original = schema; schema = (Schema) schema.getAllOf().get(0); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java index a59c1528086..0493d3507b3 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java @@ -3990,11 +3990,6 @@ public class DefaultCodegenTest { CodegenOperation co; CodegenParameter cp; - path = "/ComposedObject"; - co = codegen.fromOperation(path, "GET", openAPI.getPaths().get(path).getGet(), null); - cp = co.bodyParam; - assertTrue(cp.getIsMap()); - path = "/ComposedNumber"; co = codegen.fromOperation(path, "GET", openAPI.getPaths().get(path).getGet(), null); cp = co.bodyParam; 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 f7d7c341029..ced7450529e 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 @@ -676,6 +676,26 @@ paths: student: '#/components/schemas/Person' teacher: '#/components/schemas/Person' car: '#/components/schemas/Vehicle' + '/tests/allOfWithOneModel': + get: + tags: + - testing + summary: 'Test for allOf with a single option. (One of the issues in #20500)' + requestBody: + required: true + content: + application/json: + schema: + type: object + allOf: + - $ref: '#/components/schemas/Person' + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string externalDocs: description: Find out more about Swagger url: 'http://swagger.io' diff --git a/samples/client/petstore/rust/hyper/petstore/README.md b/samples/client/petstore/rust/hyper/petstore/README.md index 92692572d98..967ae70f6e5 100644 --- a/samples/client/petstore/rust/hyper/petstore/README.md +++ b/samples/client/petstore/rust/hyper/petstore/README.md @@ -39,6 +39,7 @@ Class | Method | HTTP request | Description *StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **Get** /store/inventory | Returns pet inventories by status *StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **Get** /store/order/{orderId} | Find purchase order by ID *StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **Post** /store/order | Place an order for a pet +*TestingApi* | [**tests_all_of_with_one_model_get**](docs/TestingApi.md#tests_all_of_with_one_model_get) | **Get** /tests/allOfWithOneModel | Test for allOf with a single option. (One of the issues in #20500) *TestingApi* | [**tests_discriminator_duplicate_enums_get**](docs/TestingApi.md#tests_discriminator_duplicate_enums_get) | **Get** /tests/discriminatorDuplicateEnums | Test for duplicate enums when using discriminator. (One of the issues in #20500) *TestingApi* | [**tests_file_response_get**](docs/TestingApi.md#tests_file_response_get) | **Get** /tests/fileResponse | Returns an image file *TestingApi* | [**tests_type_testing_get**](docs/TestingApi.md#tests_type_testing_get) | **Get** /tests/typeTesting | Route to test the TypeTesting schema diff --git a/samples/client/petstore/rust/hyper/petstore/docs/TestingApi.md b/samples/client/petstore/rust/hyper/petstore/docs/TestingApi.md index 3b39f8fe1e4..bec230290b7 100644 --- a/samples/client/petstore/rust/hyper/petstore/docs/TestingApi.md +++ b/samples/client/petstore/rust/hyper/petstore/docs/TestingApi.md @@ -4,12 +4,41 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**tests_all_of_with_one_model_get**](TestingApi.md#tests_all_of_with_one_model_get) | **Get** /tests/allOfWithOneModel | Test for allOf with a single option. (One of the issues in #20500) [**tests_discriminator_duplicate_enums_get**](TestingApi.md#tests_discriminator_duplicate_enums_get) | **Get** /tests/discriminatorDuplicateEnums | Test for duplicate enums when using discriminator. (One of the issues in #20500) [**tests_file_response_get**](TestingApi.md#tests_file_response_get) | **Get** /tests/fileResponse | Returns an image file [**tests_type_testing_get**](TestingApi.md#tests_type_testing_get) | **Get** /tests/typeTesting | Route to test the TypeTesting schema +## tests_all_of_with_one_model_get + +> String tests_all_of_with_one_model_get(person) +Test for allOf with a single option. (One of the issues in #20500) + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**person** | [**Person**](Person.md) | | [required] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## tests_discriminator_duplicate_enums_get > models::TestsDiscriminatorDuplicateEnumsGet200Response tests_discriminator_duplicate_enums_get() diff --git a/samples/client/petstore/rust/hyper/petstore/src/apis/testing_api.rs b/samples/client/petstore/rust/hyper/petstore/src/apis/testing_api.rs index 6a25163f352..1e16186bd20 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/apis/testing_api.rs @@ -37,6 +37,7 @@ impl TestingApiClient } pub trait TestingApi: Send + Sync { + fn tests_all_of_with_one_model_get(&self, person: models::Person) -> Pin> + Send>>; fn tests_discriminator_duplicate_enums_get(&self, ) -> Pin> + Send>>; fn tests_file_response_get(&self, ) -> Pin> + Send>>; fn tests_type_testing_get(&self, ) -> Pin> + Send>>; @@ -44,6 +45,15 @@ pub trait TestingApi: Send + Sync { implTestingApi for TestingApiClient where C: Clone + std::marker::Send + Sync { + #[allow(unused_mut)] + fn tests_all_of_with_one_model_get(&self, person: models::Person) -> Pin> + Send>> { + let mut req = __internal_request::Request::new(hyper::Method::GET, "/tests/allOfWithOneModel".to_string()) + ; + req = req.with_body_param(person); + + req.execute(self.configuration.borrow()) + } + #[allow(unused_mut)] fn tests_discriminator_duplicate_enums_get(&self, ) -> Pin> + Send>> { let mut req = __internal_request::Request::new(hyper::Method::GET, "/tests/discriminatorDuplicateEnums".to_string()) diff --git a/samples/client/petstore/rust/hyper0x/petstore/README.md b/samples/client/petstore/rust/hyper0x/petstore/README.md index 45474b8466b..dccdf732f43 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/README.md +++ b/samples/client/petstore/rust/hyper0x/petstore/README.md @@ -39,6 +39,7 @@ Class | Method | HTTP request | Description *StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status *StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID *StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet +*TestingApi* | [**tests_all_of_with_one_model_get**](docs/TestingApi.md#tests_all_of_with_one_model_get) | **GET** /tests/allOfWithOneModel | Test for allOf with a single option. (One of the issues in #20500) *TestingApi* | [**tests_discriminator_duplicate_enums_get**](docs/TestingApi.md#tests_discriminator_duplicate_enums_get) | **GET** /tests/discriminatorDuplicateEnums | Test for duplicate enums when using discriminator. (One of the issues in #20500) *TestingApi* | [**tests_file_response_get**](docs/TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file *TestingApi* | [**tests_type_testing_get**](docs/TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema diff --git a/samples/client/petstore/rust/hyper0x/petstore/docs/TestingApi.md b/samples/client/petstore/rust/hyper0x/petstore/docs/TestingApi.md index 1d26ae8655d..5439986dd2b 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/docs/TestingApi.md +++ b/samples/client/petstore/rust/hyper0x/petstore/docs/TestingApi.md @@ -4,12 +4,41 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**tests_all_of_with_one_model_get**](TestingApi.md#tests_all_of_with_one_model_get) | **GET** /tests/allOfWithOneModel | Test for allOf with a single option. (One of the issues in #20500) [**tests_discriminator_duplicate_enums_get**](TestingApi.md#tests_discriminator_duplicate_enums_get) | **GET** /tests/discriminatorDuplicateEnums | Test for duplicate enums when using discriminator. (One of the issues in #20500) [**tests_file_response_get**](TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file [**tests_type_testing_get**](TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema +## tests_all_of_with_one_model_get + +> String tests_all_of_with_one_model_get(person) +Test for allOf with a single option. (One of the issues in #20500) + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**person** | [**Person**](Person.md) | | [required] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## tests_discriminator_duplicate_enums_get > models::TestsDiscriminatorDuplicateEnumsGet200Response tests_discriminator_duplicate_enums_get() diff --git a/samples/client/petstore/rust/hyper0x/petstore/src/apis/testing_api.rs b/samples/client/petstore/rust/hyper0x/petstore/src/apis/testing_api.rs index 9b9f100d3b5..118c17f212a 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/hyper0x/petstore/src/apis/testing_api.rs @@ -36,6 +36,7 @@ impl TestingApiClient } pub trait TestingApi { + fn tests_all_of_with_one_model_get(&self, person: models::Person) -> Pin>>>; fn tests_discriminator_duplicate_enums_get(&self, ) -> Pin>>>; fn tests_file_response_get(&self, ) -> Pin>>>; fn tests_type_testing_get(&self, ) -> Pin>>>; @@ -43,6 +44,15 @@ pub trait TestingApi { implTestingApi for TestingApiClient where C: Clone + std::marker::Send + Sync { + #[allow(unused_mut)] + fn tests_all_of_with_one_model_get(&self, person: models::Person) -> Pin>>> { + let mut req = __internal_request::Request::new(hyper::Method::GET, "/tests/allOfWithOneModel".to_string()) + ; + req = req.with_body_param(person); + + req.execute(self.configuration.borrow()) + } + #[allow(unused_mut)] fn tests_discriminator_duplicate_enums_get(&self, ) -> Pin>>> { let mut req = __internal_request::Request::new(hyper::Method::GET, "/tests/discriminatorDuplicateEnums".to_string()) diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/README.md b/samples/client/petstore/rust/reqwest-trait/petstore/README.md index 9d7acf5037d..f9c2b616164 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/README.md +++ b/samples/client/petstore/rust/reqwest-trait/petstore/README.md @@ -39,6 +39,7 @@ Class | Method | HTTP request | Description *StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status *StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID *StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet +*TestingApi* | [**tests_all_of_with_one_model_get**](docs/TestingApi.md#tests_all_of_with_one_model_get) | **GET** /tests/allOfWithOneModel | Test for allOf with a single option. (One of the issues in #20500) *TestingApi* | [**tests_discriminator_duplicate_enums_get**](docs/TestingApi.md#tests_discriminator_duplicate_enums_get) | **GET** /tests/discriminatorDuplicateEnums | Test for duplicate enums when using discriminator. (One of the issues in #20500) *TestingApi* | [**tests_file_response_get**](docs/TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file *TestingApi* | [**tests_type_testing_get**](docs/TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/docs/TestingApi.md b/samples/client/petstore/rust/reqwest-trait/petstore/docs/TestingApi.md index 1d26ae8655d..5439986dd2b 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/docs/TestingApi.md +++ b/samples/client/petstore/rust/reqwest-trait/petstore/docs/TestingApi.md @@ -4,12 +4,41 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**tests_all_of_with_one_model_get**](TestingApi.md#tests_all_of_with_one_model_get) | **GET** /tests/allOfWithOneModel | Test for allOf with a single option. (One of the issues in #20500) [**tests_discriminator_duplicate_enums_get**](TestingApi.md#tests_discriminator_duplicate_enums_get) | **GET** /tests/discriminatorDuplicateEnums | Test for duplicate enums when using discriminator. (One of the issues in #20500) [**tests_file_response_get**](TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file [**tests_type_testing_get**](TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema +## tests_all_of_with_one_model_get + +> String tests_all_of_with_one_model_get(person) +Test for allOf with a single option. (One of the issues in #20500) + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**person** | [**Person**](Person.md) | | [required] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## tests_discriminator_duplicate_enums_get > models::TestsDiscriminatorDuplicateEnumsGet200Response tests_discriminator_duplicate_enums_get() diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest-trait/petstore/src/apis/testing_api.rs index 23e06cb6b74..636b20fc860 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest-trait/petstore/src/apis/testing_api.rs @@ -23,6 +23,11 @@ use crate::apis::ContentType; #[async_trait] pub trait TestingApi: Send + Sync { + /// GET /tests/allOfWithOneModel + /// + /// + async fn tests_all_of_with_one_model_get<'person>(&self, person: models::Person) -> Result>; + /// GET /tests/discriminatorDuplicateEnums /// /// @@ -53,6 +58,44 @@ impl TestingApiClient { #[async_trait] impl TestingApi for TestingApiClient { + async fn tests_all_of_with_one_model_get<'person>(&self, person: models::Person) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/tests/allOfWithOneModel", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = local_var_req_builder.json(&person); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `String`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `String`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + async fn tests_discriminator_duplicate_enums_get<>(&self, ) -> Result> { let local_var_configuration = &self.configuration; @@ -166,6 +209,13 @@ impl TestingApi for TestingApiClient { } +/// struct for typed errors of method [`tests_all_of_with_one_model_get`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TestsAllOfWithOneModelGetError { + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`tests_discriminator_duplicate_enums_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] 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 7381f9bfd9c..51cb02c3880 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/README.md +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/README.md @@ -39,6 +39,7 @@ Class | Method | HTTP request | Description *StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status *StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID *StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet +*TestingApi* | [**tests_all_of_with_one_model_get**](docs/TestingApi.md#tests_all_of_with_one_model_get) | **GET** /tests/allOfWithOneModel | Test for allOf with a single option. (One of the issues in #20500) *TestingApi* | [**tests_discriminator_duplicate_enums_get**](docs/TestingApi.md#tests_discriminator_duplicate_enums_get) | **GET** /tests/discriminatorDuplicateEnums | Test for duplicate enums when using discriminator. (One of the issues in #20500) *TestingApi* | [**tests_file_response_get**](docs/TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file *TestingApi* | [**tests_type_testing_get**](docs/TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/TestingApi.md b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/TestingApi.md index 1d26ae8655d..5439986dd2b 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/TestingApi.md +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/TestingApi.md @@ -4,12 +4,41 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**tests_all_of_with_one_model_get**](TestingApi.md#tests_all_of_with_one_model_get) | **GET** /tests/allOfWithOneModel | Test for allOf with a single option. (One of the issues in #20500) [**tests_discriminator_duplicate_enums_get**](TestingApi.md#tests_discriminator_duplicate_enums_get) | **GET** /tests/discriminatorDuplicateEnums | Test for duplicate enums when using discriminator. (One of the issues in #20500) [**tests_file_response_get**](TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file [**tests_type_testing_get**](TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema +## tests_all_of_with_one_model_get + +> String tests_all_of_with_one_model_get(person) +Test for allOf with a single option. (One of the issues in #20500) + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**person** | [**Person**](Person.md) | | [required] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## tests_discriminator_duplicate_enums_get > models::TestsDiscriminatorDuplicateEnumsGet200Response tests_discriminator_duplicate_enums_get() diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/testing_api.rs index 39951422299..a6ac53846f2 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/testing_api.rs @@ -14,6 +14,20 @@ use serde::{Deserialize, Serialize, de::Error as _}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration, ContentType}; +/// struct for passing parameters to the method [`tests_all_of_with_one_model_get`] +#[derive(Clone, Debug)] +pub struct TestsAllOfWithOneModelGetParams { + pub person: models::Person +} + + +/// struct for typed successes of method [`tests_all_of_with_one_model_get`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TestsAllOfWithOneModelGetSuccess { + Status200(String), + UnknownValue(serde_json::Value), +} /// struct for typed successes of method [`tests_discriminator_duplicate_enums_get`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -39,6 +53,13 @@ pub enum TestsTypeTestingGetSuccess { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`tests_all_of_with_one_model_get`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TestsAllOfWithOneModelGetError { + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`tests_discriminator_duplicate_enums_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -61,6 +82,32 @@ pub enum TestsTypeTestingGetError { } +pub async fn tests_all_of_with_one_model_get(configuration: &configuration::Configuration, params: TestsAllOfWithOneModelGetParams) -> Result, Error> { + + let uri_str = format!("{}/tests/allOfWithOneModel", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + req_builder = req_builder.json(¶ms.person); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + pub async fn tests_discriminator_duplicate_enums_get(configuration: &configuration::Configuration) -> Result, Error> { let uri_str = format!("{}/tests/discriminatorDuplicateEnums", configuration.base_path); 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 8e54220c1af..037cbd978d4 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/README.md +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/README.md @@ -39,6 +39,7 @@ Class | Method | HTTP request | Description *StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status *StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID *StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet +*TestingApi* | [**tests_all_of_with_one_model_get**](docs/TestingApi.md#tests_all_of_with_one_model_get) | **GET** /tests/allOfWithOneModel | Test for allOf with a single option. (One of the issues in #20500) *TestingApi* | [**tests_discriminator_duplicate_enums_get**](docs/TestingApi.md#tests_discriminator_duplicate_enums_get) | **GET** /tests/discriminatorDuplicateEnums | Test for duplicate enums when using discriminator. (One of the issues in #20500) *TestingApi* | [**tests_file_response_get**](docs/TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file *TestingApi* | [**tests_type_testing_get**](docs/TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/TestingApi.md b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/TestingApi.md index 1d26ae8655d..5439986dd2b 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/TestingApi.md +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/TestingApi.md @@ -4,12 +4,41 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**tests_all_of_with_one_model_get**](TestingApi.md#tests_all_of_with_one_model_get) | **GET** /tests/allOfWithOneModel | Test for allOf with a single option. (One of the issues in #20500) [**tests_discriminator_duplicate_enums_get**](TestingApi.md#tests_discriminator_duplicate_enums_get) | **GET** /tests/discriminatorDuplicateEnums | Test for duplicate enums when using discriminator. (One of the issues in #20500) [**tests_file_response_get**](TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file [**tests_type_testing_get**](TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema +## tests_all_of_with_one_model_get + +> String tests_all_of_with_one_model_get(person) +Test for allOf with a single option. (One of the issues in #20500) + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**person** | [**Person**](Person.md) | | [required] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## tests_discriminator_duplicate_enums_get > models::TestsDiscriminatorDuplicateEnumsGet200Response tests_discriminator_duplicate_enums_get() diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/testing_api.rs index 39951422299..a6ac53846f2 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/testing_api.rs @@ -14,6 +14,20 @@ use serde::{Deserialize, Serialize, de::Error as _}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration, ContentType}; +/// struct for passing parameters to the method [`tests_all_of_with_one_model_get`] +#[derive(Clone, Debug)] +pub struct TestsAllOfWithOneModelGetParams { + pub person: models::Person +} + + +/// struct for typed successes of method [`tests_all_of_with_one_model_get`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TestsAllOfWithOneModelGetSuccess { + Status200(String), + UnknownValue(serde_json::Value), +} /// struct for typed successes of method [`tests_discriminator_duplicate_enums_get`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -39,6 +53,13 @@ pub enum TestsTypeTestingGetSuccess { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`tests_all_of_with_one_model_get`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TestsAllOfWithOneModelGetError { + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`tests_discriminator_duplicate_enums_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -61,6 +82,32 @@ pub enum TestsTypeTestingGetError { } +pub async fn tests_all_of_with_one_model_get(configuration: &configuration::Configuration, params: TestsAllOfWithOneModelGetParams) -> Result, Error> { + + let uri_str = format!("{}/tests/allOfWithOneModel", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + req_builder = req_builder.json(¶ms.person); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + pub async fn tests_discriminator_duplicate_enums_get(configuration: &configuration::Configuration) -> Result, Error> { let uri_str = format!("{}/tests/discriminatorDuplicateEnums", configuration.base_path); diff --git a/samples/client/petstore/rust/reqwest/petstore-async/README.md b/samples/client/petstore/rust/reqwest/petstore-async/README.md index 6e3a6c7620f..515d5641216 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/README.md +++ b/samples/client/petstore/rust/reqwest/petstore-async/README.md @@ -39,6 +39,7 @@ Class | Method | HTTP request | Description *StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status *StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID *StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet +*TestingApi* | [**tests_all_of_with_one_model_get**](docs/TestingApi.md#tests_all_of_with_one_model_get) | **GET** /tests/allOfWithOneModel | Test for allOf with a single option. (One of the issues in #20500) *TestingApi* | [**tests_discriminator_duplicate_enums_get**](docs/TestingApi.md#tests_discriminator_duplicate_enums_get) | **GET** /tests/discriminatorDuplicateEnums | Test for duplicate enums when using discriminator. (One of the issues in #20500) *TestingApi* | [**tests_file_response_get**](docs/TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file *TestingApi* | [**tests_type_testing_get**](docs/TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema diff --git a/samples/client/petstore/rust/reqwest/petstore-async/docs/TestingApi.md b/samples/client/petstore/rust/reqwest/petstore-async/docs/TestingApi.md index 1d26ae8655d..5439986dd2b 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/docs/TestingApi.md +++ b/samples/client/petstore/rust/reqwest/petstore-async/docs/TestingApi.md @@ -4,12 +4,41 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**tests_all_of_with_one_model_get**](TestingApi.md#tests_all_of_with_one_model_get) | **GET** /tests/allOfWithOneModel | Test for allOf with a single option. (One of the issues in #20500) [**tests_discriminator_duplicate_enums_get**](TestingApi.md#tests_discriminator_duplicate_enums_get) | **GET** /tests/discriminatorDuplicateEnums | Test for duplicate enums when using discriminator. (One of the issues in #20500) [**tests_file_response_get**](TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file [**tests_type_testing_get**](TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema +## tests_all_of_with_one_model_get + +> String tests_all_of_with_one_model_get(person) +Test for allOf with a single option. (One of the issues in #20500) + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**person** | [**Person**](Person.md) | | [required] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## tests_discriminator_duplicate_enums_get > models::TestsDiscriminatorDuplicateEnumsGet200Response tests_discriminator_duplicate_enums_get() diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/testing_api.rs index 39951422299..a6ac53846f2 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/testing_api.rs @@ -14,6 +14,20 @@ use serde::{Deserialize, Serialize, de::Error as _}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration, ContentType}; +/// struct for passing parameters to the method [`tests_all_of_with_one_model_get`] +#[derive(Clone, Debug)] +pub struct TestsAllOfWithOneModelGetParams { + pub person: models::Person +} + + +/// struct for typed successes of method [`tests_all_of_with_one_model_get`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TestsAllOfWithOneModelGetSuccess { + Status200(String), + UnknownValue(serde_json::Value), +} /// struct for typed successes of method [`tests_discriminator_duplicate_enums_get`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -39,6 +53,13 @@ pub enum TestsTypeTestingGetSuccess { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`tests_all_of_with_one_model_get`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TestsAllOfWithOneModelGetError { + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`tests_discriminator_duplicate_enums_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -61,6 +82,32 @@ pub enum TestsTypeTestingGetError { } +pub async fn tests_all_of_with_one_model_get(configuration: &configuration::Configuration, params: TestsAllOfWithOneModelGetParams) -> Result, Error> { + + let uri_str = format!("{}/tests/allOfWithOneModel", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + req_builder = req_builder.json(¶ms.person); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + pub async fn tests_discriminator_duplicate_enums_get(configuration: &configuration::Configuration) -> Result, Error> { let uri_str = format!("{}/tests/discriminatorDuplicateEnums", configuration.base_path); 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 8ccbf8122a7..31c136905c0 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/README.md +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/README.md @@ -39,6 +39,7 @@ Class | Method | HTTP request | Description *StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status *StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID *StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet +*TestingApi* | [**tests_all_of_with_one_model_get**](docs/TestingApi.md#tests_all_of_with_one_model_get) | **GET** /tests/allOfWithOneModel | Test for allOf with a single option. (One of the issues in #20500) *TestingApi* | [**tests_discriminator_duplicate_enums_get**](docs/TestingApi.md#tests_discriminator_duplicate_enums_get) | **GET** /tests/discriminatorDuplicateEnums | Test for duplicate enums when using discriminator. (One of the issues in #20500) *TestingApi* | [**tests_file_response_get**](docs/TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file *TestingApi* | [**tests_type_testing_get**](docs/TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/TestingApi.md b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/TestingApi.md index 1d26ae8655d..5439986dd2b 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/TestingApi.md +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/TestingApi.md @@ -4,12 +4,41 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**tests_all_of_with_one_model_get**](TestingApi.md#tests_all_of_with_one_model_get) | **GET** /tests/allOfWithOneModel | Test for allOf with a single option. (One of the issues in #20500) [**tests_discriminator_duplicate_enums_get**](TestingApi.md#tests_discriminator_duplicate_enums_get) | **GET** /tests/discriminatorDuplicateEnums | Test for duplicate enums when using discriminator. (One of the issues in #20500) [**tests_file_response_get**](TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file [**tests_type_testing_get**](TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema +## tests_all_of_with_one_model_get + +> String tests_all_of_with_one_model_get(person) +Test for allOf with a single option. (One of the issues in #20500) + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**person** | [**Person**](Person.md) | | [required] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## tests_discriminator_duplicate_enums_get > models::TestsDiscriminatorDuplicateEnumsGet200Response tests_discriminator_duplicate_enums_get() diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/testing_api.rs index 39951422299..a6ac53846f2 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/testing_api.rs @@ -14,6 +14,20 @@ use serde::{Deserialize, Serialize, de::Error as _}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration, ContentType}; +/// struct for passing parameters to the method [`tests_all_of_with_one_model_get`] +#[derive(Clone, Debug)] +pub struct TestsAllOfWithOneModelGetParams { + pub person: models::Person +} + + +/// struct for typed successes of method [`tests_all_of_with_one_model_get`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TestsAllOfWithOneModelGetSuccess { + Status200(String), + UnknownValue(serde_json::Value), +} /// struct for typed successes of method [`tests_discriminator_duplicate_enums_get`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -39,6 +53,13 @@ pub enum TestsTypeTestingGetSuccess { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`tests_all_of_with_one_model_get`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TestsAllOfWithOneModelGetError { + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`tests_discriminator_duplicate_enums_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -61,6 +82,32 @@ pub enum TestsTypeTestingGetError { } +pub async fn tests_all_of_with_one_model_get(configuration: &configuration::Configuration, params: TestsAllOfWithOneModelGetParams) -> Result, Error> { + + let uri_str = format!("{}/tests/allOfWithOneModel", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + req_builder = req_builder.json(¶ms.person); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + pub async fn tests_discriminator_duplicate_enums_get(configuration: &configuration::Configuration) -> Result, Error> { let uri_str = format!("{}/tests/discriminatorDuplicateEnums", configuration.base_path); diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/README.md b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/README.md index 4cf403be230..9ee940fa0bd 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/README.md +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/README.md @@ -39,6 +39,7 @@ Class | Method | HTTP request | Description *StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status *StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID *StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet +*TestingApi* | [**tests_all_of_with_one_model_get**](docs/TestingApi.md#tests_all_of_with_one_model_get) | **GET** /tests/allOfWithOneModel | Test for allOf with a single option. (One of the issues in #20500) *TestingApi* | [**tests_discriminator_duplicate_enums_get**](docs/TestingApi.md#tests_discriminator_duplicate_enums_get) | **GET** /tests/discriminatorDuplicateEnums | Test for duplicate enums when using discriminator. (One of the issues in #20500) *TestingApi* | [**tests_file_response_get**](docs/TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file *TestingApi* | [**tests_type_testing_get**](docs/TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/TestingApi.md b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/TestingApi.md index 1d26ae8655d..5439986dd2b 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/TestingApi.md +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/TestingApi.md @@ -4,12 +4,41 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**tests_all_of_with_one_model_get**](TestingApi.md#tests_all_of_with_one_model_get) | **GET** /tests/allOfWithOneModel | Test for allOf with a single option. (One of the issues in #20500) [**tests_discriminator_duplicate_enums_get**](TestingApi.md#tests_discriminator_duplicate_enums_get) | **GET** /tests/discriminatorDuplicateEnums | Test for duplicate enums when using discriminator. (One of the issues in #20500) [**tests_file_response_get**](TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file [**tests_type_testing_get**](TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema +## tests_all_of_with_one_model_get + +> String tests_all_of_with_one_model_get(person) +Test for allOf with a single option. (One of the issues in #20500) + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**person** | [**Person**](Person.md) | | [required] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## tests_discriminator_duplicate_enums_get > models::TestsDiscriminatorDuplicateEnumsGet200Response tests_discriminator_duplicate_enums_get() diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/testing_api.rs index ec77bc31852..448ed8a143c 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/testing_api.rs @@ -15,6 +15,13 @@ use crate::{apis::ResponseContent, models}; use super::{Error, configuration, ContentType}; +/// struct for typed errors of method [`tests_all_of_with_one_model_get`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TestsAllOfWithOneModelGetError { + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`tests_discriminator_duplicate_enums_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -37,6 +44,43 @@ pub enum TestsTypeTestingGetError { } +pub fn tests_all_of_with_one_model_get(configuration: &configuration::Configuration, person: models::Person) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_person = person; + + let uri_str = format!("{}/tests/allOfWithOneModel", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + req_builder = req_builder.json(&p_person); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req)?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text()?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `String`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))), + } + } else { + let content = resp.text()?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + pub fn tests_discriminator_duplicate_enums_get(configuration: &configuration::Configuration, ) -> Result> { let uri_str = format!("{}/tests/discriminatorDuplicateEnums", configuration.base_path); 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 3761429a30a..7f4ea765bf7 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 @@ -39,6 +39,7 @@ Class | Method | HTTP request | Description *StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status *StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID *StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet +*TestingApi* | [**tests_all_of_with_one_model_get**](docs/TestingApi.md#tests_all_of_with_one_model_get) | **GET** /tests/allOfWithOneModel | Test for allOf with a single option. (One of the issues in #20500) *TestingApi* | [**tests_discriminator_duplicate_enums_get**](docs/TestingApi.md#tests_discriminator_duplicate_enums_get) | **GET** /tests/discriminatorDuplicateEnums | Test for duplicate enums when using discriminator. (One of the issues in #20500) *TestingApi* | [**tests_file_response_get**](docs/TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file *TestingApi* | [**tests_type_testing_get**](docs/TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/TestingApi.md b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/TestingApi.md index b977e72b885..27c0de6b57e 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/TestingApi.md +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/TestingApi.md @@ -4,12 +4,41 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**tests_all_of_with_one_model_get**](TestingApi.md#tests_all_of_with_one_model_get) | **GET** /tests/allOfWithOneModel | Test for allOf with a single option. (One of the issues in #20500) [**tests_discriminator_duplicate_enums_get**](TestingApi.md#tests_discriminator_duplicate_enums_get) | **GET** /tests/discriminatorDuplicateEnums | Test for duplicate enums when using discriminator. (One of the issues in #20500) [**tests_file_response_get**](TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file [**tests_type_testing_get**](TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema +## tests_all_of_with_one_model_get + +> String tests_all_of_with_one_model_get(foo_person) +Test for allOf with a single option. (One of the issues in #20500) + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**foo_person** | [**FooPerson**](FooPerson.md) | | [required] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## tests_discriminator_duplicate_enums_get > models::FooTestsDiscriminatorDuplicateEnumsGet200Response tests_discriminator_duplicate_enums_get() diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/testing_api.rs index d8a822536bd..24b370c6d15 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/testing_api.rs @@ -15,6 +15,13 @@ use crate::{apis::ResponseContent, models}; use super::{Error, configuration, ContentType}; +/// struct for typed errors of method [`tests_all_of_with_one_model_get`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TestsAllOfWithOneModelGetError { + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`tests_discriminator_duplicate_enums_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -37,6 +44,43 @@ pub enum TestsTypeTestingGetError { } +pub fn tests_all_of_with_one_model_get(configuration: &configuration::Configuration, foo_person: models::FooPerson) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_foo_person = foo_person; + + let uri_str = format!("{}/tests/allOfWithOneModel", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + req_builder = req_builder.json(&p_foo_person); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req)?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text()?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `String`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))), + } + } else { + let content = resp.text()?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + pub fn tests_discriminator_duplicate_enums_get(configuration: &configuration::Configuration, ) -> Result> { let uri_str = format!("{}/tests/discriminatorDuplicateEnums", configuration.base_path); diff --git a/samples/client/petstore/rust/reqwest/petstore/README.md b/samples/client/petstore/rust/reqwest/petstore/README.md index 9d7acf5037d..f9c2b616164 100644 --- a/samples/client/petstore/rust/reqwest/petstore/README.md +++ b/samples/client/petstore/rust/reqwest/petstore/README.md @@ -39,6 +39,7 @@ Class | Method | HTTP request | Description *StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status *StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID *StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet +*TestingApi* | [**tests_all_of_with_one_model_get**](docs/TestingApi.md#tests_all_of_with_one_model_get) | **GET** /tests/allOfWithOneModel | Test for allOf with a single option. (One of the issues in #20500) *TestingApi* | [**tests_discriminator_duplicate_enums_get**](docs/TestingApi.md#tests_discriminator_duplicate_enums_get) | **GET** /tests/discriminatorDuplicateEnums | Test for duplicate enums when using discriminator. (One of the issues in #20500) *TestingApi* | [**tests_file_response_get**](docs/TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file *TestingApi* | [**tests_type_testing_get**](docs/TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema diff --git a/samples/client/petstore/rust/reqwest/petstore/docs/TestingApi.md b/samples/client/petstore/rust/reqwest/petstore/docs/TestingApi.md index 1d26ae8655d..5439986dd2b 100644 --- a/samples/client/petstore/rust/reqwest/petstore/docs/TestingApi.md +++ b/samples/client/petstore/rust/reqwest/petstore/docs/TestingApi.md @@ -4,12 +4,41 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**tests_all_of_with_one_model_get**](TestingApi.md#tests_all_of_with_one_model_get) | **GET** /tests/allOfWithOneModel | Test for allOf with a single option. (One of the issues in #20500) [**tests_discriminator_duplicate_enums_get**](TestingApi.md#tests_discriminator_duplicate_enums_get) | **GET** /tests/discriminatorDuplicateEnums | Test for duplicate enums when using discriminator. (One of the issues in #20500) [**tests_file_response_get**](TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file [**tests_type_testing_get**](TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema +## tests_all_of_with_one_model_get + +> String tests_all_of_with_one_model_get(person) +Test for allOf with a single option. (One of the issues in #20500) + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**person** | [**Person**](Person.md) | | [required] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## tests_discriminator_duplicate_enums_get > models::TestsDiscriminatorDuplicateEnumsGet200Response tests_discriminator_duplicate_enums_get() diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/testing_api.rs index ec77bc31852..448ed8a143c 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/testing_api.rs @@ -15,6 +15,13 @@ use crate::{apis::ResponseContent, models}; use super::{Error, configuration, ContentType}; +/// struct for typed errors of method [`tests_all_of_with_one_model_get`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TestsAllOfWithOneModelGetError { + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`tests_discriminator_duplicate_enums_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -37,6 +44,43 @@ pub enum TestsTypeTestingGetError { } +pub fn tests_all_of_with_one_model_get(configuration: &configuration::Configuration, person: models::Person) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_person = person; + + let uri_str = format!("{}/tests/allOfWithOneModel", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + req_builder = req_builder.json(&p_person); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req)?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text()?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `String`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))), + } + } else { + let content = resp.text()?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + pub fn tests_discriminator_duplicate_enums_get(configuration: &configuration::Configuration, ) -> Result> { let uri_str = format!("{}/tests/discriminatorDuplicateEnums", configuration.base_path);