netbox-community / go-netbox

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

Netbox requires `parent` even if it is null #18

Closed davcamer closed 7 years ago

davcamer commented 7 years ago

Once I had the tokens in place, I did a full test of inventory items and ran in to this bug.

I was tripped up for ten or fifteen minutes while forgetting that InventoryItem actually uses writableInventoryItem under the hood. Don't know of another way to handle it though.

mdlayher commented 7 years ago

Interesting. @jeremystretch , can you weigh in on if this is a NetBox bug?

Seems strange that you have to specify a field as null versus just omitting it. I'd expect the two to have the same behavior.

jeremystretch commented 7 years ago

My guess is it has something to do with uniqueness validation:

unique_together = ['device', 'parent', 'name']

I agree it should just default to null but DRF can be finicky about that sort of thing.

mdlayher commented 7 years ago

Interesting. Okay, merging as is since this LGTM.