Cannot subscribe to more than one field
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start in executor.py at subscribe_fields and reproduce a subscription requesting multiple fields. Trace how each field result is converted into an Observable and how the merged result is returned. Done means every requested field appears in the subscription result, with errors still reported correctly.
Written by the indexing model from the issue text.
Description
Attempting to subscribe to more than one field will only return the first one in the list. There is some obvious offending code in executor.py:
`def subscribe_fields(exe_context, parent_type, source_value, fields):
exe_context = SubscriberExecutionContext(exe_context)
def on_error(error):
exe_context.report_error(error)
def map_result(data):
if exe_context.errors:
result = ExecutionResult(data=data, errors=exe_context.errors)
else:
result = ExecutionResult(data=data)
exe_context.reset()
return result
observables = []
# assert len(fields) == 1, "Can only subscribe one element at a time."
for response_name, field_asts in fields.items():
result = subscribe_field(exe_context, parent_type, source_value, field_asts, [response_name])
if result is Undefined:
continue
def catch_error(error):
exe_context.errors.append(error)
return Observable.just(None)
# Map observable results
observable = result.catch_exception(catch_error).map(
lambda data: map_result({response_name: data}))
return observable
observables.append(observable)
return Observable.merge(observables)
`
The line return observable causes a bunch of unreachable code and exits the loop early. However, commenting out that line does not appear to fix the problem - if it is removed, only the last item in the subscription list will return.
- Dominant language
- Python
- Stars
- 371
- Forks
- 175
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from graphql-python/graphql-core-legacy
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Quiver source Open
Difficulty 5/5 Over a week Newbie friendliness 20/100
graphql-python/graphql-core-legacy#286 · 3 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
graphql-python/graphql-core-legacy#280 · 2 comments · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
All issues in graphql-python/graphql-core-legacy
Similar issues
-
bug confirmed issue
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
open-webui/open-webui#30750 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
good first issue
Difficulty 1/5 Under an hour Newbie friendliness 90/100