Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Graphql Admin client should not require a session argument

オープン
#1,352 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
ruby
領域
api

調査の方向性

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):

Image

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分
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Shopify/shopify-api-ruby のほかの issue

Shopify/shopify-api-ruby の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。