mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-10-14 00:13:50 +00:00
Add reqwest-trait crate to workspace and rename it (#21674)
* Add reqwest-trait crate to workspace and rename it * Fix missing ^isArray condition
This commit is contained in:
parent
9f2c92079e
commit
31060931b6
@ -5,7 +5,7 @@ inputSpec: modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml
|
|||||||
templateDir: modules/openapi-generator/src/main/resources/rust
|
templateDir: modules/openapi-generator/src/main/resources/rust
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
topLevelApiClient: true
|
topLevelApiClient: true
|
||||||
packageName: petstore-reqwest
|
packageName: petstore-reqwest-trait
|
||||||
mockall: true
|
mockall: true
|
||||||
enumNameMappings:
|
enumNameMappings:
|
||||||
delivered: shipped
|
delivered: shipped
|
||||||
|
@ -245,6 +245,7 @@ impl {{classname}} for {{classname}}Client {
|
|||||||
_ => local_var_req_builder.query(&[("{{{baseName}}}", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
|
_ => local_var_req_builder.query(&[("{{{baseName}}}", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
|
||||||
};
|
};
|
||||||
{{/isArray}}
|
{{/isArray}}
|
||||||
|
{{^isArray}}
|
||||||
{{#isDeepObject}}
|
{{#isDeepObject}}
|
||||||
{{^isExplode}}
|
{{^isExplode}}
|
||||||
let params = crate::apis::parse_deep_object("{{{baseName}}}", &serde_json::to_value(param_value)?);
|
let params = crate::apis::parse_deep_object("{{{baseName}}}", &serde_json::to_value(param_value)?);
|
||||||
@ -276,6 +277,7 @@ impl {{classname}} for {{classname}}Client {
|
|||||||
{{/isModel}}
|
{{/isModel}}
|
||||||
{{/isObject}}
|
{{/isObject}}
|
||||||
{{/isDeepObject}}
|
{{/isDeepObject}}
|
||||||
|
{{/isArray}}
|
||||||
}
|
}
|
||||||
{{/required}}
|
{{/required}}
|
||||||
{{/queryParams}}
|
{{/queryParams}}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
members = ["hyper/*", "reqwest/*"]
|
members = ["hyper/*", "reqwest/*", "reqwest-trait/*"]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "petstore-reqwest"
|
name = "petstore-reqwest-trait"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
authors = ["OpenAPI Generator team and contributors"]
|
authors = ["OpenAPI Generator team and contributors"]
|
||||||
description = "This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters."
|
description = "This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters."
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Rust API client for petstore-reqwest
|
# Rust API client for petstore-reqwest-trait
|
||||||
|
|
||||||
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
|
|
||||||
@ -14,10 +14,10 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Put the package under your project folder in a directory named `petstore-reqwest` and add the following to `Cargo.toml` under `[dependencies]`:
|
Put the package under your project folder in a directory named `petstore-reqwest-trait` and add the following to `Cargo.toml` under `[dependencies]`:
|
||||||
|
|
||||||
```
|
```
|
||||||
petstore-reqwest = { path = "./petstore-reqwest" }
|
petstore-reqwest-trait = { path = "./petstore-reqwest-trait" }
|
||||||
```
|
```
|
||||||
|
|
||||||
## Documentation for API Endpoints
|
## Documentation for API Endpoints
|
||||||
|
@ -174,7 +174,6 @@ impl PetApi for PetApiClient {
|
|||||||
"multi" => local_var_req_builder.query(¶m_value.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
|
"multi" => local_var_req_builder.query(¶m_value.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
|
||||||
_ => local_var_req_builder.query(&[("type", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
|
_ => local_var_req_builder.query(&[("type", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
|
||||||
};
|
};
|
||||||
local_var_req_builder = local_var_req_builder.query(&[("type", ¶m_value.to_string())]);
|
|
||||||
}
|
}
|
||||||
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
|
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
|
||||||
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
|
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user