Project

Profile

Help

Issue #5093

closed

Autogenerated pulp rpm bindings raise an error on import

Added by apollo13 over 5 years ago. Updated over 4 years 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 - CURRENTRELEASEfao89

Actions
Actions #1

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

Actions #2

Updated by fachleitner over 5 years ago

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

Actions #3

Updated by dkliban@redhat.com over 5 years ago

  • Sprint changed from Sprint 55 to Sprint 56
Actions #4

Updated by ggainey over 5 years ago

  • Triaged changed from No to Yes
Actions #5

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/

Actions #6

Updated by rchan over 5 years ago

  • Sprint changed from Sprint 56 to Sprint 57
Actions #7

Updated by dkliban@redhat.com over 5 years ago

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

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/

Actions #9

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.

Actions #10

Updated by rchan about 5 years ago

  • Sprint changed from Sprint 57 to Sprint 58
Actions #11

Updated by dkliban@redhat.com about 5 years ago

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

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

Actions #13

Updated by rchan about 5 years ago

  • Status changed from ASSIGNED to NEW
Actions #14

Updated by rchan about 5 years ago

  • Sprint deleted (Sprint 58)
Actions #15

Updated by ttereshc about 5 years ago

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

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.

Actions #17

Updated by ttereshc almost 5 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Actions #18

Updated by bmbouter over 4 years ago

  • Tags deleted (Pulp 3 RPM blocker)

Also available in: Atom PDF