Skip to content

Record included twice in response when using included records. #375

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

Open
shidel-dev opened this issue Jan 10, 2019 · 2 comments
Open

Record included twice in response when using included records. #375

shidel-dev opened this issue Jan 10, 2019 · 2 comments

Comments

@shidel-dev
Copy link

shidel-dev commented Jan 10, 2019

This is an interesting case, and I am not 100% sure if this is a bug, but the way fast_jsonapi handles it is different than how AMS handles it. Also ember-data 2.13 seems to have issues with the way fast_jsonapi handles it as well.

Given a relationship like

class Parent
  has_many :children
end

class Child
  belongs_to :parent
end

When a child is created and the include param is like parent.children the created child is both in the top level data field (as expected), and it is also in the included records.

With AMS it seems that the record in data is not repeated in the included records.

I could not find mention of this in the json api spec.

@shidel-dev
Copy link
Author

A fictional example of what this would look like when rendered to json. Notice that the "child" is in both the data, and included.

{
  "data": {
     "type": "child",
     "id": "1",
     "attributes": {},
     "relationships": {
        "parent": {"id": "2", "type": "parent"}
      }
   },
  "included": [
     {
       "type": "child",
       "id": "1",
       "attributes": {},
       "relationships": {
          "parent": {"id": "2", "type": "parent"}
        }
     },
    {
       "type": "parent",
       "id": "2",
       "attributes": {},
       "relationships":{
          "children": [{"id": "1", "type": "child"}]
        }
    }
  ]
}

@shidel-dev
Copy link
Author

shidel-dev commented Mar 13, 2019

Are issues being actively dealt with? I have seen a decrease in responsiveness, and commits for this project. I have an open pull request for this issue, and I have received no feedback on it. It would be helpful for the community to know the maintainability of this project going forward.

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

No branches or pull requests

1 participant