Project

Profile

Help

Issue #5093

Autogenerated pulp rpm bindings raise an error on import

Added by apollo13 over 2 years ago. Updated over 1 year ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
API Bindings
Sprint:
Sprint 60
Quarter:

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

Related to Pulp - Task #5454: rename _type to pulp_typeCLOSED - CURRENTRELEASE

<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>

History

#1 Updated by dkliban@redhat.com over 2 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

#2 Updated by fachleitner over 2 years ago

A possible workaround would be to rename one of the members in UpdateRecord, either _type or type.

#3 Updated by dkliban@redhat.com over 2 years ago

  • Sprint changed from Sprint 55 to Sprint 56

#4 Updated by ggainey over 2 years ago

  • Triaged changed from No to Yes

#5 Updated by dkliban@redhat.com about 2 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/

#6 Updated by rchan about 2 years ago

  • Sprint changed from Sprint 56 to Sprint 57

#7 Updated by dkliban@redhat.com about 2 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to dkliban@redhat.com

#8 Updated by dkliban@redhat.com about 2 years ago

I opened a PR upstream with openapi-generator[0].

[0] https://github.com/OpenAPITools/openapi-generator/pull/3548/

#9 Updated by dkliban@redhat.com about 2 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.

#10 Updated by rchan about 2 years ago

  • Sprint changed from Sprint 57 to Sprint 58

#11 Updated by dkliban@redhat.com about 2 years ago

  • Related to Task #5454: rename _type to pulp_type added

#12 Updated by dkliban@redhat.com about 2 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.

#13 Updated by rchan about 2 years ago

  • Status changed from ASSIGNED to NEW

#14 Updated by rchan about 2 years ago

  • Sprint deleted (Sprint 58)

#15 Updated by ttereshc about 2 years ago

  • Assignee deleted (dkliban@redhat.com)
  • Tags Pulp 3 RPM blocker added

#16 Updated by dkliban@redhat.com about 2 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.

#17 Updated by ttereshc almost 2 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

#18 Updated by bmbouter over 1 year ago

  • Tags deleted (Pulp 3 RPM blocker)

Please register to edit this issue

Also available in: Atom PDF