Lookahead's `selects?` returns false for a field that is visible in `#selections` on a Union type
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 42/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Ruby
- Star
- 5.4k
- Fork
- 1.4k
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 74
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của rmosolgo/graphql-ruby
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
rmosolgo/graphql-ruby#5843 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
rmosolgo/graphql-ruby#5763 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
rmosolgo/graphql-ruby#5761 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
rmosolgo/graphql-ruby#5707 · 10 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
rmosolgo/graphql-ruby#5655 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của rmosolgo/graphql-ruby
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
metanorma/metanorma-standoc#1315 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
metanorma/metanorma-iso#1681 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Missing zh-CN translation: components/common/CommunitySolution.tsx:communitySolution.authorsSolutionĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
openstreetmap/openstreetmap-website#7554 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
manyfold3d/manyfold#7445 ·
Maintainer thường phản hồi trong vòng 1 ngày