Open tschuett opened 2 years ago
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
let local_var_key = local_var_apikey.key.clone();
let local_var_value = match local_var_apikey.prefix {
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
None => local_var_key,
};
local_var_req_builder = local_var_req_builder.header("X-SLURM-USER-TOKEN", local_var_value);
};
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
let local_var_key = local_var_apikey.key.clone();
let local_var_value = match local_var_apikey.prefix {
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
None => local_var_key,
};
local_var_req_builder = local_var_req_builder.header("X-SLURM-USER-NAME", local_var_value);
};
This looks problematic. It reads the api key twice.
can you try v6.0.0-beta or the latest master ? if i remember correctly, there's a bug fix related to authentication.
I believe the problem is here:
https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/rust/reqwest/configuration.mustache
The Configuration
struct has one optional ApiKey and not two HashMap
s.
ok, can you please file a PR with a fix using HashMap instead?
This is way out of my area of expertise. But I believe there is also generated code accessing the api keys, see above. The code should have looked into dictionaries (user and token).
See the python code for reference.
The generated code seems to be here: https://github.com/OpenAPITools/openapi-generator/blob/6a77660b08eb16d1d1ed577778b11fe46219b559/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache#L132 BUT I do not anything about mustache.
Friendly ping. Are there any plans to address the problem?
Bug Report Checklist
Description
The OpenAPI definition is at: https://github.com/SchedMD/slurm/tree/master/src/plugins/openapi/v0.0.38
I believe the Python version is correct. Note that I have to set two api keys: token and user.
openapi-generator version
5.4.0 from Homebrew
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix
Note that for Rust the ApiKey is one optional value. For Python it is two dictionaries.