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:
Daniel García 2025-08-03 18:46:44 +02:00 committed by GitHub
parent 9f2c92079e
commit 31060931b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 8 additions and 7 deletions

View File

@ -5,7 +5,7 @@ inputSpec: modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/rust
additionalProperties:
topLevelApiClient: true
packageName: petstore-reqwest
packageName: petstore-reqwest-trait
mockall: true
enumNameMappings:
delivered: shipped

View File

@ -245,6 +245,7 @@ impl {{classname}} for {{classname}}Client {
_ => local_var_req_builder.query(&[("{{{baseName}}}", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
{{/isArray}}
{{^isArray}}
{{#isDeepObject}}
{{^isExplode}}
let params = crate::apis::parse_deep_object("{{{baseName}}}", &serde_json::to_value(param_value)?);
@ -276,6 +277,7 @@ impl {{classname}} for {{classname}}Client {
{{/isModel}}
{{/isObject}}
{{/isDeepObject}}
{{/isArray}}
}
{{/required}}
{{/queryParams}}

View File

@ -1,3 +1,3 @@
[workspace]
members = ["hyper/*", "reqwest/*"]
members = ["hyper/*", "reqwest/*", "reqwest-trait/*"]
resolver = "2"

View File

@ -1,5 +1,5 @@
[package]
name = "petstore-reqwest"
name = "petstore-reqwest-trait"
version = "1.0.0"
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."

View File

@ -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.
@ -14,10 +14,10 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat
## 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

View File

@ -174,7 +174,6 @@ impl PetApi for PetApiClient {
"multi" => local_var_req_builder.query(&param_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", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
local_var_req_builder = local_var_req_builder.query(&[("type", &param_value.to_string())]);
}
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());