Skip to content

Argument and variables nullability #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

DifferentialOrange
Copy link
Member

Reworked and improved version of #59

Compare library with JS reference implementation in various nullability cases. This PR uses JS script to build various schemas and queries and execute them to generate luatest script that verifies that this library has the same behavior.

To generate script, run

cd ./tests/integration/codegen/fuzzing_nullability
npm install
node ./generate.js > ../../fuzzing_nullability_test.lua

This PR fixed several nullability behavior issues. There is some case that isn't yet fully covered by our library, refer to #62 for updates.

Follow #63 for more test cases.

Based on @no1seman PR [1].

1. #59
Specification does not explicitly forbid using defaults with Non-null
variables. The discussion [1] states that it is legal. Reference JS
implementation supports defaults for Non-null variables.

1. graphql/graphql-spec#570
Specification [1] states that Nullable variable can be used for
NonNullable argument if it has Non-null default. See more in [2] issue.

1. http://spec.graphql.org/October2021/#sec-All-Variable-Usages-are-Allowed
2. graphql/graphql-js#3715
Code uses NonNull wrapper to support case when Nullable variable has a
Non-null default value and is compatible with NonNullable argument. But
if it really incompatible, the user should receive an error with
original type in message.
Compare library with JS reference implementation in various nullability
cases. This patch uses JS script to build various schemas and queries
and execute them to generate luatest script that verifies that this
library has the same behavior.

To generate script, run
```bash
cd ./tests/integration/codegen/fuzzing_nullability
npm install
node ./generate.js > ../../fuzzing_nullability_test.lua
```

Prior to this patch, several nullability behavior issues were fixed.
There is some case that isn't yet fully covered by our library, refer
to [1] for updates.

Follow [2] for more test cases.

Based on @no1seman PR [3].

1. #62
2. #63
3. #59
@DifferentialOrange DifferentialOrange merged commit ebe9be4 into master Aug 26, 2022
@DifferentialOrange DifferentialOrange deleted the DifferentialOrange/variables_nullability_v2 branch August 26, 2022 11:27
@DifferentialOrange
Copy link
Member Author

Comment about eaa9c3c : together with 033c1c9 and 033c1c9 it becomes useless, so actually we could remove it from the patchset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant