Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [PYTHON][securitySchemes:jwtAuth] 'Configuration' object has no attribute 'access_token' #7929

Closed
5 of 6 tasks
lsaavedr opened this issue Nov 12, 2020 · 3 comments
Closed
5 of 6 tasks
Labels
Client: Python Good First Issue An issue that could be fixed with a simple PR Issue: Bug

Comments

@lsaavedr
Copy link

lsaavedr commented Nov 12, 2020

Bug Report

  • 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

In Configuration class its needed define self.access_token = None in __init__ function to use it in auth_settings function, without this its was generated an error:

Traceback (most recent call last):
  File "src/test.py", line 13, in <module>
    ok = api.organizacion_activos_list()
  File "/home/jidj85/envpi/lib/python3.7/site-packages/smi/api/organizacion_api.py", line 338, in organizacion_activos_list
    return self.organizacion_activos_list_with_http_info(**kwargs)  # noqa: E501
  File "/home/jidj85/envpi/lib/python3.7/site-packages/smi/api/organizacion_api.py", line 444, in organizacion_activos_list_with_http_info
    _request_auth=local_var_params.get('_request_auth'))
  File "/home/jidj85/envpi/lib/python3.7/site-packages/smi/api_client.py", line 381, in call_api
    _request_auth)
  File "/home/jidj85/envpi/lib/python3.7/site-packages/smi/api_client.py", line 170, in __call_api
    request_auth=_request_auth)
  File "/home/jidj85/envpi/lib/python3.7/site-packages/smi/api_client.py", line 559, in update_params_for_auth
    auth_setting = self.configuration.auth_settings().get(auth)
  File "/home/jidj85/envpi/lib/python3.7/site-packages/smi/configuration.py", line 423, in auth_settings
    if self.access_token is not None:
AttributeError: 'Configuration' object has no attribute 'access_token'
openapi-generator version

openapi-generator-cli-5.0.0-20201112.170402-866.jar

OpenAPI declaration file content or url

https://smi.enerlink.cl/api/schema

Generation Details
jidj85@~$ java -jar openapi-generator-cli-5.0.0-20201112.170402-866.jar generate \
  -i https://smi.enerlink.cl/api/schema/ \
  --package-name smi \
  -g python \
  -o smi
Steps to reproduce
jidj85@~$ pip3 install smi/
jidj85@~$ python
>>> from smi import Configuration
>>> from smi.api_client import ApiClient
>>> from smi.api.organizacion_api import OrganizacionApi
>>> conf = Configuration(host='https://smi.enerlink.cl')
>>> api = OrganizacionApi(ApiClient(conf))
>>> ok = api.organizacion_activos_list()
Related issues/PRs

None

Suggest a fix

In Configuration class its needed define self.access_token = None in __init__ function to use it in auth_settings function

@auto-labeler
Copy link

auto-labeler bot commented Nov 12, 2020

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

@spacether spacether added the Good First Issue An issue that could be fixed with a simple PR label Jan 18, 2021
@spacether
Copy link
Contributor

spacether commented Jan 18, 2021

Note: this is for:

  securitySchemes:
    jwtAuth:
      type: http
      scheme: bearer
      bearerFormat: Bearer

Which is probably {{#isBasicBearer}} here:
https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/python/configuration.mustache#L508
So one would need to edit this line to fix it:

@spacether
Copy link
Contributor

This was fixed by #7469

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client: Python Good First Issue An issue that could be fixed with a simple PR Issue: Bug
Projects
None yet
Development

No branches or pull requests

2 participants