netbox-community / go-netbox

The official Go API client for Netbox IPAM and DCIM service.
Other
195 stars 146 forks source link

API scheme change by netbox 2.7.x #55

Closed miticotoby closed 4 years ago

miticotoby commented 4 years ago

netbox community decided (https://github.com/netbox-community/netbox/issues/3569) to change the scheme of various API routes slightly. this now causes type errors.

json: cannot unmarshal string into Go struct field SiteStatus.results.status.value of type int64

// SiteStatus Status
// swagger:model SiteStatus
type SiteStatus struct {

        // label
        // Required: true
        Label *string `json:"label"`

        // value
        // Required: true
        Value *string `json:"value"`
}

example route: /api/dcim/sites/ | jq '.results[] | .id, .name, .status'

"AWS"
{
"value": "active", "label": "Active", "id": 1 }

kobayashi commented 4 years ago

@miticotoby Thank you for opening this issue. The current client version does not support v2.7 yet. I will do that soon.

kobayashi commented 4 years ago

Finally the latest master branch can handle this. Please check it. Thank you for being so patient.