Skip to content

Linking resources of the same kind. #50

Description

@2inqui

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 ) ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions