Skip to content
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

broken astvalidation if type requires [NotNull!] and [NotNull!] or [NotNull!]! was provided #1096

Closed
mocksoul opened this issue Feb 26, 2025 · 1 comment · Fixed by #1099 or #1101
Closed

Comments

@mocksoul
Copy link

mocksoul commented Feb 26, 2025

@devsergiy hi! in PR #1082 you broken the opposite

this test now fails:

runWithDefinition(t, `
       scalar String

       schema {
       	query: Query
       }

       type Query {
       	nested(input: NestedInput): String
       }

       input NestedInput {
       	optionalListOfOptionalStrings: [String!]
       }
       `, `
       query Q($a: [String!]) {
       	nested(input: {
       		optionalListOfOptionalStrings: $a
       	})
       }
       `, Values(), Valid)
})

([String!] arg and [String!] type)

Also more restrictive [String!]! in args will fail too.

reason: external: Variable "$a" of type "String" used in position expecting type "[String!]"., locations: [{Line:2 Column:15} {Line:4 Column:40}], path: []
operation:
query Q($a: [String!]){nested(input: {optionalListOfOptionalStrings: $a})}

Before this PR everything was fine (albeit wo test)

Originally posted by @mocksoul in #1082 (comment)

all variants after PR #1082

after with PR

(actual in arg => in type definition)

OK [string!]! => [string]
!! FAIL [string!]! => [string]!
!! FAIL [string!]! => [string!]
OK [string!]! => [string!]!

OK [string!] => [string!]!
FAIL [string!] => [string]! (kinda expected)
!! FAIL [string!] => [string!]
FAIL [string!] => [string!]! (kinda expected)

OK [string]! => [string]
OK [string]! => [string]!
FAIL [string]! => [string!] (kinda expected)
FAIL [string]! => [string!]! (kinda expected)

OK [string] => [string]
FAIL [string] => [string]! (kinda expected)
FAIL [string] => [string!] (kinda expected)
FAIL [string] => [string!]! (kinda expected)

@mocksoul mocksoul changed the title broken astvalidation if type requires [NotNull!] and [NotNull!] or [NotNull!]! provided broken astvalidation if type requires [NotNull!] and [NotNull!] or [NotNull!]! was provided Feb 26, 2025
devsergiy added a commit that referenced this issue Feb 28, 2025
…f an input object (#1099)

fix validation if lists with the variable value nested in the input
object; merge valid arguments rule with the values validation rule

closes #1096
@mocksoul
Copy link
Author

@devsergiy thanks!

devsergiy pushed a commit that referenced this issue Mar 3, 2025
🤖 I have created a release *beep* *boop*
---


##
[2.0.0-rc.161](v2.0.0-rc.160...v2.0.0-rc.161)
(2025-02-28)


### Bug Fixes

* fix validation of variables used in nested fields of type list of an
input object
([#1099](#1099))
([d74dc37](d74dc37)),
closes
[#1096](#1096)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant