Issue #5093
closedAutogenerated pulp rpm bindings raise an error on import
Description
The generated bindings raise an error on import:
In [1]: from pulpcore.client.pulp_rpm.api_client import ApiClient
Traceback (most recent call last):
File "/home/florian/.local/pipx/venvs/ipython/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3296, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-1-a1b46871c401>", line 1, in <module>
from pulpcore.client.pulp_rpm.api_client import ApiClient
File "/home/florian/.local/share/virtualenvs/5ead1a20df1bd8b/lib/python3.7/site-packages/pulpcore/client/pulp_rpm/__init__.py", line 20, in <module>
from pulpcore.client.pulp_rpm.api.content_advisories_api import ContentAdvisoriesApi
File "/home/florian/.local/share/virtualenvs/5ead1a20df1bd8b/lib/python3.7/site-packages/pulpcore/client/pulp_rpm/api/__init__.py", line 6, in <module>
from pulpcore.client.pulp_rpm.api.content_advisories_api import ContentAdvisoriesApi
File "/home/florian/.local/share/virtualenvs/5ead1a20df1bd8b/lib/python3.7/site-packages/pulpcore/client/pulp_rpm/api/content_advisories_api.py", line 20, in <module>
from pulpcore.client.pulp_rpm.api_client import ApiClient
File "/home/florian/.local/share/virtualenvs/5ead1a20df1bd8b/lib/python3.7/site-packages/pulpcore/client/pulp_rpm/api_client.py", line 26, in <module>
import pulpcore.client.pulp_rpm.models
File "/home/florian/.local/share/virtualenvs/5ead1a20df1bd8b/lib/python3.7/site-packages/pulpcore/client/pulp_rpm/models/__init__.py", line 28, in <module>
from pulpcore.client.pulp_rpm.models.update_record import UpdateRecord
File "/home/florian/.local/share/virtualenvs/5ead1a20df1bd8b/lib/python3.7/site-packages/pulpcore/client/pulp_rpm/models/update_record.py", line 79
def __init__(self, href=None, created=None, type=None, id=None, updated_date=None, description=None, issued_date=None, fromstr=None, status=None, title=None, summary=None, version=None, type=None, severity=None, solution=None, release=None, rights=None, pushcount=None, pkglist=None, references=None): # noqa: E501
^
SyntaxError: duplicate argument 'type' in function definition
This is most likely due to _type and type getting mangled into the same name
Related issues
Updated by dkliban@redhat.com over 5 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to dkliban@redhat.com
- Sprint set to Sprint 55
The reporter's guess about the name mangling is correct. There is already an upstream issue open[0]. I will investigate how we can mitigate this problem until it is fixed in openapi-generator.
[0] https://github.com/OpenAPITools/openapi-generator/issues/3168
Updated by fachleitner over 5 years ago
A possible workaround would be to rename one of the members in UpdateRecord, either _type or type.
Updated by dkliban@redhat.com over 5 years ago
- Sprint changed from Sprint 55 to Sprint 56
Updated by dkliban@redhat.com over 5 years ago
- Status changed from ASSIGNED to NEW
- Assignee deleted (
dkliban@redhat.com)
I am putting this back in new because I am still working on another patch for openapi-generator[0]. This is going to require a patch to openapi-generator.
[0] https://github.com/OpenAPITools/openapi-generator/pull/3405/
Updated by dkliban@redhat.com over 5 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to dkliban@redhat.com
Updated by dkliban@redhat.com over 5 years ago
I opened a PR upstream with openapi-generator[0].
[0] https://github.com/OpenAPITools/openapi-generator/pull/3548/
Updated by dkliban@redhat.com over 5 years ago
The current proposal in the PR is to take any leading underscores and move them to the end. So type will become type in the client.
Updated by dkliban@redhat.com over 5 years ago
- Related to Task #5454: rename _type to pulp_type added
Updated by dkliban@redhat.com over 5 years ago
We decided to resolve this issue by renaming the '_type' field from pulpcore to 'resrouce_type'. I've added a relationship between the two issues.
Updated by ttereshc about 5 years ago
- Assignee deleted (
dkliban@redhat.com) - Tags Pulp 3 RPM blocker added
Updated by dkliban@redhat.com about 5 years ago
- Status changed from NEW to MODIFIED
- Assignee set to fao89
- Sprint set to Sprint 60
This issue has been fixed by renaming the field to pulp_type. The latest version of the pulp-rpm-client package on PyPI does not have this problem.
Updated by ttereshc about 5 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE