diff --git a/bundle/schema/schema_test.go b/bundle/schema/schema_test.go index 3c98532e5..5acc0b77e 100644 --- a/bundle/schema/schema_test.go +++ b/bundle/schema/schema_test.go @@ -508,16 +508,17 @@ func TestSliceOfStructSchema(t *testing.T) { } func TestEmbeddedStructSchema(t *testing.T) { - type Person struct { - Name string `json:"name"` - Age int `json:"age,omitempty"` - } - type Location struct { Country string `json:"country"` State string `json:"state,omitempty"` } + type Person struct { + Name string `json:"name"` + Age int `json:"age,omitempty"` + Home Location `json:"home"` + } + type Plot struct { Events map[string]Person `json:"events"` } @@ -546,6 +547,18 @@ func TestEmbeddedStructSchema(t *testing.T) { "country": { "type": "string" }, + "home": { + "type": "object", + "properties": { + "country": { + "type": "string" + }, + "state": { + "type": "string" + } + }, + "additionalProperties": false + }, "name": { "type": "string" }, @@ -560,18 +573,33 @@ func TestEmbeddedStructSchema(t *testing.T) { "age": { "type": "number" }, + "home": { + "type": "object", + "properties": { + "country": { + "type": "string" + }, + "state": { + "type": "string" + } + }, + "additionalProperties": false + }, "name": { "type": "string" } - } + }, + "additionalProperties": false } } - } + }, + "additionalProperties": false }, "state": { "type": "string" } - } + }, + "additionalProperties": false }` t.Log("[DEBUG] actual: ", string(jsonSchema))