Closed FunTimeCoding closed 1 year ago
Could you provide a code example to replicate the error? Moreover, which version are you using?
Code:
func Example(configuration monitor.Configuration) {
transport := secureTransport.New(
configuration.NetBoxHost,
netBoxClient.DefaultBasePath,
[]string{"https"},
)
transport.DefaultAuthentication = secureTransport.APIKeyAuth(
"Authorization",
"header",
fmt.Sprintf("Token %v", configuration.NetBoxToken),
)
formats := strfmt.NewFormats()
client := netBoxClient.New(transport, formats)
siteParameters := dcim.NewDcimSitesListParams()
siteList, siteListFail := client.Dcim.DcimSitesList(
siteParameters,
nil,
)
monitor.FatalOnError(siteListFail)
log.Print(siteList)
}
go-netbox version: 3.4.5 netbox version: 3.1.11
I believe I figured out how to downgrade a dependency. Using version 3.2 shows the same error. 3.1 doesn't exist. But with 3.0 it works.
Now there is a release for Netbox 3.1: v3.1.11-0.
Could you try it? With this version you should have full compatibility.
I changed the version like this: go get github.com/netbox-community/v3/go-netbox@v3.1.11-0
But with my example request I ran into an error:
2023/03/03 14:31:17 json: cannot unmarshal object into Go struct field DeviceWithConfigContext.results.config_context of type string
Looking at it with DEBUG (I redacted this) - Its essentially a JSON object, not a string.
"config_context":{"installserver":{"saltgrains":{"somekey":"somevalue"},"network":{"domain":"example.org","gateway":"172.20.0.1","options":{"timeout":"1","attempts":"1"},"nameservers":["172.20.0.1","172.20.0.2"]},"partitioning":"plain:/dev/sda#swap:8192:swap#/:*:ext4","salt_master":["salt.example.org"]}}
@v0ctor Lets close this, as 3.0 works for me?
As the error is caused by the OpenAPI spec, 3.0 works for you and the OpenAPI 3.0 spec of Netbox is going to be released soon (which will probably fix these common errors), let's close the issue.
I'm trying to make basic use of this library. When loading sites or devices, I get this:
parsing time "2020-09-10" as "2006-01-02 15:04:05": cannot parse "" as "15"
With DEBUG, this field might be the cause:
"created":"2020-09-10"
I passed in a formatter without success. What am I missing?