We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cf83b97 commit 46d3cedCopy full SHA for 46d3ced
response.go
@@ -84,7 +84,25 @@ func Marshal(models interface{}) (Payloader, error) {
84
if err != nil {
85
return nil, err
86
}
87
- return marshalMany(m)
+
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
106
case reflect.Ptr:
107
// Check that the pointer was to a struct
108
if reflect.Indirect(vals).Kind() != reflect.Struct {
0 commit comments