File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,25 @@ func Marshal(models interface{}) (Payloader, error) {
84
84
if err != nil {
85
85
return nil , err
86
86
}
87
- return marshalMany (m )
87
+
88
+ payload , err := marshalMany (m )
89
+ if err != nil {
90
+ return nil , err
91
+ }
92
+
93
+ if linkableModels , isLinkable := models .(Linkable ); isLinkable {
94
+ jl := linkableModels .JSONAPILinks ()
95
+ if er := jl .validate (); er != nil {
96
+ return nil , er
97
+ }
98
+ payload .Links = linkableModels .JSONAPILinks ()
99
+ }
100
+
101
+ if metableModels , ok := models .(Metable ); ok {
102
+ payload .Meta = metableModels .JSONAPIMeta ()
103
+ }
104
+
105
+ return payload , nil
88
106
case reflect .Ptr :
89
107
// Check that the pointer was to a struct
90
108
if reflect .Indirect (vals ).Kind () != reflect .Struct {
You can’t perform that action at this time.
0 commit comments