Skip to content

Add utility for parsing bulk operations #729

@nickmealey

Description

@nickmealey

Since the output of bulk operations from GraphQL doesn't nest connections within each object, it can be tedious to correctly parse the file with the desired outcome. According to the docs, we can rely on the fact that children connections will always be listed after their parent, not directly after. A tip I picked up from @eapache, looping through the file in reverse order can make reading the data reliable with efficient memory loading.

Here's an example of how nested connections are added:

{"id":"gid:\/\/shopify\/Customer\/123456"}
{"id":"gid:\/\/shopify\/Metafield\/987654","key":"some_key","__parentId":"gid:\/\/shopify\/Customer\/123456"}

The ideal output:

{"id":"gid:\/\/shopify\/Customer\/123456","metafields":{"edges":[{"node":{"id":"gid:\/\/shopify\/Metafield\/987654","key":"some_key"}}]}}

My suggestion is that we build a helper utility to parse through the data in reverse order and nest any connections within a hash. This would make it easier for developers to quickly handle the data in an intuitive way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stalepre-v10Issue opened prior to release of v10 of library

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions