google / jsonapi

jsonapi.org style payload serializer and deserializer
http://godoc.org/github.com/google/jsonapi
MIT License
1.42k stars 211 forks source link

Fix pointers to alias types #187

Open erikdubbelboer opened 4 years ago

erikdubbelboer commented 4 years ago

This commit fixes pointers to type aliases which are currently not supported.

The new test cases will fail with:

jsonapi: Can't unmarshal foo (string) to struct field `String`, which is a pointer to
 `StringType (string)`

One other method to fix this when you are able to modify your types is:

type StringType = string

This is the new (since Go 1.9) way to declare type aliasses which treats the types differently when using reflect. See: https://github.com/golang/example/tree/master/gotypes#named-types