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] Endpoint required enums of length one unset #5126

Closed
6 tasks
spacether opened this issue Jan 27, 2020 · 1 comment · Fixed by #5129
Closed
6 tasks

[BUG] [python] Endpoint required enums of length one unset #5126

spacether opened this issue Jan 27, 2020 · 1 comment · Fixed by #5129

Comments

@spacether
Copy link
Contributor

spacether commented Jan 27, 2020

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

For required enums of length one, the python-experimental generator should be setting the default value to what the spec defines.
We were previously doing this but a PR update accidentally wiped out this feature.

Endpoint parameter example
Spec https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml#L1066
Generated code https://github.com/OpenAPITools/openapi-generator/blob/master/samples/client/petstore/python-experimental/petstore_api/api/fake_api.py#L1016
I am not seeing a test of this, it looks like we are not correctly loading these default values into the function definition

openapi-generator version

master branch

OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs

https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml#L1066

Suggest a fix

Please update the template here:
https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/python/python-experimental/api.mustache#L48

A dev user can:

  • passing required params positionally OR
  • passing required params as **kwargs (this is a general python feature where positional args can be passed as keyword args)
@auto-labeler
Copy link

auto-labeler bot commented Jan 27, 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 changed the title [BUG] [python] Endpoint enums of length one unset [BUG] [python] Endpoint required enums of length one unset Jan 27, 2020
spacether added a commit that referenced this issue Jan 29, 2020
* Updates ap.mustache for python-experimental, adds test test_test_endpoint_enums_length_one

* Removes sortParamsByRequiredFlag from python-experimental

* Removes duplicate params from docstring
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
@spacether and others