Validate SDL directive argument values#4699
Conversation
|
@afurm is attempting to deploy a commit to the The GraphQL Foundation Team on Vercel. A member of the Team first needs to authorize it. |
|
|
Hi @afurm ! Thanks for submitting this PR. You wrote:
I would clarify that prior to this PR:
...your PR fills an existing gap, for both built in and custom directives meant for use on schema SDL, there is no SDL Validation Rule that forbids invalid arguments, because the typed schema is not yet available. It seems like you cleverly built a schema subset to get around this? Can you describe some more the method you use, and whether there are any dangerous of a potentially invalid schema subset being used by this rule, etc. Thanks! |
Summary
ValuesOfCorrectTypeRulefor SDL directive nodes through a directive-aware validation context.validateSDLandbuildSchemarejecting invalid directive argument values.Why
Fixes #3912.
SDL already rejects invalid values for built-in directives, but custom directive usages could accept invalid argument values such as
@foo(bar: FOOBAR)whenbaris declared asString!.Validation
npm run lintnpm run checknpm run testonlynpm run prettier:checkgit diff --checkFull
npm testwas attempted, but the Docker-backed supported-node integration could not run locally because the Docker daemon was unavailable.