You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of being able to access methods from objects to retrieve GraphQL response data, we return an HTTPResponse object instead, which means devs would have to retrieve data via hashes...
Before:
client = ShopifyAPI::GraphQL.client
SHOP_NAME_QUERY = client.parse <<-'GRAPHQL'
{
shop {
name
}
}
GRAPHQL
result = client.query(SHOP_NAME_QUERY)
shop_name = result.data.shop.name
After:
client = ShopifyAPI::Clients::Graphql::Admin.new(session: session)
# make the GraphQL query string
query =<<~QUERY
{
shop {
name
}
}
QUERY
response = client.query(query: query)
shop_name = response.body["data"]["shop"]["name"]
As you can see, this make migration and usage of the response data very difficult.. shop_name = result.data.shop.name vs shop_name = response.body["data"]["shop"]["name"]
It's especially challenging if there are even more layers like
result.data.webhookSubscriptions.edges[0].node.id vs response.body["data"]["webhookSubscriptions"]["edges"][0]["node"]["id"]
Expected behavior
We should add support to allow method access for GraphQL data instead of hash access to avoid this undesirable v10 migration side effect for existing apps, and improve new developer's GraphQL experience when building new apps.
Example Complaint
Agreed, it's virtually impossible to upgrade to v10 or later since the library no longer supports graphql-client, with no options to support it. This renders all existing GraphQL code not compatible. I'm not sure how Shopify engineering team can get rid (forget even deprecating) an existing core library and think it's ok.
Overview
graphql-client gem dependency was removed in the shopify-api-ruby v10 upgrade.
Instead of being able to access methods from objects to retrieve GraphQL response data, we return an HTTPResponse object instead, which means devs would have to retrieve data via hashes...
Before:
After:
As you can see, this make migration and usage of the response data very difficult..
shop_name = result.data.shop.name
vsshop_name = response.body["data"]["shop"]["name"]
It's especially challenging if there are even more layers like
result.data.webhookSubscriptions.edges[0].node.id
vsresponse.body["data"]["webhookSubscriptions"]["edges"][0]["node"]["id"]
Expected behavior
We should add support to allow method access for GraphQL data instead of hash access to avoid this undesirable v10 migration side effect for existing apps, and improve new developer's GraphQL experience when building new apps.
Example Complaint
Link to Comment
The text was updated successfully, but these errors were encountered: