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

Linking resources of the same kind. #50

Open
2inqui opened this issue Jun 3, 2017 · 0 comments
Open

Linking resources of the same kind. #50

2inqui opened this issue Jun 3, 2017 · 0 comments

Comments

@2inqui
Copy link

2inqui commented Jun 3, 2017

Hello! Thanks for the library.

Today I ran into a problem using this library hopefully anyone can help me.

Lets say I have a resource

{
      "id": "29",
      "type": "ediary_entry_groups",
      "attributes": {
        ...
      },
      "relationships": {
        "child_entry_groups": {
          "data": [
            {
              "id": "30",
              "type": "ediary_entry_groups"
            },
            {
              "id": "31",
              "type": "ediary_entry_groups"
            },
            {
              "id": "32",
              "type": "ediary_entry_groups"
            },
            {
              "id": "33",
              "type": "ediary_entry_groups"
            }
          ]
        },
        "parent_entry_group": {
          "data": null
        }
      }

When trying to link the relationship for child_entry_groups the parser is using the includedResources to search for those relationships

+ (void)link:(NSObject <JSONAPIResource>*)resource withIncluded:(JSONAPI*)jsonAPI {
    
    NSDictionary *included = jsonAPI.includedResources;

But in my case all the values for the relationships are inside the data and I was thinking if we could include the data to search for possible values for relationships also. I hope I'm being clear enough please let me know if you need more information.

Here is a link of the response Im trying to parse.

EDIT: How does this library parse relationships for the same type of resource ( The resource in the relationship is inside data not included ) ?

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