Lookahead's `selects?` returns false for a field that is visible in `#selections` on a Union type
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 42/100
調査の方向性
Start in Resolvers::SavedRepliesTreeResolver and reproduce the query with the Union type, comparing lookahead.selects?(:attachment) with lookahead.selections. Read the lookahead behavior for union selections and verify that attachment is recognized by selects? while the existing selections remain visible.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
Inside my resolver, whenever I call .selects?(:attachment), it returns false. Although the :attachment field is present whenever I do lookahead.selections.map(&:name) I find that the :attachment field is present
Versions
graphql: 1.13.15
rails: 6.0.3
GraphQL schema
# Types
class SavedReplyFolderType < ::Types::BaseObject
# fields that are not :attachment
end
class SavedReplyType < ::Types::BaseObject
# other fields
field :attachment, ::Types::AttachmentType, null: true
end
class SavedReplyLeafUnion < ::Types::BaseUnion
possible_types Types::SavedReplyType, Types::SavedReplyFolderType
def self.resolve_type(object, context)
if object.is_a?(::SavedReply)
Types::SavedReplyType
elsif object.is_a?(::SavedReplyFolder)
Types::SavedReplyFolderType
end
end
end
# Resolvers
# Resolver for [SavedReplyLeafUnion]
module Resolvers
class SavedRepliesTreeResolver < BaseResolver
extras [:lookahead]
def resolve(lookahead:)
# try accessing lookahead here
end
end
end
GraphQL query
query savedRepliesTree {
app {
savedRepliesTree {
__typename
... on SavedReply {
attachment {
id
}
}
... on SavedReplyFolder {
id
}
}
}
}
Steps to reproduce
use byebug inside the resolver
Try doing
(byebug) lookahead.selects?(:attachment)
false
to find that the attachment cannot be found on the lookahead
but whenever you do
(byebug) lookahead.selections.map(&:name)
[:__typename, :attachment, :id]
You'll find that the attachment field exists
Expected behavior
lookahead.selects?(:attachment) should return true
- 主要言語
- Ruby
- スター
- 5.4k
- フォーク
- 1.4k
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 74
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rmosolgo/graphql-ruby のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
rmosolgo/graphql-ruby#5843 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
rmosolgo/graphql-ruby#5763 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
rmosolgo/graphql-ruby#5761 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
rmosolgo/graphql-ruby#5707 · コメント 10 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 30/100
rmosolgo/graphql-ruby#5655 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
rmosolgo/graphql-ruby の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
greenelab/lab-website-template#357 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
shakacode/react_on_rails#5295 ·
メンテナーはふだん 1 日以内に返信
-
account: profile bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 5 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
elastic/elasticsearch-ruby#3078 ·