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

Python generator TypeError: Configuration.__init__() got an unexpected keyword argument 'XXX' #14146

Closed
5 tasks done
bayeslearner opened this issue Nov 30, 2022 · 2 comments · Fixed by #14153
Closed
5 tasks done

Comments

@bayeslearner
Copy link

bayeslearner commented Nov 30, 2022

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?
Description
openapi-generator version

openapi-generator-cli 6.2.1
commit : b0ce532
built : 2022-11-01T09:40:00Z
source : https://github.com/openapitools/openapi-generator
docs : https://openapi-generator.tech/

OpenAPI declaration file content or url

https://admin.splunk.com/service/info/specs/v2/openapi.json

Generation Details

openapi-generator generate -g python -o out -i https://admin.splunk.com/service/info/specs/v2/openapi.json --package-name splunkacs --skip-validate-spec

Steps to reproduce

It generates test code that looks like this:

configuration = splunkacs.Configuration(
    access_token = 'xxx')

Later when you run the code, the attribute access_token is not a keyword argument of Configuration and error is thrown.

 configuration = splunkacs.Configuration(
TypeError: Configuration.__init__() got an unexpected keyword argument 'access_token'

This is strange as Configuration class does have `set_attr' defined.

Suggest a fix

I'm assuming that Configuration class is supposed to use set__attr to catch undefined keyword argument, why didn't it work?

@spacether
Copy link
Contributor

spacether commented Nov 30, 2022

FYI this was fixed earlier in the future home pf the python generator: openapi-json-schema-tools/openapi-json-schema-generator@84557a9
and is available in the v1.0.3 release there

and a verification test was included here

@spacether
Copy link
Contributor

@bayeslearner fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants