ardatan / ardatan/graphql-tools

Allow using merge directive without keyArg argument if resolver takes 0 arguments

Open
#4,336 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
5.4k
Forks
830
Avg merge
10h 59m
Merged PRs (30d)
45

Description

**Is your feature request related to a problem? Please describe.**

Currently `stitchingDirectivesValidator` doesn't allow to use `@merge` directive without `keyArg` argument if resolver takes 0 arguments.

**Describe the solution you'd like**

Allow using `@merge` directive without `keyArg` argument if resolver takes 0 arguments

**Additional context**

Allow such use-case will be helpful for situations when there is a global object with fields resolved by different subschemas. An example of such use-case could be some global Stats Object which has different stat fields that are resolved by different subschemas, so there is nothing to pass to the merge resolver

Contributor guide

Open the contributing guide

Research direction

Locate `stitchingDirectivesValidator` and trace how it validates `@merge` directives without `keyArg`. Check the zero-argument resolver case described in the issue, then verify that a merge directive without `keyArg` is accepted only when the resolver takes no arguments and that existing validation behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.