Skip to content
Snippets Groups Projects
Commit 3c8a91f1 authored by Dave Cameron's avatar Dave Cameron
Browse files

Netbox requires `parent` even if it is null

parent cbecfbf9
No related branches found
No related tags found
No related merge requests found
......@@ -132,12 +132,12 @@ func TestInventoryItemMarshalJSON(t *testing.T) {
{
desc: "Inventory item without manufacturer",
data: testInventoryItem(1),
want: []byte(`{"id":1,"device":10001,"name":"Inventory Item 1","part_id":"Part ID 1","serial":"Serial 1","discovered":true}`),
want: []byte(`{"id":1,"device":10001,"parent":null,"name":"Inventory Item 1","part_id":"Part ID 1","serial":"Serial 1","discovered":true}`),
},
{
desc: "Inventory item with manufacturer",
data: testInventoryItemWithManufacturer(2),
want: []byte(`{"device":10002,"name":"Inventory Item 2","manufacturer":20002,"part_id":"Part ID 2","serial":"Serial 2","discovered":true}`),
want: []byte(`{"device":10002,"parent":null,"name":"Inventory Item 2","manufacturer":20002,"part_id":"Part ID 2","serial":"Serial 2","discovered":true}`),
},
}
......
......@@ -47,7 +47,7 @@ type NestedDevice struct {
type InventoryItem struct {
ID int `json:"id,omitempty"`
Device NestedDevice `json:"device"`
Parent *int `json:"parent,omitempty"`
Parent *int `json:"parent"`
Name string `json:"name"`
Manufacturer *NestedManufacturer `json:"manufacturer,omitempty"`
PartID string `json:"part_id,omitempty"`
......@@ -61,7 +61,7 @@ type InventoryItem struct {
type writableInventoryItem struct {
ID int `json:"id,omitempty"`
Device int `json:"device"`
Parent *int `json:"parent,omitempty"`
Parent *int `json:"parent"`
Name string `json:"name"`
Manufacturer *int `json:"manufacturer,omitempty"`
PartID string `json:"part_id,omitempty"`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment