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

When keys have a duplicate value, their DTO get overwritten #43

Open
mdietger opened this issue Oct 20, 2021 · 1 comment
Open

When keys have a duplicate value, their DTO get overwritten #43

mdietger opened this issue Oct 20, 2021 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@mdietger
Copy link

I was fetching some posts with their corresponding insights data from the Facebook graph API into my Laravel app and wanted to generate their DTO's, but the result is missing some DTO's.

Here is the response for the facebook call

{
  "data": [
    {
      "insights": {
        "data": [
          {
            "name": "post_impressions",
            "period": "lifetime",
            "values": [
              {
                "value": 614
              }
            ],
            "title": "Lifetime Post Total Impressions",
            "description": "Lifetime: The number of times your Page's post entered a person's screen. Posts include statuses, photos, links, videos and more. (Total Count)"
          }
        ],
        "paging": {
          "previous": "xxxxxxxxxxxxxxx",
          "next": "yyyyyyyyyyyyyyy"
        }
      },
      "created_time": "2021-10-13T16:11:55 0000",
      "message": "Very important message"
    }
  ],
  "paging": {
    "cursors": {
      "before": "xxxxxxxxxxxxxxx",
      "after": "yyyyyyyyyyyyyyy"
    },
    "next": "zzzzzzzzzz"
  }
}

As you can see, there is paging for the data and paging for the insights, but the general response contains "data" aswell as the insights. When generating nested DTO's we only get 1 paging and 1 data DTO, while we expect 2.

Maybe we can keep track of the parent key and store children in their own folder/namespace?

@atymic
Copy link
Owner

atymic commented Oct 21, 2021

Feel free to PR :)

@atymic atymic added bug Something isn't working help wanted Extra attention is needed labels Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants