-
Notifications
You must be signed in to change notification settings - Fork 90
ParseIDs middleware cannot find schema_node on subsequent input field #175
Copy link
Copy link
Open
Description
I believe that we have encountered a bug with the ParseIDs middleware and it may be related to #72
I have a definition that roughly mirrors this:
input_object(:post_comments_input) do
field(:posted_by_user_id, :id)
end
connection(:comments, node_type: :comment) do
field(:total_count, non_null(:integer), resolve: &count_resolver/3)
edge(do: nil)
end
node object(:comment) do
field(:body, non_null(:string))
end
node object(:post) do
connection field(:comments, node_type: :comments) do
# I like to put query args in an input object because I can deprecate the fields
arg(:input, :post_comments_input)
# This is the problem area when calling updatePost
middleware(Absinthe.Relay.Node.ParseIDs, input: [posted_by_user_id: :user])
resolve(&resolve_it/2)
end
end
payload field(:update_post) do
middleware(Absinthe.Relay.Node.ParseIDs, post_id: :post)
input do
field(:post_id, :id)
field(:body, :string)
end
output do
field(:post, non_null(:post))
end
reslovlve(&upate_it/2)
endWhen I call the node query with posts there are no problems:
query TestQuery($input:PostCommentsInput,$id:ID!) {
post: node(id:$id) {
... on Post {
comments(first:0,input:$input) {
totalCount
}
}
}
}
The problem I am seeing happens when I use the updatePost mutation and then resolve the Post.comments connection like so:
mutation TestMutation($input:UpdatePostInput!) {
updatePost(input:$input) {
post {
comments(first:0) {
totalCount
}
}
}
}
I get an error returned that states:
{
"data": {
"updatePost": {
"post": {
"comments": null
}
}
},
"errors": [
{
"message": "Could not find schema_node for input",
"path": [
"updatePost",
"post",
"comments"
]
}
]
}I have circumvented this problem by not using the ParseIDs middleware and manually parsing the IDs, but it is not a scalable solution. I am planning to write custom middleware for this scenario, but I'd rather not. It seems like something ParseIDs should support.
Let me know if I can help clarify this any further. I know it is not a typical use-case. Thank you!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels