[rust] Fixed discriminator causing duplicate enum variants (#20711)

* Fixed discriminator

* Added testcase and updated samples
This commit is contained in:
Ross Sullivan 2025-02-23 18:50:04 +09:00 committed by GitHub
parent 79145dc633
commit 670e9d7099
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
112 changed files with 2363 additions and 0 deletions

View File

@ -22,15 +22,18 @@ import java.io.IOException;
import java.io.Writer;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import org.openapitools.codegen.CliOption;
@ -342,6 +345,32 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
break;
}
}
// Check if there are duplicate mappings in the discriminator
// ie.
// ```
// mappings:
// student: '#/components/schemas/Person'
// teacher: '#/components/schemas/Person'
// car: '#/components/schemas/Vehicle'
// ```
//
// Should be mapped to an enum with `PersonStudent`, `PersonTeacher`, `Vehicle` to 2 `Person` enum variants. (a compiler error)
if (cm.discriminator.getMapping() != null) {
if (hasDuplicateValues(cm.discriminator.getMapping())) {
var inverted = invertMap(cm.discriminator.getMapping());
for (var s : inverted.entrySet()) {
if (s.getValue().size() > 1) {
LOGGER.debug("Found duplicated enum model (" + s.getKey() + ") in model " + cm.name + ". Adding suffix to model names.");
for (var m : cm.discriminator.getMappedModels()) {
if (s.getValue().contains(m.getMappingName())) {
m.setModelName(m.getModelName() + StringUtils.camelize(m.getMappingName()));
}
}
}
}
}
}
}
// Flag structs with byteArrays in them so that we can annotate them with the serde_as macro
@ -789,4 +818,18 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
.put("lifetimeName", new ReplaceAllLambda("^r#", "r_"));
}
public static <K, V> Map<V, List<K>> invertMap(Map<K, V> map) {
Map<V, List<K>> invertedMap = new HashMap<>();
for (Map.Entry<K, V> entry : map.entrySet()) {
invertedMap.computeIfAbsent(entry.getValue(), k -> new ArrayList<>()).add(entry.getKey());
}
return invertedMap;
}
public static <K, V> boolean hasDuplicateValues(Map<K, V> map) {
Set<V> uniqueValues = new HashSet<>(map.values());
return uniqueValues.size() < map.size();
}
}

View File

@ -656,6 +656,26 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/TypeTesting'
'/tests/discriminatorDuplicateEnums':
get:
tags:
- testing
summary: 'Test for duplicate enums when using discriminator. (One of the issues in #20500)'
responses:
'200':
description: test
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/Person'
- $ref: '#/components/schemas/Vehicle'
discriminator:
propertyName: objectType
mapping:
student: '#/components/schemas/Person'
teacher: '#/components/schemas/Person'
car: '#/components/schemas/Vehicle'
externalDocs:
description: Find out more about Swagger
url: 'http://swagger.io'
@ -1014,4 +1034,24 @@ components:
properties:
foo: {}
required: ["foo"]
Person:
type: object
properties:
type:
type: string
name:
type: string
required:
- type
- name
Vehicle:
type: object
properties:
type:
type: string
speed:
type: number
required:
- type
- speed

View File

@ -14,6 +14,7 @@ docs/NullableArray.md
docs/NumericEnumTesting.md
docs/OptionalTesting.md
docs/Order.md
docs/Person.md
docs/Pet.md
docs/PetApi.md
docs/PropertyTest.md
@ -22,10 +23,12 @@ docs/Return.md
docs/StoreApi.md
docs/Tag.md
docs/TestingApi.md
docs/TestsDiscriminatorDuplicateEnumsGet200Response.md
docs/TypeTesting.md
docs/UniqueItemArrayTesting.md
docs/User.md
docs/UserApi.md
docs/Vehicle.md
git_push.sh
src/apis/client.rs
src/apis/configuration.rs
@ -37,6 +40,7 @@ src/apis/store_api.rs
src/apis/testing_api.rs
src/apis/user_api.rs
src/lib.rs
src/models/_tests_discriminator_duplicate_enums_get_200_response.rs
src/models/action_container.rs
src/models/any_type_test.rs
src/models/api_response.rs
@ -51,9 +55,11 @@ src/models/nullable_array.rs
src/models/numeric_enum_testing.rs
src/models/optional_testing.rs
src/models/order.rs
src/models/person.rs
src/models/pet.rs
src/models/property_test.rs
src/models/tag.rs
src/models/type_testing.rs
src/models/unique_item_array_testing.rs
src/models/user.rs
src/models/vehicle.rs

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_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
*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **Post** /user | Create user
@ -64,14 +65,17 @@ Class | Method | HTTP request | Description
- [NumericEnumTesting](docs/NumericEnumTesting.md)
- [OptionalTesting](docs/OptionalTesting.md)
- [Order](docs/Order.md)
- [Person](docs/Person.md)
- [Pet](docs/Pet.md)
- [PropertyTest](docs/PropertyTest.md)
- [Ref](docs/Ref.md)
- [Return](docs/Return.md)
- [Tag](docs/Tag.md)
- [TestsDiscriminatorDuplicateEnumsGet200Response](docs/TestsDiscriminatorDuplicateEnumsGet200Response.md)
- [TypeTesting](docs/TypeTesting.md)
- [UniqueItemArrayTesting](docs/UniqueItemArrayTesting.md)
- [User](docs/User.md)
- [Vehicle](docs/Vehicle.md)
To get access to the crate's generated documentation, use:

View File

@ -0,0 +1,12 @@
# Person
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**r#type** | **String** | |
**name** | **String** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -4,11 +4,37 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**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_discriminator_duplicate_enums_get
> models::TestsDiscriminatorDuplicateEnumsGet200Response tests_discriminator_duplicate_enums_get()
Test for duplicate enums when using discriminator. (One of the issues in #20500)
### Parameters
This endpoint does not need any parameter.
### Return type
[**models::TestsDiscriminatorDuplicateEnumsGet200Response**](_tests_discriminatorDuplicateEnums_get_200_response.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **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_file_response_get
> std::path::PathBuf tests_file_response_get()

View File

@ -0,0 +1,10 @@
# TestsDiscriminatorDuplicateEnumsGet200Response
## Enum Variants
| Name | Value |
|---- | -----|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# Vehicle
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**r#type** | **String** | |
**speed** | **f64** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -37,12 +37,21 @@ impl<C: Connect> TestingApiClient<C>
}
pub trait TestingApi: Send + Sync {
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>>;
}
impl<C: Connect>TestingApi for TestingApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[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())
;
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn tests_file_response_get(&self, ) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/tests/fileResponse".to_string())

View File

@ -0,0 +1,57 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "objectType")]
pub enum TestsDiscriminatorDuplicateEnumsGet200Response {
#[serde(rename="car")]
Vehicle {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
#[serde(rename="student")]
PersonStudent {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
#[serde(rename="teacher")]
PersonTeacher {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
}
impl Default for TestsDiscriminatorDuplicateEnumsGet200Response {
fn default() -> Self {
Self::Vehicle {
r#type: Default::default(),
name: Default::default(),
speed: Default::default(),
}
}
}

View File

@ -20,6 +20,8 @@ pub mod optional_testing;
pub use self::optional_testing::OptionalTesting;
pub mod order;
pub use self::order::Order;
pub mod person;
pub use self::person::Person;
pub mod pet;
pub use self::pet::Pet;
pub mod property_test;
@ -30,9 +32,13 @@ pub mod model_return;
pub use self::model_return::Return;
pub mod tag;
pub use self::tag::Tag;
pub mod _tests_discriminator_duplicate_enums_get_200_response;
pub use self::_tests_discriminator_duplicate_enums_get_200_response::TestsDiscriminatorDuplicateEnumsGet200Response;
pub mod type_testing;
pub use self::type_testing::TypeTesting;
pub mod unique_item_array_testing;
pub use self::unique_item_array_testing::UniqueItemArrayTesting;
pub mod user;
pub use self::user::User;
pub mod vehicle;
pub use self::vehicle::Vehicle;

View File

@ -0,0 +1,30 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Person {
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "name")]
pub name: String,
}
impl Person {
pub fn new(r#type: String, name: String) -> Person {
Person {
r#type,
name,
}
}
}

View File

@ -0,0 +1,30 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Vehicle {
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "speed")]
pub speed: f64,
}
impl Vehicle {
pub fn new(r#type: String, speed: f64) -> Vehicle {
Vehicle {
r#type,
speed,
}
}
}

View File

@ -14,6 +14,7 @@ docs/NullableArray.md
docs/NumericEnumTesting.md
docs/OptionalTesting.md
docs/Order.md
docs/Person.md
docs/Pet.md
docs/PetApi.md
docs/PropertyTest.md
@ -22,10 +23,12 @@ docs/Return.md
docs/StoreApi.md
docs/Tag.md
docs/TestingApi.md
docs/TestsDiscriminatorDuplicateEnumsGet200Response.md
docs/TypeTesting.md
docs/UniqueItemArrayTesting.md
docs/User.md
docs/UserApi.md
docs/Vehicle.md
git_push.sh
src/apis/configuration.rs
src/apis/fake_api.rs
@ -35,6 +38,7 @@ src/apis/store_api.rs
src/apis/testing_api.rs
src/apis/user_api.rs
src/lib.rs
src/models/_tests_discriminator_duplicate_enums_get_200_response.rs
src/models/action_container.rs
src/models/any_type_test.rs
src/models/api_response.rs
@ -49,9 +53,11 @@ src/models/nullable_array.rs
src/models/numeric_enum_testing.rs
src/models/optional_testing.rs
src/models/order.rs
src/models/person.rs
src/models/pet.rs
src/models/property_test.rs
src/models/tag.rs
src/models/type_testing.rs
src/models/unique_item_array_testing.rs
src/models/user.rs
src/models/vehicle.rs

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_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
*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user
@ -64,14 +65,17 @@ Class | Method | HTTP request | Description
- [NumericEnumTesting](docs/NumericEnumTesting.md)
- [OptionalTesting](docs/OptionalTesting.md)
- [Order](docs/Order.md)
- [Person](docs/Person.md)
- [Pet](docs/Pet.md)
- [PropertyTest](docs/PropertyTest.md)
- [Ref](docs/Ref.md)
- [Return](docs/Return.md)
- [Tag](docs/Tag.md)
- [TestsDiscriminatorDuplicateEnumsGet200Response](docs/TestsDiscriminatorDuplicateEnumsGet200Response.md)
- [TypeTesting](docs/TypeTesting.md)
- [UniqueItemArrayTesting](docs/UniqueItemArrayTesting.md)
- [User](docs/User.md)
- [Vehicle](docs/Vehicle.md)
To get access to the crate's generated documentation, use:

View File

@ -0,0 +1,12 @@
# Person
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**r#type** | **String** | |
**name** | **String** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -4,11 +4,37 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**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_discriminator_duplicate_enums_get
> models::TestsDiscriminatorDuplicateEnumsGet200Response tests_discriminator_duplicate_enums_get()
Test for duplicate enums when using discriminator. (One of the issues in #20500)
### Parameters
This endpoint does not need any parameter.
### Return type
[**models::TestsDiscriminatorDuplicateEnumsGet200Response**](_tests_discriminatorDuplicateEnums_get_200_response.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **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_file_response_get
> std::path::PathBuf tests_file_response_get()

View File

@ -0,0 +1,10 @@
# TestsDiscriminatorDuplicateEnumsGet200Response
## Enum Variants
| Name | Value |
|---- | -----|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# Vehicle
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**r#type** | **String** | |
**speed** | **f64** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -36,12 +36,21 @@ impl<C: hyper::client::connect::Connect> TestingApiClient<C>
}
pub trait TestingApi {
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>>>>;
}
impl<C: hyper::client::connect::Connect>TestingApi for TestingApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[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())
;
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn tests_file_response_get(&self, ) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/tests/fileResponse".to_string())

View File

@ -0,0 +1,57 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "objectType")]
pub enum TestsDiscriminatorDuplicateEnumsGet200Response {
#[serde(rename="car")]
Vehicle {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
#[serde(rename="student")]
PersonStudent {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
#[serde(rename="teacher")]
PersonTeacher {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
}
impl Default for TestsDiscriminatorDuplicateEnumsGet200Response {
fn default() -> Self {
Self::Vehicle {
r#type: Default::default(),
name: Default::default(),
speed: Default::default(),
}
}
}

View File

@ -20,6 +20,8 @@ pub mod optional_testing;
pub use self::optional_testing::OptionalTesting;
pub mod order;
pub use self::order::Order;
pub mod person;
pub use self::person::Person;
pub mod pet;
pub use self::pet::Pet;
pub mod property_test;
@ -30,9 +32,13 @@ pub mod model_return;
pub use self::model_return::Return;
pub mod tag;
pub use self::tag::Tag;
pub mod _tests_discriminator_duplicate_enums_get_200_response;
pub use self::_tests_discriminator_duplicate_enums_get_200_response::TestsDiscriminatorDuplicateEnumsGet200Response;
pub mod type_testing;
pub use self::type_testing::TypeTesting;
pub mod unique_item_array_testing;
pub use self::unique_item_array_testing::UniqueItemArrayTesting;
pub mod user;
pub use self::user::User;
pub mod vehicle;
pub use self::vehicle::Vehicle;

View File

@ -0,0 +1,30 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Person {
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "name")]
pub name: String,
}
impl Person {
pub fn new(r#type: String, name: String) -> Person {
Person {
r#type,
name,
}
}
}

View File

@ -0,0 +1,30 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Vehicle {
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "speed")]
pub speed: f64,
}
impl Vehicle {
pub fn new(r#type: String, speed: f64) -> Vehicle {
Vehicle {
r#type,
speed,
}
}
}

View File

@ -14,6 +14,7 @@ docs/NullableArray.md
docs/NumericEnumTesting.md
docs/OptionalTesting.md
docs/Order.md
docs/Person.md
docs/Pet.md
docs/PetApi.md
docs/PropertyTest.md
@ -22,10 +23,12 @@ docs/Return.md
docs/StoreApi.md
docs/Tag.md
docs/TestingApi.md
docs/TestsDiscriminatorDuplicateEnumsGet200Response.md
docs/TypeTesting.md
docs/UniqueItemArrayTesting.md
docs/User.md
docs/UserApi.md
docs/Vehicle.md
git_push.sh
src/apis/configuration.rs
src/apis/fake_api.rs
@ -35,6 +38,7 @@ src/apis/store_api.rs
src/apis/testing_api.rs
src/apis/user_api.rs
src/lib.rs
src/models/_tests_discriminator_duplicate_enums_get_200_response.rs
src/models/action_container.rs
src/models/any_type_test.rs
src/models/api_response.rs
@ -49,9 +53,11 @@ src/models/nullable_array.rs
src/models/numeric_enum_testing.rs
src/models/optional_testing.rs
src/models/order.rs
src/models/person.rs
src/models/pet.rs
src/models/property_test.rs
src/models/tag.rs
src/models/type_testing.rs
src/models/unique_item_array_testing.rs
src/models/user.rs
src/models/vehicle.rs

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_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
*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user
@ -64,14 +65,17 @@ Class | Method | HTTP request | Description
- [NumericEnumTesting](docs/NumericEnumTesting.md)
- [OptionalTesting](docs/OptionalTesting.md)
- [Order](docs/Order.md)
- [Person](docs/Person.md)
- [Pet](docs/Pet.md)
- [PropertyTest](docs/PropertyTest.md)
- [Ref](docs/Ref.md)
- [Return](docs/Return.md)
- [Tag](docs/Tag.md)
- [TestsDiscriminatorDuplicateEnumsGet200Response](docs/TestsDiscriminatorDuplicateEnumsGet200Response.md)
- [TypeTesting](docs/TypeTesting.md)
- [UniqueItemArrayTesting](docs/UniqueItemArrayTesting.md)
- [User](docs/User.md)
- [Vehicle](docs/Vehicle.md)
To get access to the crate's generated documentation, use:

View File

@ -0,0 +1,12 @@
# Person
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**r#type** | **String** | |
**name** | **String** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -4,11 +4,37 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**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_discriminator_duplicate_enums_get
> models::TestsDiscriminatorDuplicateEnumsGet200Response tests_discriminator_duplicate_enums_get()
Test for duplicate enums when using discriminator. (One of the issues in #20500)
### Parameters
This endpoint does not need any parameter.
### Return type
[**models::TestsDiscriminatorDuplicateEnumsGet200Response**](_tests_discriminatorDuplicateEnums_get_200_response.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **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_file_response_get
> std::path::PathBuf tests_file_response_get()

View File

@ -0,0 +1,10 @@
# TestsDiscriminatorDuplicateEnumsGet200Response
## Enum Variants
| Name | Value |
|---- | -----|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# Vehicle
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**r#type** | **String** | |
**speed** | **f64** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -23,6 +23,11 @@ use crate::apis::ContentType;
#[async_trait]
pub trait TestingApi: Send + Sync {
/// GET /tests/discriminatorDuplicateEnums
///
///
async fn tests_discriminator_duplicate_enums_get<>(&self, ) -> Result<models::TestsDiscriminatorDuplicateEnumsGet200Response, Error<TestsDiscriminatorDuplicateEnumsGetError>>;
/// GET /tests/fileResponse
///
///
@ -48,6 +53,43 @@ impl TestingApiClient {
#[async_trait]
impl TestingApi for TestingApiClient {
async fn tests_discriminator_duplicate_enums_get<>(&self, ) -> Result<models::TestsDiscriminatorDuplicateEnumsGet200Response, Error<TestsDiscriminatorDuplicateEnumsGetError>> {
let local_var_configuration = &self.configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/tests/discriminatorDuplicateEnums", 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());
}
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 `models::TestsDiscriminatorDuplicateEnumsGet200Response`"))),
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 `models::TestsDiscriminatorDuplicateEnumsGet200Response`")))),
}
} else {
let local_var_entity: Option<TestsDiscriminatorDuplicateEnumsGetError> = 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_file_response_get<>(&self, ) -> Result<std::path::PathBuf, Error<TestsFileResponseGetError>> {
let local_var_configuration = &self.configuration;
@ -124,6 +166,13 @@ impl TestingApi for TestingApiClient {
}
/// struct for typed errors of method [`tests_discriminator_duplicate_enums_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum TestsDiscriminatorDuplicateEnumsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tests_file_response_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]

View File

@ -0,0 +1,57 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "objectType")]
pub enum TestsDiscriminatorDuplicateEnumsGet200Response {
#[serde(rename="car")]
Vehicle {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
#[serde(rename="student")]
PersonStudent {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
#[serde(rename="teacher")]
PersonTeacher {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
}
impl Default for TestsDiscriminatorDuplicateEnumsGet200Response {
fn default() -> Self {
Self::Vehicle {
r#type: Default::default(),
name: Default::default(),
speed: Default::default(),
}
}
}

View File

@ -20,6 +20,8 @@ pub mod optional_testing;
pub use self::optional_testing::OptionalTesting;
pub mod order;
pub use self::order::Order;
pub mod person;
pub use self::person::Person;
pub mod pet;
pub use self::pet::Pet;
pub mod property_test;
@ -30,9 +32,13 @@ pub mod model_return;
pub use self::model_return::Return;
pub mod tag;
pub use self::tag::Tag;
pub mod _tests_discriminator_duplicate_enums_get_200_response;
pub use self::_tests_discriminator_duplicate_enums_get_200_response::TestsDiscriminatorDuplicateEnumsGet200Response;
pub mod type_testing;
pub use self::type_testing::TypeTesting;
pub mod unique_item_array_testing;
pub use self::unique_item_array_testing::UniqueItemArrayTesting;
pub mod user;
pub use self::user::User;
pub mod vehicle;
pub use self::vehicle::Vehicle;

View File

@ -0,0 +1,30 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Person {
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "name")]
pub name: String,
}
impl Person {
pub fn new(r#type: String, name: String) -> Person {
Person {
r#type,
name,
}
}
}

View File

@ -0,0 +1,30 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Vehicle {
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "speed")]
pub speed: f64,
}
impl Vehicle {
pub fn new(r#type: String, speed: f64) -> Vehicle {
Vehicle {
r#type,
speed,
}
}
}

View File

@ -14,6 +14,7 @@ docs/NullableArray.md
docs/NumericEnumTesting.md
docs/OptionalTesting.md
docs/Order.md
docs/Person.md
docs/Pet.md
docs/PetApi.md
docs/PropertyTest.md
@ -22,10 +23,12 @@ docs/Return.md
docs/StoreApi.md
docs/Tag.md
docs/TestingApi.md
docs/TestsDiscriminatorDuplicateEnumsGet200Response.md
docs/TypeTesting.md
docs/UniqueItemArrayTesting.md
docs/User.md
docs/UserApi.md
docs/Vehicle.md
git_push.sh
src/apis/configuration.rs
src/apis/fake_api.rs
@ -35,6 +38,7 @@ src/apis/store_api.rs
src/apis/testing_api.rs
src/apis/user_api.rs
src/lib.rs
src/models/_tests_discriminator_duplicate_enums_get_200_response.rs
src/models/action_container.rs
src/models/any_type_test.rs
src/models/api_response.rs
@ -49,9 +53,11 @@ src/models/nullable_array.rs
src/models/numeric_enum_testing.rs
src/models/optional_testing.rs
src/models/order.rs
src/models/person.rs
src/models/pet.rs
src/models/property_test.rs
src/models/tag.rs
src/models/type_testing.rs
src/models/unique_item_array_testing.rs
src/models/user.rs
src/models/vehicle.rs

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_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
*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user
@ -64,14 +65,17 @@ Class | Method | HTTP request | Description
- [NumericEnumTesting](docs/NumericEnumTesting.md)
- [OptionalTesting](docs/OptionalTesting.md)
- [Order](docs/Order.md)
- [Person](docs/Person.md)
- [Pet](docs/Pet.md)
- [PropertyTest](docs/PropertyTest.md)
- [Ref](docs/Ref.md)
- [Return](docs/Return.md)
- [Tag](docs/Tag.md)
- [TestsDiscriminatorDuplicateEnumsGet200Response](docs/TestsDiscriminatorDuplicateEnumsGet200Response.md)
- [TypeTesting](docs/TypeTesting.md)
- [UniqueItemArrayTesting](docs/UniqueItemArrayTesting.md)
- [User](docs/User.md)
- [Vehicle](docs/Vehicle.md)
To get access to the crate's generated documentation, use:

View File

@ -0,0 +1,12 @@
# Person
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**r#type** | **String** | |
**name** | **String** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -4,11 +4,37 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**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_discriminator_duplicate_enums_get
> models::TestsDiscriminatorDuplicateEnumsGet200Response tests_discriminator_duplicate_enums_get()
Test for duplicate enums when using discriminator. (One of the issues in #20500)
### Parameters
This endpoint does not need any parameter.
### Return type
[**models::TestsDiscriminatorDuplicateEnumsGet200Response**](_tests_discriminatorDuplicateEnums_get_200_response.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **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_file_response_get
> std::path::PathBuf tests_file_response_get()

View File

@ -0,0 +1,10 @@
# TestsDiscriminatorDuplicateEnumsGet200Response
## Enum Variants
| Name | Value |
|---- | -----|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# Vehicle
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**r#type** | **String** | |
**speed** | **f64** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -15,6 +15,14 @@ use crate::{apis::ResponseContent, models};
use super::{Error, configuration, ContentType};
/// struct for typed successes of method [`tests_discriminator_duplicate_enums_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum TestsDiscriminatorDuplicateEnumsGetSuccess {
Status200(models::TestsDiscriminatorDuplicateEnumsGet200Response),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`tests_file_response_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
@ -31,6 +39,13 @@ pub enum TestsTypeTestingGetSuccess {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tests_discriminator_duplicate_enums_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum TestsDiscriminatorDuplicateEnumsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tests_file_response_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
@ -46,6 +61,31 @@ pub enum TestsTypeTestingGetError {
}
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);
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());
}
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<TestsDiscriminatorDuplicateEnumsGetSuccess> = serde_json::from_str(&content).ok();
Ok(ResponseContent { status, content, entity })
} else {
let content = resp.text().await?;
let entity: Option<TestsDiscriminatorDuplicateEnumsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn tests_file_response_get(configuration: &configuration::Configuration) -> Result<reqwest::Response, Error<TestsFileResponseGetError>> {
let uri_str = format!("{}/tests/fileResponse", configuration.base_path);

View File

@ -0,0 +1,57 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "objectType")]
pub enum TestsDiscriminatorDuplicateEnumsGet200Response {
#[serde(rename="car")]
Vehicle {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
#[serde(rename="student")]
PersonStudent {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
#[serde(rename="teacher")]
PersonTeacher {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
}
impl Default for TestsDiscriminatorDuplicateEnumsGet200Response {
fn default() -> Self {
Self::Vehicle {
r#type: Default::default(),
name: Default::default(),
speed: Default::default(),
}
}
}

View File

@ -20,6 +20,8 @@ pub mod optional_testing;
pub use self::optional_testing::OptionalTesting;
pub mod order;
pub use self::order::Order;
pub mod person;
pub use self::person::Person;
pub mod pet;
pub use self::pet::Pet;
pub mod property_test;
@ -30,9 +32,13 @@ pub mod model_return;
pub use self::model_return::Return;
pub mod tag;
pub use self::tag::Tag;
pub mod _tests_discriminator_duplicate_enums_get_200_response;
pub use self::_tests_discriminator_duplicate_enums_get_200_response::TestsDiscriminatorDuplicateEnumsGet200Response;
pub mod type_testing;
pub use self::type_testing::TypeTesting;
pub mod unique_item_array_testing;
pub use self::unique_item_array_testing::UniqueItemArrayTesting;
pub mod user;
pub use self::user::User;
pub mod vehicle;
pub use self::vehicle::Vehicle;

View File

@ -0,0 +1,30 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Person {
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "name")]
pub name: String,
}
impl Person {
pub fn new(r#type: String, name: String) -> Person {
Person {
r#type,
name,
}
}
}

View File

@ -0,0 +1,30 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Vehicle {
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "speed")]
pub speed: f64,
}
impl Vehicle {
pub fn new(r#type: String, speed: f64) -> Vehicle {
Vehicle {
r#type,
speed,
}
}
}

View File

@ -14,6 +14,7 @@ docs/NullableArray.md
docs/NumericEnumTesting.md
docs/OptionalTesting.md
docs/Order.md
docs/Person.md
docs/Pet.md
docs/PetApi.md
docs/PropertyTest.md
@ -22,10 +23,12 @@ docs/Return.md
docs/StoreApi.md
docs/Tag.md
docs/TestingApi.md
docs/TestsDiscriminatorDuplicateEnumsGet200Response.md
docs/TypeTesting.md
docs/UniqueItemArrayTesting.md
docs/User.md
docs/UserApi.md
docs/Vehicle.md
git_push.sh
src/apis/configuration.rs
src/apis/fake_api.rs
@ -35,6 +38,7 @@ src/apis/store_api.rs
src/apis/testing_api.rs
src/apis/user_api.rs
src/lib.rs
src/models/_tests_discriminator_duplicate_enums_get_200_response.rs
src/models/action_container.rs
src/models/any_type_test.rs
src/models/api_response.rs
@ -49,9 +53,11 @@ src/models/nullable_array.rs
src/models/numeric_enum_testing.rs
src/models/optional_testing.rs
src/models/order.rs
src/models/person.rs
src/models/pet.rs
src/models/property_test.rs
src/models/tag.rs
src/models/type_testing.rs
src/models/unique_item_array_testing.rs
src/models/user.rs
src/models/vehicle.rs

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_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
*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user
@ -64,14 +65,17 @@ Class | Method | HTTP request | Description
- [NumericEnumTesting](docs/NumericEnumTesting.md)
- [OptionalTesting](docs/OptionalTesting.md)
- [Order](docs/Order.md)
- [Person](docs/Person.md)
- [Pet](docs/Pet.md)
- [PropertyTest](docs/PropertyTest.md)
- [Ref](docs/Ref.md)
- [Return](docs/Return.md)
- [Tag](docs/Tag.md)
- [TestsDiscriminatorDuplicateEnumsGet200Response](docs/TestsDiscriminatorDuplicateEnumsGet200Response.md)
- [TypeTesting](docs/TypeTesting.md)
- [UniqueItemArrayTesting](docs/UniqueItemArrayTesting.md)
- [User](docs/User.md)
- [Vehicle](docs/Vehicle.md)
To get access to the crate's generated documentation, use:

View File

@ -0,0 +1,12 @@
# Person
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**r#type** | **String** | |
**name** | **String** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -4,11 +4,37 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**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_discriminator_duplicate_enums_get
> models::TestsDiscriminatorDuplicateEnumsGet200Response tests_discriminator_duplicate_enums_get()
Test for duplicate enums when using discriminator. (One of the issues in #20500)
### Parameters
This endpoint does not need any parameter.
### Return type
[**models::TestsDiscriminatorDuplicateEnumsGet200Response**](_tests_discriminatorDuplicateEnums_get_200_response.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **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_file_response_get
> std::path::PathBuf tests_file_response_get()

View File

@ -0,0 +1,10 @@
# TestsDiscriminatorDuplicateEnumsGet200Response
## Enum Variants
| Name | Value |
|---- | -----|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# Vehicle
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**r#type** | **String** | |
**speed** | **f64** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -15,6 +15,14 @@ use crate::{apis::ResponseContent, models};
use super::{Error, configuration, ContentType};
/// struct for typed successes of method [`tests_discriminator_duplicate_enums_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum TestsDiscriminatorDuplicateEnumsGetSuccess {
Status200(models::TestsDiscriminatorDuplicateEnumsGet200Response),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`tests_file_response_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
@ -31,6 +39,13 @@ pub enum TestsTypeTestingGetSuccess {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tests_discriminator_duplicate_enums_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum TestsDiscriminatorDuplicateEnumsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tests_file_response_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
@ -46,6 +61,31 @@ pub enum TestsTypeTestingGetError {
}
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);
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());
}
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<TestsDiscriminatorDuplicateEnumsGetSuccess> = serde_json::from_str(&content).ok();
Ok(ResponseContent { status, content, entity })
} else {
let content = resp.text().await?;
let entity: Option<TestsDiscriminatorDuplicateEnumsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn tests_file_response_get(configuration: &configuration::Configuration) -> Result<reqwest::Response, Error<TestsFileResponseGetError>> {
let uri_str = format!("{}/tests/fileResponse", configuration.base_path);

View File

@ -0,0 +1,57 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "objectType")]
pub enum TestsDiscriminatorDuplicateEnumsGet200Response {
#[serde(rename="car")]
Vehicle {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
#[serde(rename="student")]
PersonStudent {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
#[serde(rename="teacher")]
PersonTeacher {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
}
impl Default for TestsDiscriminatorDuplicateEnumsGet200Response {
fn default() -> Self {
Self::Vehicle {
r#type: Default::default(),
name: Default::default(),
speed: Default::default(),
}
}
}

View File

@ -20,6 +20,8 @@ pub mod optional_testing;
pub use self::optional_testing::OptionalTesting;
pub mod order;
pub use self::order::Order;
pub mod person;
pub use self::person::Person;
pub mod pet;
pub use self::pet::Pet;
pub mod property_test;
@ -30,9 +32,13 @@ pub mod model_return;
pub use self::model_return::Return;
pub mod tag;
pub use self::tag::Tag;
pub mod _tests_discriminator_duplicate_enums_get_200_response;
pub use self::_tests_discriminator_duplicate_enums_get_200_response::TestsDiscriminatorDuplicateEnumsGet200Response;
pub mod type_testing;
pub use self::type_testing::TypeTesting;
pub mod unique_item_array_testing;
pub use self::unique_item_array_testing::UniqueItemArrayTesting;
pub mod user;
pub use self::user::User;
pub mod vehicle;
pub use self::vehicle::Vehicle;

View File

@ -0,0 +1,30 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Person {
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "name")]
pub name: String,
}
impl Person {
pub fn new(r#type: String, name: String) -> Person {
Person {
r#type,
name,
}
}
}

View File

@ -0,0 +1,30 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Vehicle {
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "speed")]
pub speed: f64,
}
impl Vehicle {
pub fn new(r#type: String, speed: f64) -> Vehicle {
Vehicle {
r#type,
speed,
}
}
}

View File

@ -14,6 +14,7 @@ docs/NullableArray.md
docs/NumericEnumTesting.md
docs/OptionalTesting.md
docs/Order.md
docs/Person.md
docs/Pet.md
docs/PetApi.md
docs/PropertyTest.md
@ -22,10 +23,12 @@ docs/Return.md
docs/StoreApi.md
docs/Tag.md
docs/TestingApi.md
docs/TestsDiscriminatorDuplicateEnumsGet200Response.md
docs/TypeTesting.md
docs/UniqueItemArrayTesting.md
docs/User.md
docs/UserApi.md
docs/Vehicle.md
git_push.sh
src/apis/configuration.rs
src/apis/fake_api.rs
@ -35,6 +38,7 @@ src/apis/store_api.rs
src/apis/testing_api.rs
src/apis/user_api.rs
src/lib.rs
src/models/_tests_discriminator_duplicate_enums_get_200_response.rs
src/models/action_container.rs
src/models/any_type_test.rs
src/models/api_response.rs
@ -49,9 +53,11 @@ src/models/nullable_array.rs
src/models/numeric_enum_testing.rs
src/models/optional_testing.rs
src/models/order.rs
src/models/person.rs
src/models/pet.rs
src/models/property_test.rs
src/models/tag.rs
src/models/type_testing.rs
src/models/unique_item_array_testing.rs
src/models/user.rs
src/models/vehicle.rs

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_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
*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user
@ -64,14 +65,17 @@ Class | Method | HTTP request | Description
- [NumericEnumTesting](docs/NumericEnumTesting.md)
- [OptionalTesting](docs/OptionalTesting.md)
- [Order](docs/Order.md)
- [Person](docs/Person.md)
- [Pet](docs/Pet.md)
- [PropertyTest](docs/PropertyTest.md)
- [Ref](docs/Ref.md)
- [Return](docs/Return.md)
- [Tag](docs/Tag.md)
- [TestsDiscriminatorDuplicateEnumsGet200Response](docs/TestsDiscriminatorDuplicateEnumsGet200Response.md)
- [TypeTesting](docs/TypeTesting.md)
- [UniqueItemArrayTesting](docs/UniqueItemArrayTesting.md)
- [User](docs/User.md)
- [Vehicle](docs/Vehicle.md)
To get access to the crate's generated documentation, use:

View File

@ -0,0 +1,12 @@
# Person
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**r#type** | **String** | |
**name** | **String** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -4,11 +4,37 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**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_discriminator_duplicate_enums_get
> models::TestsDiscriminatorDuplicateEnumsGet200Response tests_discriminator_duplicate_enums_get()
Test for duplicate enums when using discriminator. (One of the issues in #20500)
### Parameters
This endpoint does not need any parameter.
### Return type
[**models::TestsDiscriminatorDuplicateEnumsGet200Response**](_tests_discriminatorDuplicateEnums_get_200_response.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **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_file_response_get
> std::path::PathBuf tests_file_response_get()

View File

@ -0,0 +1,10 @@
# TestsDiscriminatorDuplicateEnumsGet200Response
## Enum Variants
| Name | Value |
|---- | -----|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# Vehicle
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**r#type** | **String** | |
**speed** | **f64** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -15,6 +15,14 @@ use crate::{apis::ResponseContent, models};
use super::{Error, configuration, ContentType};
/// struct for typed successes of method [`tests_discriminator_duplicate_enums_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum TestsDiscriminatorDuplicateEnumsGetSuccess {
Status200(models::TestsDiscriminatorDuplicateEnumsGet200Response),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`tests_file_response_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
@ -31,6 +39,13 @@ pub enum TestsTypeTestingGetSuccess {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tests_discriminator_duplicate_enums_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum TestsDiscriminatorDuplicateEnumsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tests_file_response_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
@ -46,6 +61,31 @@ pub enum TestsTypeTestingGetError {
}
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);
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());
}
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<TestsDiscriminatorDuplicateEnumsGetSuccess> = serde_json::from_str(&content).ok();
Ok(ResponseContent { status, content, entity })
} else {
let content = resp.text().await?;
let entity: Option<TestsDiscriminatorDuplicateEnumsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn tests_file_response_get(configuration: &configuration::Configuration) -> Result<reqwest::Response, Error<TestsFileResponseGetError>> {
let uri_str = format!("{}/tests/fileResponse", configuration.base_path);

View File

@ -0,0 +1,57 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "objectType")]
pub enum TestsDiscriminatorDuplicateEnumsGet200Response {
#[serde(rename="car")]
Vehicle {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
#[serde(rename="student")]
PersonStudent {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
#[serde(rename="teacher")]
PersonTeacher {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
}
impl Default for TestsDiscriminatorDuplicateEnumsGet200Response {
fn default() -> Self {
Self::Vehicle {
r#type: Default::default(),
name: Default::default(),
speed: Default::default(),
}
}
}

View File

@ -20,6 +20,8 @@ pub mod optional_testing;
pub use self::optional_testing::OptionalTesting;
pub mod order;
pub use self::order::Order;
pub mod person;
pub use self::person::Person;
pub mod pet;
pub use self::pet::Pet;
pub mod property_test;
@ -30,9 +32,13 @@ pub mod model_return;
pub use self::model_return::Return;
pub mod tag;
pub use self::tag::Tag;
pub mod _tests_discriminator_duplicate_enums_get_200_response;
pub use self::_tests_discriminator_duplicate_enums_get_200_response::TestsDiscriminatorDuplicateEnumsGet200Response;
pub mod type_testing;
pub use self::type_testing::TypeTesting;
pub mod unique_item_array_testing;
pub use self::unique_item_array_testing::UniqueItemArrayTesting;
pub mod user;
pub use self::user::User;
pub mod vehicle;
pub use self::vehicle::Vehicle;

View File

@ -0,0 +1,30 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Person {
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "name")]
pub name: String,
}
impl Person {
pub fn new(r#type: String, name: String) -> Person {
Person {
r#type,
name,
}
}
}

View File

@ -0,0 +1,30 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Vehicle {
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "speed")]
pub speed: f64,
}
impl Vehicle {
pub fn new(r#type: String, speed: f64) -> Vehicle {
Vehicle {
r#type,
speed,
}
}
}

View File

@ -14,6 +14,7 @@ docs/NullableArray.md
docs/NumericEnumTesting.md
docs/OptionalTesting.md
docs/Order.md
docs/Person.md
docs/Pet.md
docs/PetApi.md
docs/PropertyTest.md
@ -22,10 +23,12 @@ docs/Return.md
docs/StoreApi.md
docs/Tag.md
docs/TestingApi.md
docs/TestsDiscriminatorDuplicateEnumsGet200Response.md
docs/TypeTesting.md
docs/UniqueItemArrayTesting.md
docs/User.md
docs/UserApi.md
docs/Vehicle.md
git_push.sh
src/apis/configuration.rs
src/apis/fake_api.rs
@ -35,6 +38,7 @@ src/apis/store_api.rs
src/apis/testing_api.rs
src/apis/user_api.rs
src/lib.rs
src/models/_tests_discriminator_duplicate_enums_get_200_response.rs
src/models/action_container.rs
src/models/any_type_test.rs
src/models/api_response.rs
@ -49,9 +53,11 @@ src/models/nullable_array.rs
src/models/numeric_enum_testing.rs
src/models/optional_testing.rs
src/models/order.rs
src/models/person.rs
src/models/pet.rs
src/models/property_test.rs
src/models/tag.rs
src/models/type_testing.rs
src/models/unique_item_array_testing.rs
src/models/user.rs
src/models/vehicle.rs

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_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
*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user
@ -64,14 +65,17 @@ Class | Method | HTTP request | Description
- [NumericEnumTesting](docs/NumericEnumTesting.md)
- [OptionalTesting](docs/OptionalTesting.md)
- [Order](docs/Order.md)
- [Person](docs/Person.md)
- [Pet](docs/Pet.md)
- [PropertyTest](docs/PropertyTest.md)
- [Ref](docs/Ref.md)
- [Return](docs/Return.md)
- [Tag](docs/Tag.md)
- [TestsDiscriminatorDuplicateEnumsGet200Response](docs/TestsDiscriminatorDuplicateEnumsGet200Response.md)
- [TypeTesting](docs/TypeTesting.md)
- [UniqueItemArrayTesting](docs/UniqueItemArrayTesting.md)
- [User](docs/User.md)
- [Vehicle](docs/Vehicle.md)
To get access to the crate's generated documentation, use:

View File

@ -0,0 +1,12 @@
# Person
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**r#type** | **String** | |
**name** | **String** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -4,11 +4,37 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**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_discriminator_duplicate_enums_get
> models::TestsDiscriminatorDuplicateEnumsGet200Response tests_discriminator_duplicate_enums_get()
Test for duplicate enums when using discriminator. (One of the issues in #20500)
### Parameters
This endpoint does not need any parameter.
### Return type
[**models::TestsDiscriminatorDuplicateEnumsGet200Response**](_tests_discriminatorDuplicateEnums_get_200_response.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **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_file_response_get
> std::path::PathBuf tests_file_response_get()

View File

@ -0,0 +1,10 @@
# TestsDiscriminatorDuplicateEnumsGet200Response
## Enum Variants
| Name | Value |
|---- | -----|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# Vehicle
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**r#type** | **String** | |
**speed** | **f64** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -15,6 +15,14 @@ use crate::{apis::ResponseContent, models};
use super::{Error, configuration, ContentType};
/// struct for typed successes of method [`tests_discriminator_duplicate_enums_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum TestsDiscriminatorDuplicateEnumsGetSuccess {
Status200(models::TestsDiscriminatorDuplicateEnumsGet200Response),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`tests_file_response_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
@ -31,6 +39,13 @@ pub enum TestsTypeTestingGetSuccess {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tests_discriminator_duplicate_enums_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum TestsDiscriminatorDuplicateEnumsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tests_file_response_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
@ -46,6 +61,31 @@ pub enum TestsTypeTestingGetError {
}
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);
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());
}
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<TestsDiscriminatorDuplicateEnumsGetSuccess> = serde_json::from_str(&content).ok();
Ok(ResponseContent { status, content, entity })
} else {
let content = resp.text().await?;
let entity: Option<TestsDiscriminatorDuplicateEnumsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn tests_file_response_get(configuration: &configuration::Configuration) -> Result<reqwest::Response, Error<TestsFileResponseGetError>> {
let uri_str = format!("{}/tests/fileResponse", configuration.base_path);

View File

@ -0,0 +1,57 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "objectType")]
pub enum TestsDiscriminatorDuplicateEnumsGet200Response {
#[serde(rename="car")]
Vehicle {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
#[serde(rename="student")]
PersonStudent {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
#[serde(rename="teacher")]
PersonTeacher {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
}
impl Default for TestsDiscriminatorDuplicateEnumsGet200Response {
fn default() -> Self {
Self::Vehicle {
r#type: Default::default(),
name: Default::default(),
speed: Default::default(),
}
}
}

View File

@ -20,6 +20,8 @@ pub mod optional_testing;
pub use self::optional_testing::OptionalTesting;
pub mod order;
pub use self::order::Order;
pub mod person;
pub use self::person::Person;
pub mod pet;
pub use self::pet::Pet;
pub mod property_test;
@ -30,9 +32,13 @@ pub mod model_return;
pub use self::model_return::Return;
pub mod tag;
pub use self::tag::Tag;
pub mod _tests_discriminator_duplicate_enums_get_200_response;
pub use self::_tests_discriminator_duplicate_enums_get_200_response::TestsDiscriminatorDuplicateEnumsGet200Response;
pub mod type_testing;
pub use self::type_testing::TypeTesting;
pub mod unique_item_array_testing;
pub use self::unique_item_array_testing::UniqueItemArrayTesting;
pub mod user;
pub use self::user::User;
pub mod vehicle;
pub use self::vehicle::Vehicle;

View File

@ -0,0 +1,30 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Person {
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "name")]
pub name: String,
}
impl Person {
pub fn new(r#type: String, name: String) -> Person {
Person {
r#type,
name,
}
}
}

View File

@ -0,0 +1,30 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Vehicle {
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "speed")]
pub speed: f64,
}
impl Vehicle {
pub fn new(r#type: String, speed: f64) -> Vehicle {
Vehicle {
r#type,
speed,
}
}
}

View File

@ -14,6 +14,7 @@ docs/NullableArray.md
docs/NumericEnumTesting.md
docs/OptionalTesting.md
docs/Order.md
docs/Person.md
docs/Pet.md
docs/PetApi.md
docs/PropertyTest.md
@ -22,10 +23,12 @@ docs/Return.md
docs/StoreApi.md
docs/Tag.md
docs/TestingApi.md
docs/TestsDiscriminatorDuplicateEnumsGet200Response.md
docs/TypeTesting.md
docs/UniqueItemArrayTesting.md
docs/User.md
docs/UserApi.md
docs/Vehicle.md
git_push.sh
src/apis/configuration.rs
src/apis/fake_api.rs
@ -35,6 +38,7 @@ src/apis/store_api.rs
src/apis/testing_api.rs
src/apis/user_api.rs
src/lib.rs
src/models/_tests_discriminator_duplicate_enums_get_200_response.rs
src/models/action_container.rs
src/models/any_type_test.rs
src/models/api_response.rs
@ -49,9 +53,11 @@ src/models/nullable_array.rs
src/models/numeric_enum_testing.rs
src/models/optional_testing.rs
src/models/order.rs
src/models/person.rs
src/models/pet.rs
src/models/property_test.rs
src/models/tag.rs
src/models/type_testing.rs
src/models/unique_item_array_testing.rs
src/models/user.rs
src/models/vehicle.rs

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_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
*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user
@ -64,14 +65,17 @@ Class | Method | HTTP request | Description
- [NumericEnumTesting](docs/NumericEnumTesting.md)
- [OptionalTesting](docs/OptionalTesting.md)
- [Order](docs/Order.md)
- [Person](docs/Person.md)
- [Pet](docs/Pet.md)
- [PropertyTest](docs/PropertyTest.md)
- [Ref](docs/Ref.md)
- [Return](docs/Return.md)
- [Tag](docs/Tag.md)
- [TestsDiscriminatorDuplicateEnumsGet200Response](docs/TestsDiscriminatorDuplicateEnumsGet200Response.md)
- [TypeTesting](docs/TypeTesting.md)
- [UniqueItemArrayTesting](docs/UniqueItemArrayTesting.md)
- [User](docs/User.md)
- [Vehicle](docs/Vehicle.md)
To get access to the crate's generated documentation, use:

View File

@ -0,0 +1,12 @@
# Person
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**r#type** | **String** | |
**name** | **String** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -4,11 +4,37 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**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_discriminator_duplicate_enums_get
> models::TestsDiscriminatorDuplicateEnumsGet200Response tests_discriminator_duplicate_enums_get()
Test for duplicate enums when using discriminator. (One of the issues in #20500)
### Parameters
This endpoint does not need any parameter.
### Return type
[**models::TestsDiscriminatorDuplicateEnumsGet200Response**](_tests_discriminatorDuplicateEnums_get_200_response.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **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_file_response_get
> std::path::PathBuf tests_file_response_get()

View File

@ -0,0 +1,10 @@
# TestsDiscriminatorDuplicateEnumsGet200Response
## Enum Variants
| Name | Value |
|---- | -----|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# Vehicle
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**r#type** | **String** | |
**speed** | **f64** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -15,6 +15,13 @@ use crate::{apis::ResponseContent, models};
use super::{Error, configuration, ContentType};
/// struct for typed errors of method [`tests_discriminator_duplicate_enums_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum TestsDiscriminatorDuplicateEnumsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tests_file_response_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
@ -30,6 +37,40 @@ pub enum TestsTypeTestingGetError {
}
pub fn tests_discriminator_duplicate_enums_get(configuration: &configuration::Configuration, ) -> Result<models::TestsDiscriminatorDuplicateEnumsGet200Response, Error<TestsDiscriminatorDuplicateEnumsGetError>> {
let uri_str = format!("{}/tests/discriminatorDuplicateEnums", 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());
}
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 `models::TestsDiscriminatorDuplicateEnumsGet200Response`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TestsDiscriminatorDuplicateEnumsGet200Response`")))),
}
} else {
let content = resp.text()?;
let entity: Option<TestsDiscriminatorDuplicateEnumsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub fn tests_file_response_get(configuration: &configuration::Configuration, ) -> Result<reqwest::blocking::Response, Error<TestsFileResponseGetError>> {
let uri_str = format!("{}/tests/fileResponse", configuration.base_path);

View File

@ -0,0 +1,57 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "objectType")]
pub enum TestsDiscriminatorDuplicateEnumsGet200Response {
#[serde(rename="car")]
Vehicle {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
#[serde(rename="student")]
PersonStudent {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
#[serde(rename="teacher")]
PersonTeacher {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
}
impl Default for TestsDiscriminatorDuplicateEnumsGet200Response {
fn default() -> Self {
Self::Vehicle {
r#type: Default::default(),
name: Default::default(),
speed: Default::default(),
}
}
}

View File

@ -20,6 +20,8 @@ pub mod optional_testing;
pub use self::optional_testing::OptionalTesting;
pub mod order;
pub use self::order::Order;
pub mod person;
pub use self::person::Person;
pub mod pet;
pub use self::pet::Pet;
pub mod property_test;
@ -30,9 +32,13 @@ pub mod model_return;
pub use self::model_return::Return;
pub mod tag;
pub use self::tag::Tag;
pub mod _tests_discriminator_duplicate_enums_get_200_response;
pub use self::_tests_discriminator_duplicate_enums_get_200_response::TestsDiscriminatorDuplicateEnumsGet200Response;
pub mod type_testing;
pub use self::type_testing::TypeTesting;
pub mod unique_item_array_testing;
pub use self::unique_item_array_testing::UniqueItemArrayTesting;
pub mod user;
pub use self::user::User;
pub mod vehicle;
pub use self::vehicle::Vehicle;

View File

@ -0,0 +1,30 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Person {
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "name")]
pub name: String,
}
impl Person {
pub fn new(r#type: String, name: String) -> Person {
Person {
r#type,
name,
}
}
}

View File

@ -0,0 +1,30 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Vehicle {
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "speed")]
pub speed: f64,
}
impl Vehicle {
pub fn new(r#type: String, speed: f64) -> Vehicle {
Vehicle {
r#type,
speed,
}
}
}

View File

@ -14,14 +14,17 @@ docs/FooNullableArray.md
docs/FooNumericEnumTesting.md
docs/FooOptionalTesting.md
docs/FooOrder.md
docs/FooPerson.md
docs/FooPet.md
docs/FooPropertyTest.md
docs/FooRef.md
docs/FooReturn.md
docs/FooTag.md
docs/FooTestsDiscriminatorDuplicateEnumsGet200Response.md
docs/FooTypeTesting.md
docs/FooUniqueItemArrayTesting.md
docs/FooUser.md
docs/FooVehicle.md
docs/PetApi.md
docs/StoreApi.md
docs/TestingApi.md
@ -35,6 +38,7 @@ src/apis/store_api.rs
src/apis/testing_api.rs
src/apis/user_api.rs
src/lib.rs
src/models/foo__tests_discriminator_duplicate_enums_get_200_response.rs
src/models/foo_action_container.rs
src/models/foo_any_type_test.rs
src/models/foo_api_response.rs
@ -46,6 +50,7 @@ src/models/foo_nullable_array.rs
src/models/foo_numeric_enum_testing.rs
src/models/foo_optional_testing.rs
src/models/foo_order.rs
src/models/foo_person.rs
src/models/foo_pet.rs
src/models/foo_property_test.rs
src/models/foo_ref.rs
@ -54,4 +59,5 @@ src/models/foo_tag.rs
src/models/foo_type_testing.rs
src/models/foo_unique_item_array_testing.rs
src/models/foo_user.rs
src/models/foo_vehicle.rs
src/models/mod.rs

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_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
*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user
@ -64,14 +65,17 @@ Class | Method | HTTP request | Description
- [FooNumericEnumTesting](docs/FooNumericEnumTesting.md)
- [FooOptionalTesting](docs/FooOptionalTesting.md)
- [FooOrder](docs/FooOrder.md)
- [FooPerson](docs/FooPerson.md)
- [FooPet](docs/FooPet.md)
- [FooPropertyTest](docs/FooPropertyTest.md)
- [FooRef](docs/FooRef.md)
- [FooReturn](docs/FooReturn.md)
- [FooTag](docs/FooTag.md)
- [FooTestsDiscriminatorDuplicateEnumsGet200Response](docs/FooTestsDiscriminatorDuplicateEnumsGet200Response.md)
- [FooTypeTesting](docs/FooTypeTesting.md)
- [FooUniqueItemArrayTesting](docs/FooUniqueItemArrayTesting.md)
- [FooUser](docs/FooUser.md)
- [FooVehicle](docs/FooVehicle.md)
To get access to the crate's generated documentation, use:

View File

@ -0,0 +1,12 @@
# FooPerson
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**r#type** | **String** | |
**name** | **String** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# FooTestsDiscriminatorDuplicateEnumsGet200Response
## Enum Variants
| Name | Value |
|---- | -----|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# FooVehicle
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**r#type** | **String** | |
**speed** | **f64** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -4,11 +4,37 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**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_discriminator_duplicate_enums_get
> models::FooTestsDiscriminatorDuplicateEnumsGet200Response tests_discriminator_duplicate_enums_get()
Test for duplicate enums when using discriminator. (One of the issues in #20500)
### Parameters
This endpoint does not need any parameter.
### Return type
[**models::FooTestsDiscriminatorDuplicateEnumsGet200Response**](_tests_discriminatorDuplicateEnums_get_200_response.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **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_file_response_get
> std::path::PathBuf tests_file_response_get()

View File

@ -15,6 +15,13 @@ use crate::{apis::ResponseContent, models};
use super::{Error, configuration, ContentType};
/// struct for typed errors of method [`tests_discriminator_duplicate_enums_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum TestsDiscriminatorDuplicateEnumsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tests_file_response_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
@ -30,6 +37,40 @@ pub enum TestsTypeTestingGetError {
}
pub fn tests_discriminator_duplicate_enums_get(configuration: &configuration::Configuration, ) -> Result<models::FooTestsDiscriminatorDuplicateEnumsGet200Response, Error<TestsDiscriminatorDuplicateEnumsGetError>> {
let uri_str = format!("{}/tests/discriminatorDuplicateEnums", 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());
}
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 `models::FooTestsDiscriminatorDuplicateEnumsGet200Response`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::FooTestsDiscriminatorDuplicateEnumsGet200Response`")))),
}
} else {
let content = resp.text()?;
let entity: Option<TestsDiscriminatorDuplicateEnumsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub fn tests_file_response_get(configuration: &configuration::Configuration, ) -> Result<reqwest::blocking::Response, Error<TestsFileResponseGetError>> {
let uri_str = format!("{}/tests/fileResponse", configuration.base_path);

View File

@ -0,0 +1,57 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "objectType")]
pub enum FooTestsDiscriminatorDuplicateEnumsGet200Response {
#[serde(rename="car")]
FooVehicle {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
#[serde(rename="student")]
FooPersonStudent {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
#[serde(rename="teacher")]
FooPersonTeacher {
#[serde(rename = "type")]
r#type: String,
#[serde(rename = "name")]
name: String,
#[serde(rename = "speed")]
speed: f64,
},
}
impl Default for FooTestsDiscriminatorDuplicateEnumsGet200Response {
fn default() -> Self {
Self::FooVehicle {
r#type: Default::default(),
name: Default::default(),
speed: Default::default(),
}
}
}

View File

@ -0,0 +1,30 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct FooPerson {
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "name")]
pub name: String,
}
impl FooPerson {
pub fn new(r#type: String, name: String) -> FooPerson {
FooPerson {
r#type,
name,
}
}
}

View File

@ -0,0 +1,30 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct FooVehicle {
#[serde(rename = "type")]
pub r#type: String,
#[serde(rename = "speed")]
pub speed: f64,
}
impl FooVehicle {
pub fn new(r#type: String, speed: f64) -> FooVehicle {
FooVehicle {
r#type,
speed,
}
}
}

Some files were not shown because too many files have changed in this diff Show More