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] Is it expected that generated python client code now depends on nulltype #8371

Closed
meadsteve opened this issue Jan 7, 2021 · 4 comments · Fixed by #8555
Closed

[BUG] Is it expected that generated python client code now depends on nulltype #8371

meadsteve opened this issue Jan 7, 2021 · 4 comments · Fixed by #8555
Labels
Client: Python Good First Issue An issue that could be fixed with a simple PR help wanted Issue: Bug

Comments

@meadsteve
Copy link
Contributor

Description

We've previously been running v5.0.0-beta2. Switching to the full release v5.0.0 results in the error ModuleNotFoundError: No module named 'nulltype'.

The fix was to add the nulltype package to my project's requirements but I'm not sure if this is expected and it doesn't seem ideal. Is this package really required or was it an accidentally inclusion?

openapi-generator version

v5.0.0

@spacether
Copy link
Contributor

spacether commented Jan 18, 2021

This is an accident
nulltype is still in the mustache template here: https://github.com/OpenAPITools/openapi-generator/blame/master/modules/openapi-generator/src/main/resources/python/model_templates/method_init_composed.mustache#L30

In my original composition pr here: https://github.com/OpenAPITools/openapi-generator/pull/5341/files#r379938730
nulltype.Null was used as the default value of required oneOf properties in a composed schema's init signature.
Since then, setting that nulltype.Null default value has been removed and those values are now passed in with kwargs.

So one can fix this by:

@spacether spacether added Good First Issue An issue that could be fixed with a simple PR help wanted labels Jan 18, 2021
@deeplook
Copy link

deeplook commented Jan 27, 2021

I wonder what the justification for using the nulltype package (for Python) really is? Looking at the code, it is more imported than used. And where it is used (in the petsore example) it's always with testing for nulltype.Null. Is that really worth doing and adding one more dependency which is not even available on conda-forge?

@spacether
Copy link
Contributor

spacether commented Jan 27, 2021

Hey there. The comment above describes why nulltype was added. As described in that comment it can now be removed.

@spacether
Copy link
Contributor

This has been resolved by the above PR. nulltype is no longer included in the python generator.

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 help wanted Issue: Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants