From 370ddcbdf114bc7af8f439b44d6d48a4e99d092e Mon Sep 17 00:00:00 2001 From: bukowa <38087302+bukowa@users.noreply.github.com> Date: Sun, 25 Apr 2021 23:41:23 +0200 Subject: [PATCH] add test failing to marshal json schema --- schema/schema_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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