Fixed allOf with only one model (#20716)

This commit is contained in:
Ross Sullivan 2025-03-03 00:33:00 +09:00 committed by GitHub
parent a79aad8420
commit 85ab65c4ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
33 changed files with 712 additions and 7 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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'

View File

@ -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

View File

@ -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()

View File

@ -37,6 +37,7 @@ impl<C: Connect> TestingApiClient<C>
}
pub trait TestingApi: Send + Sync {
fn tests_all_of_with_one_model_get(&self, person: models::Person) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send>>;
fn tests_discriminator_duplicate_enums_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::TestsDiscriminatorDuplicateEnumsGet200Response, Error>> + Send>>;
fn tests_file_response_get(&self, ) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>>;
fn tests_type_testing_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::TypeTesting, Error>> + Send>>;
@ -44,6 +45,15 @@ pub trait TestingApi: Send + Sync {
impl<C: Connect>TestingApi for TestingApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)]
fn tests_all_of_with_one_model_get(&self, person: models::Person) -> Pin<Box<dyn Future<Output = Result<String, Error>> + 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<Box<dyn Future<Output = Result<models::TestsDiscriminatorDuplicateEnumsGet200Response, Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/tests/discriminatorDuplicateEnums".to_string())

View File

@ -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

View File

@ -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()

View File

@ -36,6 +36,7 @@ impl<C: hyper::client::connect::Connect> TestingApiClient<C>
}
pub trait TestingApi {
fn tests_all_of_with_one_model_get(&self, person: models::Person) -> Pin<Box<dyn Future<Output = Result<String, Error>>>>;
fn tests_discriminator_duplicate_enums_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::TestsDiscriminatorDuplicateEnumsGet200Response, Error>>>>;
fn tests_file_response_get(&self, ) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>>>>;
fn tests_type_testing_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::TypeTesting, Error>>>>;
@ -43,6 +44,15 @@ pub trait TestingApi {
impl<C: hyper::client::connect::Connect>TestingApi for TestingApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)]
fn tests_all_of_with_one_model_get(&self, person: models::Person) -> Pin<Box<dyn Future<Output = Result<String, Error>>>> {
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<Box<dyn Future<Output = Result<models::TestsDiscriminatorDuplicateEnumsGet200Response, Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/tests/discriminatorDuplicateEnums".to_string())

View File

@ -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

View File

@ -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()

View File

@ -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<String, Error<TestsAllOfWithOneModelGetError>>;
/// 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<String, Error<TestsAllOfWithOneModelGetError>> {
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<TestsAllOfWithOneModelGetError> = 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<models::TestsDiscriminatorDuplicateEnumsGet200Response, Error<TestsDiscriminatorDuplicateEnumsGetError>> {
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)]

View File

@ -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

View File

@ -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()

View File

@ -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<ResponseContent<TestsAllOfWithOneModelGetSuccess>, Error<TestsAllOfWithOneModelGetError>> {
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(&params.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<TestsAllOfWithOneModelGetSuccess> = serde_json::from_str(&content).ok();
Ok(ResponseContent { status, content, entity })
} else {
let content = resp.text().await?;
let entity: Option<TestsAllOfWithOneModelGetError> = 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<ResponseContent<TestsDiscriminatorDuplicateEnumsGetSuccess>, Error<TestsDiscriminatorDuplicateEnumsGetError>> {
let uri_str = format!("{}/tests/discriminatorDuplicateEnums", configuration.base_path);

View File

@ -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

View File

@ -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()

View File

@ -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<ResponseContent<TestsAllOfWithOneModelGetSuccess>, Error<TestsAllOfWithOneModelGetError>> {
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(&params.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<TestsAllOfWithOneModelGetSuccess> = serde_json::from_str(&content).ok();
Ok(ResponseContent { status, content, entity })
} else {
let content = resp.text().await?;
let entity: Option<TestsAllOfWithOneModelGetError> = 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<ResponseContent<TestsDiscriminatorDuplicateEnumsGetSuccess>, Error<TestsDiscriminatorDuplicateEnumsGetError>> {
let uri_str = format!("{}/tests/discriminatorDuplicateEnums", configuration.base_path);

View File

@ -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

View File

@ -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()

View File

@ -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<ResponseContent<TestsAllOfWithOneModelGetSuccess>, Error<TestsAllOfWithOneModelGetError>> {
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(&params.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<TestsAllOfWithOneModelGetSuccess> = serde_json::from_str(&content).ok();
Ok(ResponseContent { status, content, entity })
} else {
let content = resp.text().await?;
let entity: Option<TestsAllOfWithOneModelGetError> = 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<ResponseContent<TestsDiscriminatorDuplicateEnumsGetSuccess>, Error<TestsDiscriminatorDuplicateEnumsGetError>> {
let uri_str = format!("{}/tests/discriminatorDuplicateEnums", configuration.base_path);

View File

@ -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

View File

@ -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()

View File

@ -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<ResponseContent<TestsAllOfWithOneModelGetSuccess>, Error<TestsAllOfWithOneModelGetError>> {
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(&params.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<TestsAllOfWithOneModelGetSuccess> = serde_json::from_str(&content).ok();
Ok(ResponseContent { status, content, entity })
} else {
let content = resp.text().await?;
let entity: Option<TestsAllOfWithOneModelGetError> = 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<ResponseContent<TestsDiscriminatorDuplicateEnumsGetSuccess>, Error<TestsDiscriminatorDuplicateEnumsGetError>> {
let uri_str = format!("{}/tests/discriminatorDuplicateEnums", configuration.base_path);

View File

@ -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

View File

@ -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()

View File

@ -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<String, Error<TestsAllOfWithOneModelGetError>> {
// 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<TestsAllOfWithOneModelGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub fn tests_discriminator_duplicate_enums_get(configuration: &configuration::Configuration, ) -> Result<models::TestsDiscriminatorDuplicateEnumsGet200Response, Error<TestsDiscriminatorDuplicateEnumsGetError>> {
let uri_str = format!("{}/tests/discriminatorDuplicateEnums", configuration.base_path);

View File

@ -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

View File

@ -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()

View File

@ -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<String, Error<TestsAllOfWithOneModelGetError>> {
// 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<TestsAllOfWithOneModelGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub fn tests_discriminator_duplicate_enums_get(configuration: &configuration::Configuration, ) -> Result<models::FooTestsDiscriminatorDuplicateEnumsGet200Response, Error<TestsDiscriminatorDuplicateEnumsGetError>> {
let uri_str = format!("{}/tests/discriminatorDuplicateEnums", configuration.base_path);

View File

@ -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

View File

@ -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()

View File

@ -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<String, Error<TestsAllOfWithOneModelGetError>> {
// 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<TestsAllOfWithOneModelGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub fn tests_discriminator_duplicate_enums_get(configuration: &configuration::Configuration, ) -> Result<models::TestsDiscriminatorDuplicateEnumsGet200Response, Error<TestsDiscriminatorDuplicateEnumsGetError>> {
let uri_str = format!("{}/tests/discriminatorDuplicateEnums", configuration.base_path);