Closed thunderstorm99 closed 6 months ago
I just found out, the same is true for Interface.results.connected_endpoints https://github.com/netbox-community/go-netbox/blob/3237c9d5509bfd63491ad2635b6bd6f0ed5313bb/netbox/models/interface.go#L58
@thunderstorm99
Just ran into the same thing and it seems like an issue with the netbox api spec more so than the go client, given that the spec has the following for link_peers and connected_endpoints:
"link_peers": {
"description": "\nReturn the appropriate serializer for the link termination model.\n",
"type": "array",
"items": {
"type": "string",
"x-nullable": true
},
"readOnly": true
},
"connected_endpoints": {
"description": "\nReturn the appropriate serializer for the type of connected object.\n",
"type": "array",
"items": {
"type": "string",
"x-nullable": true
},
"readOnly": true
},
Probably can only really be fixed in the main netbox project if they are prepared to document the object types rather than what they have done.
@cardboardpig can you link to the file from the netbox repo that contains said lines?
A new alpha version has been released with a different software to generate the library, so hopefully this bug has been resolved.
Please feel free to test it and to provide feedback.
I've tested the latest version and although the error changed, the problem remains. Opened a new issue https://github.com/netbox-community/go-netbox/issues/170
We're using go-netbox (
github.com/netbox-community/go-netbox/v3 v3.4.5
) in our go program. We are trying to list Interfaces using the function Dcim.DcimInterfacesList.Our code to do this is:
The error is the following:
I looked at the API by querying our Netbox instance at
api/dcim/interfaces/?device_id=2345
which returns the following (truncated to only show link_peers)Looking at the code for go-netbox it looks like the expected return value is of type []*string https://github.com/netbox-community/go-netbox/blob/3237c9d5509bfd63491ad2635b6bd6f0ed5313bb/netbox/models/interface.go#L127
This does not seem to coincide with the actual json response coming from netbox (tested both on netbox 3.3.10, as well as 3.4.5). The source code for netbox also doesn't seem to use a []*string at that location https://github.com/netbox-community/netbox/blob/85f40bcbe073ab8025a1d8afe7ffed08c002d7b8/netbox/dcim/models/device_components.py#L169-L174