Lookahead's `selects?` returns false for a field that is visible in `#selections` on a Union type
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 42/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Ruby
- Stelle
- 5.4k
- Fork
- 1.4k
- Merge medio
- 1g 8h
- PR unite (30g)
- 74
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di rmosolgo/graphql-ruby
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
rmosolgo/graphql-ruby#5843 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
rmosolgo/graphql-ruby#5763 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
rmosolgo/graphql-ruby#5761 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
rmosolgo/graphql-ruby#5707 · 10 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 30/100
rmosolgo/graphql-ruby#5655 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di rmosolgo/graphql-ruby
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
heartcombo/simple_form#1874 ·
-
Category: OneSwap Status: Accepted
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
OpenNebula/one#8237 ·
-
Reconfigure Settings sidebarApertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
AllYourBot/hostedgpt#882 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
greenelab/lab-website-template#357 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
open-feature/ruby-sdk-contrib#283 ·
I maintainer di solito rispondono entro 1 giorno