diff --git a/bundle/schema/schema_test.go b/bundle/schema/schema_test.go index 333d79a64..a00d3ee72 100644 --- a/bundle/schema/schema_test.go +++ b/bundle/schema/schema_test.go @@ -472,112 +472,6 @@ func TestObjectSchema(t *testing.T) { assert.Equal(t, expected, string(jsonSchema)) } -func TestSliceOfObjectsSchema(t *testing.T) { - type Person struct { - Name string `json:"name"` - Age int `json:"age,omitempty"` - } - - type Plot struct { - MainCharacters []Person `json:"main_characters"` - } - - type Story struct { - Plot Plot `json:"plot"` - } - - elem := Story{} - - schema, err := NewSchema(reflect.TypeOf(elem)) - assert.NoError(t, err) - - jsonSchema, err := json.MarshalIndent(schema, " ", " ") - assert.NoError(t, err) - - expected := - `{ - "type": "object", - "properties": { - "plot": { - "type": "object", - "properties": { - "main_characters": { - "type": "array", - "items": { - "type": "object", - "properties": { - "age": { - "type": "number" - }, - "name": { - "type": "string" - } - } - } - } - } - } - } - }` - - t.Log("[DEBUG] actual: ", string(jsonSchema)) - t.Log("[DEBUG] expected: ", expected) - assert.Equal(t, expected, string(jsonSchema)) -} - -func TestMapOfObjectsSchema(t *testing.T) { - type Person struct { - Name string `json:"name"` - Age int `json:"age,omitempty"` - } - - type Plot struct { - Events map[string]Person `json:"events"` - } - - type Story struct { - Plot Plot `json:"plot"` - } - - elem := Story{} - - schema, err := NewSchema(reflect.TypeOf(elem)) - assert.NoError(t, err) - - jsonSchema, err := json.MarshalIndent(schema, " ", " ") - assert.NoError(t, err) - - expected := - `{ - "type": "object", - "properties": { - "plot": { - "type": "object", - "properties": { - "events": { - "type": "object", - "additionalProperties": { - "type": "object", - "properties": { - "age": { - "type": "number" - }, - "name": { - "type": "string" - } - } - } - } - } - } - } - }` - - t.Log("[DEBUG] actual: ", string(jsonSchema)) - t.Log("[DEBUG] expected: ", expected) - assert.Equal(t, expected, string(jsonSchema)) -} - func TestEmbeddedStructSchema(t *testing.T) { type Person struct { Name string `json:"name"`