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
The documentation at custom_apps.md indicates that you do not need to pass in a session argument when initializing a ShopifyAPI::Clients::Graphql::Admin client because it will use the active session (if it exists):
However, this example would raise an exception because the session argument is required:
# lib/shopify_api/clients/graphql/admin.rbmoduleShopifyAPImoduleClientsmoduleGraphqlclassAdmin < Clientsig{params(session: T.nilable(Auth::Session),api_version: T.nilable(String)).void}definitialize(session:,api_version: nil)# session argument does not have a default valuesuper(session: session,base_path: "/admin/api",api_version: api_version)endendendendend
Therefore if you want to use the active session, you have to pass in session: nil:
This seems counter-intuitive to me, as it makes it look like the code is deliberately saying it doesn't want to use a session. I think that what is shown in the documentation is how it should work, that you can omit the argument in order to use the active session. The REST Admin Client behaves this way, so I think it only makes sense that the Graphql Admin Client does too.
I can submit a PR to make this change if you'd like. Or if you disagree and want to keep the existing behavior, then I can submit a PR to fix the documentation.
The text was updated successfully, but these errors were encountered:
The documentation at custom_apps.md indicates that you do not need to pass in a session argument when initializing a
ShopifyAPI::Clients::Graphql::Admin
client because it will use the active session (if it exists):However, this example would raise an exception because the
session
argument is required:Therefore if you want to use the active session, you have to pass in
session: nil
:This seems counter-intuitive to me, as it makes it look like the code is deliberately saying it doesn't want to use a session. I think that what is shown in the documentation is how it should work, that you can omit the argument in order to use the active session. The REST Admin Client behaves this way, so I think it only makes sense that the Graphql Admin Client does too.
I can submit a PR to make this change if you'd like. Or if you disagree and want to keep the existing behavior, then I can submit a PR to fix the documentation.
The text was updated successfully, but these errors were encountered: