Skip to content

uselessly and wrong - empty relation objects included #138

@gilfanovrrPaker

Description

@gilfanovrrPaker
type userJSONAPI struct {
	ID string `jsonapi:"primary,user"`
	Cards []*card `jsonapi:"relation,cards"`
}
type projectJSONAPI struct {
	ID string `jsonapi:"primary,project"`
}
type card struct {
	ID          string `jsonapi:"primary,card"`
	Title       string `jsonapi:"attr,title"`
	Description string `jsonapi:"attr,description"`
	URL         string `jsonapi:"attr,url"`
	Project     *projectJSONAPI `jsonapi:"relation,project"`
}
{  
   "data":{  
      "type":"user",
      "id":"DaevDM",
      "relationships":{  
         "cards":{  
            "data":[  
               {  
                  "type":"card",
                  "id":"5oxQSz6BKdy4bGhC6"
               },
               {  
                  "type":"card",
                  "id":"Dw27dBAzKZfaQYEqk"
               }
            ]
         }
      }
   },
   "included":[  
      {  
         "type":"card",
         "id":"Dw27dBAzKZfaQYEqk",
         "attributes":{ 
             "description":"",
            "title":"111",
            "url":"/b/33e72d7f-72ea-4b55-a9b5-df7e6659b2cb/14.2/Dw27dBAzKZfaQYEqk" },
         "relationships":{  
            "project":{  
               "data":{  
                  "type":"project",
                  "id":"14.2"
               }
            }
         }
      },
      {  
         "type":"card",
         "id":"5oxQSz6BKdy4bGhC6",
         "attributes":{  
            "description":"",
            "title":"222",
            "url":"/b/6c22c755-c517-4a72-ba94-c85713a5487b/14.3/5oxQSz6BKdy4bGhC6"
         },
         "relationships":{  
            "project":{  
               "data":{  
                  "type":"project",
                  "id":"14.3"
               }
            }
         }
      },      
      {  
         "type":"project",
         "id":"14.3"
      },
      {  
         "type":"project",
         "id":"14.2"
      }
   ]
}

Included contains empty objects ("project" has no attributes).
The emberjs considers the object fully filled (but it is just empty) and will not fill by next data request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions