Add tests to Rust (hyper, reqwest) clients (#13165)

* add tests to rust clients

* add new file
This commit is contained in:
William Cheng 2022-08-12 13:50:32 +08:00 committed by GitHub
parent 8cd0d38446
commit 456d7d0159
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 210 additions and 0 deletions

View File

@ -777,3 +777,17 @@ components:
uuid:
type: string
format: uuid
ActionContainer:
required:
- action
type: object
properties:
action:
allOf:
- $ref: '#/components/schemas/Baz'
- nullable: false
Baz:
enum:
- A
- B
type: string

View File

@ -2,7 +2,9 @@
.travis.yml
Cargo.toml
README.md
docs/ActionContainer.md
docs/ApiResponse.md
docs/Baz.md
docs/Category.md
docs/FakeApi.md
docs/Order.md
@ -23,7 +25,9 @@ src/apis/request.rs
src/apis/store_api.rs
src/apis/user_api.rs
src/lib.rs
src/models/action_container.rs
src/models/api_response.rs
src/models/baz.rs
src/models/category.rs
src/models/mod.rs
src/models/order.rs

View File

@ -50,7 +50,9 @@ Class | Method | HTTP request | Description
## Documentation For Models
- [ActionContainer](docs/ActionContainer.md)
- [ApiResponse](docs/ApiResponse.md)
- [Baz](docs/Baz.md)
- [Category](docs/Category.md)
- [Order](docs/Order.md)
- [Pet](docs/Pet.md)

View File

@ -0,0 +1,11 @@
# ActionContainer
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**action** | Option<[**crate::models::Baz**](Baz.md)> | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# Baz
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,28 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct ActionContainer {
#[serde(rename = "action")]
pub action: Option<Box<crate::models::Baz>>,
}
impl ActionContainer {
pub fn new(action: Option<crate::models::Baz>) -> ActionContainer {
ActionContainer {
action: if let Some(x) = action {Some(Box::new(x))} else {None},
}
}
}

View File

@ -0,0 +1,39 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Baz {
#[serde(rename = "A")]
A,
#[serde(rename = "B")]
B,
}
impl ToString for Baz {
fn to_string(&self) -> String {
match self {
Self::A => String::from("A"),
Self::B => String::from("B"),
}
}
}
impl Default for Baz {
fn default() -> Baz {
Self::A
}
}

View File

@ -1,5 +1,9 @@
pub mod action_container;
pub use self::action_container::ActionContainer;
pub mod api_response;
pub use self::api_response::ApiResponse;
pub mod baz;
pub use self::baz::Baz;
pub mod category;
pub use self::category::Category;
pub mod order;

View File

@ -2,7 +2,9 @@
.travis.yml
Cargo.toml
README.md
docs/ActionContainer.md
docs/ApiResponse.md
docs/Baz.md
docs/Category.md
docs/FakeApi.md
docs/Order.md
@ -21,7 +23,9 @@ src/apis/pet_api.rs
src/apis/store_api.rs
src/apis/user_api.rs
src/lib.rs
src/models/action_container.rs
src/models/api_response.rs
src/models/baz.rs
src/models/category.rs
src/models/mod.rs
src/models/order.rs

View File

@ -50,7 +50,9 @@ Class | Method | HTTP request | Description
## Documentation For Models
- [ActionContainer](docs/ActionContainer.md)
- [ApiResponse](docs/ApiResponse.md)
- [Baz](docs/Baz.md)
- [Category](docs/Category.md)
- [Order](docs/Order.md)
- [Pet](docs/Pet.md)

View File

@ -0,0 +1,11 @@
# ActionContainer
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**action** | Option<[**crate::models::Baz**](Baz.md)> | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# Baz
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,28 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct ActionContainer {
#[serde(rename = "action")]
pub action: Option<Box<crate::models::Baz>>,
}
impl ActionContainer {
pub fn new(action: Option<crate::models::Baz>) -> ActionContainer {
ActionContainer {
action: if let Some(x) = action {Some(Box::new(x))} else {None},
}
}
}

View File

@ -0,0 +1,39 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Baz {
#[serde(rename = "A")]
A,
#[serde(rename = "B")]
B,
}
impl ToString for Baz {
fn to_string(&self) -> String {
match self {
Self::A => String::from("A"),
Self::B => String::from("B"),
}
}
}
impl Default for Baz {
fn default() -> Baz {
Self::A
}
}

View File

@ -1,5 +1,9 @@
pub mod action_container;
pub use self::action_container::ActionContainer;
pub mod api_response;
pub use self::api_response::ApiResponse;
pub mod baz;
pub use self::baz::Baz;
pub mod category;
pub use self::category::Category;
pub mod order;