OpenAPITools / OpenAPITools/openapi-generator
[BUG] Differences with Rust and Python generators
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
The OpenAPI definition is at:
https://github.com/SchedMD/slurm/tree/master/src/plugins/openapi/v0.0.38
pub struct Configuration {
pub base_path: String,
pub user_agent: Option<String>,
pub client: reqwest::Client,
pub basic_auth: Option<BasicAuth>,
pub oauth_access_token: Option<String>,
pub bearer_access_token: Option<String>,
pub api_key: Option<ApiKey>,
// TODO: take an oauth2 token source, similar to the go one
}
pub struct ApiKey {
pub prefix: Option<String>,
pub key: String,
}
class Configuration(object):
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
:param host: Base url
:param api_key: Dict to store API key(s).
Each entry in the dict specifies an API key.
The dict key is the name of the security scheme in the OAS specification.
The dict value is the API key secret.
:param api_key_prefix: Dict to store API prefix (e.g. Bearer)
The dict key is the name of the security scheme in the OAS specification.
The dict value is an API key prefix when generating the auth data.
def auth_settings(self):
"""Gets Auth Settings dict for api client.
:return: The Auth Settings information dict.
"""
auth = {}
if 'token' in self.api_key:
auth['token'] = {
'type': 'api_key',
'in': 'header',
'key': 'X-SLURM-USER-TOKEN',
'value': self.get_api_key_with_prefix(
'token',
),
}
if 'user' in self.api_key:
auth['user'] = {
'type': 'api_key',
'in': 'header',
'key': 'X-SLURM-USER-NAME',
'value': self.get_api_key_with_prefix(
'user',
),
}
return auth
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the OpenAPI definition linked from the issue and compare the generated Rust Configuration and ApiKey structures with Python Configuration.auth_settings(). Reproduce the generated clients using openapi-generator 5.4.0 and determine whether the token and user API keys are represented consistently. Done means the Rust and Python generators handle these two security schemes consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- api, authentication, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100