-
-
Notifications
You must be signed in to change notification settings - Fork 216
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
Conflicting module names for models silently generate invalid code #1163
Comments
Oh, interesting bug you've found! What's happening is that the module name selected for However, there's a workaround for now, before I get to the fix (since I'm swamped this month). Because the generated class names are different, you can target them separately using a config file and override the module name. So something like this should work: class_overrides:
VLAN: # Alternatively, select Vlan if you'd rather
module_name: custom_vlan # name this whatever you want That should cause the second |
The openapi-generator tool name the second module On how to catch it, I guess we could have a set of module names already used, and if the name is already in it we add a suffix. Or something like that. I'll try to look into it as soon as I have some time.
No worries, there is no urgency at the moment :) Thanks for the work on this project. |
I'm facing the same issue. I have two different Enums, from .sip_status import SIPStatus, SipStatus |
I made a dirty change in a PR which solves the issue on my side. It relies on a global variable which is a code smell, but I'm not familiar enough with the codebase yet to know where is the proper location for this information (the I'm still moving in my new house and assembling furniture, so I don't have a lot of free time, but still, that should be a good starting point towards a solution, and a temporary workaround for people encountering the same problem. Let's move the discussion on this PR, I'll be happy to receive feedback and guidance from you @dbanty so that we can move forward 🙂 |
Describe the bug
I am generating a Python Client using the OpenAPI model of Netbox 3.6.9 (with a few plugins pre-installed).
This schema contains for example a model
VLAN
and a modelVlan
.However, in the generated client, only the model
Vlan
is generated, but themodels/__init__.py
still tries to importVLAN
.OpenAPI Spec File
https://gist.github.com/linkdd/3193453b38357d190545c7988cdac692
Desktop:
Additional context
At
$day_job
, it was a blocking point, we had to remove temporarily the dependency to the generated client. I added a few tasks to my backlog in order to tackle this issue myself and ideally come up with a PR, but it won't be soon. Any help or information on how/where the model generation actually happens would be awesome and a huge time saver.The text was updated successfully, but these errors were encountered: