Bug Report Checklist
Description
Rust generator does not protect the local variables, so something like the followings will be generated:
// Here, both input and local var have the param `client`, so the second one will shadow the first one
fn revoke_consent_sessions(&self, subject: &str, client: Option<&str>, all: Option<bool>) -> Result<(), Error> {
let configuration: &configuration::Configuration = self.configuration.borrow();
// Maybe something like `localVarClient` is better
// It would be better if conflict detection can be provided by the generator?
let client = &configuration.client;
let uri_str = format!("{}/oauth2/auth/sessions/consent", configuration.base_path);
let mut req_builder = client.delete(uri_str.as_str());
req_builder = req_builder.query(&[("subject", &subject.to_string())]);
// Wrong `client`
if let Some(ref s) = client {
req_builder = req_builder.query(&[("client", &s.to_string())]);
}
if let Some(ref s) = all {
req_builder = req_builder.query(&[("all", &s.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// send request
let req = req_builder.build()?;
client.execute(req)?.error_for_status()?;
Ok(())
}
openapi-generator version
4.3.1
OpenAPI declaration file content or url
https://raw.githubusercontent.com/ory/hydra/master/.schema/api.swagger.json
Generation Details
config.yaml
command
openapi-generator generate -i https://raw.githubusercontent.com/ory/hydra/master/.schema/api.swagger.json -g rust -o output -c config.yaml
Steps to reproduce
- Run the command before
- You will see the error part in
output/src/apis/admin_api.rs, function revoke_consent_sessions
Related issues/PRs
Suggest a fix
- Maybe something like
localVarClient is better
- It would be better if conflict detection can be provided by the generator?
Bug Report Checklist
Description
Rust generator does not protect the local variables, so something like the followings will be generated:
openapi-generator version
4.3.1
OpenAPI declaration file content or url
https://raw.githubusercontent.com/ory/hydra/master/.schema/api.swagger.json
Generation Details
config.yaml
command
Steps to reproduce
output/src/apis/admin_api.rs, functionrevoke_consent_sessionsRelated issues/PRs
Suggest a fix
localVarClientis better