diff --git a/bundle/schema/schema_test.go b/bundle/schema/schema_test.go index 576f02e4f..3eab7ca70 100644 --- a/bundle/schema/schema_test.go +++ b/bundle/schema/schema_test.go @@ -566,22 +566,3 @@ func TestDocIngestionForTopLevelPrimitive(t *testing.T) { assert.Equal(t, expectedSchema, string(jsonSchema)) } - -func TestErrorOnMapWithoutStringKey(t *testing.T) { - type Foo struct { - Bar map[int]string `json:"bar"` - } - elem := Foo{} - _, err := New(reflect.TypeOf(elem), nil) - assert.ErrorContains(t, err, "only strings map keys are valid. key type: int") -} - -func TestErrorIfStructRefersToItself(t *testing.T) { - type Foo struct { - MyFoo *Foo `json:"my_foo"` - } - - elem := Foo{} - _, err := New(reflect.TypeOf(elem), nil) - assert.ErrorContains(t, err, "cycle detected. traversal trace: root -> my_foo") -} diff --git a/libs/jsonschema/from_type_test.go b/libs/jsonschema/from_type_test.go index 493acc475..cdd26bf65 100644 --- a/libs/jsonschema/from_type_test.go +++ b/libs/jsonschema/from_type_test.go @@ -379,3 +379,9 @@ func TestFromTypeSelfReferential(t *testing.T) { // t.Log("[DEBUG] actual: ", string(jsonSchema)) // t.Log("[DEBUG] expected: ", string(expectedJson)) } + +func TestFromTypeError(t *testing.T) { + type mapOfInts map[int]int + _, err := FromType(reflect.TypeOf(mapOfInts{}), nil) + assert.EqualError(t, err, "found map with non-string key: int") +}