Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uselessly and wrong - empty relation objects included #138

Open
gilfanovrrPaker opened this issue Apr 28, 2018 · 0 comments · May be fixed by #223
Open

uselessly and wrong - empty relation objects included #138

gilfanovrrPaker opened this issue Apr 28, 2018 · 0 comments · May be fixed by #223

Comments

@gilfanovrrPaker
Copy link

gilfanovrrPaker commented Apr 28, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant