File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -1096,6 +1096,41 @@ func TestMarshalUnmarshalCompositeStruct(t *testing.T) {
10961096 },
10971097 })
10981098 }
1099+
1100+ {
1101+ type Model struct {
1102+ Thing `jsonapi:"-"`
1103+ ModelID int `jsonapi:"primary,models"`
1104+ Foo string `jsonapi:"attr,foo"`
1105+ Bar string `jsonapi:"attr,bar"`
1106+ Bat string `jsonapi:"attr,bat"`
1107+ Buzz int `jsonapi:"attr,buzz"`
1108+ }
1109+
1110+ scenarios = append (scenarios , test {
1111+ name : "Model embeds Thing, but is annotated w/ ignore" ,
1112+ dst : & Model {},
1113+ payload : & OnePayload {
1114+ Data : & Node {
1115+ Type : "models" ,
1116+ ID : "1" ,
1117+ Attributes : map [string ]interface {}{
1118+ "bar" : "barry" ,
1119+ "bat" : "batty" ,
1120+ "buzz" : 99 ,
1121+ "foo" : "fooey" ,
1122+ },
1123+ },
1124+ },
1125+ expected : & Model {
1126+ ModelID : 1 ,
1127+ Foo : "fooey" ,
1128+ Bar : "barry" ,
1129+ Bat : "batty" ,
1130+ Buzz : 99 ,
1131+ },
1132+ })
1133+ }
10991134 for _ , scenario := range scenarios {
11001135 t .Logf ("running scenario: %s\n " , scenario .name )
11011136
You can’t perform that action at this time.
0 commit comments