diff --git a/schema/schema_test.go b/schema/schema_test.go index a426cd90..c2adcd3b 100644 --- a/schema/schema_test.go +++ b/schema/schema_test.go @@ -1,6 +1,7 @@ package schema_test import ( + "encoding/json" "strings" "sync" "testing" @@ -297,3 +298,20 @@ func TestEmbeddedStructForCustomizedNamingStrategy(t *testing.T) { }) } } + + +func TestSchemaParseMarshalJson(t *testing.T) { + type model struct { + gorm.Model + Title string + } + v := &model{Title: "test"} + schema, err := schema.Parse(v, &sync.Map{}, schema.NamingStrategy{}) + if err != nil { + t.Fatalf("error while parsing schema %v", err) + } + _, err = json.MarshalIndent(schema, "", "\t") + if err != nil { + t.Fatalf("error while json marshaling schema %v", err) + } +} \ No newline at end of file