Skip to content

Primary key for nested models #211

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

Open
zaikinlv opened this issue Apr 1, 2025 · 4 comments
Open

Primary key for nested models #211

zaikinlv opened this issue Apr 1, 2025 · 4 comments

Comments

@zaikinlv
Copy link

zaikinlv commented Apr 1, 2025

Hello,
I think I am not the only one who finds issue mentioned in netbox-community/netbox#18451 pretty annoying and makes api client for creating resources in netbox rather unstable. Now when it is fixed staring from v4.2.5 probably it is time to upgrade?

See related issue here: #197

Thank you.

@zaikinlv
Copy link
Author

zaikinlv commented May 9, 2025

Hi!

I haven’t heard back since last time — is it okay if I submit a PR for this?

I’ve followed the “Development” section of the README, and things mostly work with a few adjustments. However, running make build (particularly the goimports step) results in a number of source code changes, mostly related to formatting and indentation, even for the current NetBox version (4.2.2).

Upgrading to 4.2.9 (the latest in the 4.2 branch) introduces even more changes and also requires updates to the tests/*.go files. I’m happy to fix the existing tests if needed.

What are your thoughts on this?

@nutgood
Copy link
Collaborator

nutgood commented May 9, 2025

Hey sorry I'm slammed with work. I just did PR #212, would that work for you ?

@nutgood
Copy link
Collaborator

nutgood commented May 9, 2025

Released in tag v4.3.0

@zaikinlv
Copy link
Author

No worries, and thanks for your reply.
Unfortunately, I’m stuck on an older version of NetBox, and version 4.3.0 of the client seems no to be compatible with my 4.1 box :(

I'm getting the following error when running:

res, status, err := c.VirtualizationAPI.VirtualizationVirtualMachinesList(ctx).Limit(1).Execute()

The error is:
no value given for required property _depth

I believe this is due to the introduction of the _depth field in the BriefDeviceRole struct:

type BriefDeviceRole struct {
    ...
    Depth int32 `json:"_depth"`
}

I guess it is here:
https://github.com/netbox-community/netbox/releases/tag/v4.3.0 (Hierarchical Device Roles #18245)

I tested the 4.3.0 client against a NetBox 4.3.0 instance, and it works fine.
Likewise, the 4.2.9 client seems to work correctly against my 4.1 deployment, at least as far as I can tell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants