diff --git a/.gitignore b/.gitignore index fbb70e1..77bb4c1 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ samples/demo/demo ext/services .DS_Store +.idea diff --git a/swagger/swagger.go b/swagger/swagger.go index 6256d64..ac88f66 100644 --- a/swagger/swagger.go +++ b/swagger/swagger.go @@ -302,7 +302,12 @@ func CreateProperties(obj interface{}) map[string]*Property { fv = reflect.New(ft).Elem() } p.Default = fv.Interface() - ps[field.Name] = p + n := field.Tag.Get("json") + if n == "" { + ps[field.Name] = p + } else { + ps[n] = p + } } return ps