Graphql Admin client should not require a session argument
还没有人认领这个 Issue。
评估
调研方向
从 lib/shopify_api/clients/graphql/admin.rb 开始,将其 initializer 与 REST Admin Client 的行为进行比较。检查 docs/usage/custom_apps.md 中记录的构造方式,然后让实现和文档在 session 参数是否可选这一点上保持一致;完成标准是文档中的初始化不再引发参数错误。
由索引模型根据 Issue 内容生成。
描述
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.rb
module ShopifyAPI
module Clients
module Graphql
class Admin < Client
sig { params(session: T.nilable(Auth::Session), api_version: T.nilable(String)).void }
def initialize(session:, api_version: nil) # session argument does not have a default value
super(session: session, base_path: "/admin/api", api_version: api_version)
end
end
end
end
end
Therefore if you want to use the active session, you have to pass in session: nil:
graphql_client = ShopifyAPI::Clients::Graphql::Admin.new(session: nil, api_version: "2024-07")
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.
- 主要语言
- Ruby
- 星标
- 1.1k
- 派生
- 484
- 平均合并
- 4 小时 38 分钟
- 30 天内合并 PR
- 1
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Shopify/shopify-api-ruby 的其他 Issue
-
devtools-gardener
难度 2/5 1-3 小时 新手友好度 68/100
Shopify/shopify-api-ruby#1456 · 3 个 reaction ·
-
devtools-gardener
难度 3/5 1-2 天 新手友好度 67/100
Shopify/shopify-api-ruby#1461 · 1 条评论 ·
-
automated
难度 4/5 3-5 天 新手友好度 48/100
Shopify/shopify-api-ruby#1460 ·
-
devtools-gardener
难度 5/5 一周以上 新手友好度 35/100
Shopify/shopify-api-ruby#1455 ·
-
devtools-gardener
难度 4/5 3-5 天 新手友好度 48/100
Shopify/shopify-api-ruby#1453 · 1 条评论 ·
查看 Shopify/shopify-api-ruby 的全部 Issue
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
jetrockets/jet_ui#47 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
FreeCAD/homebrew-freecad#870 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
-
Messages with a markdown image that has a relative or malformed URL throw TypeError: Invalid URL未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复