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

Possible bug in inlineSelectionsFromInlineFragments.go #800

Closed
jiajun-brex opened this issue May 14, 2024 · 4 comments
Closed

Possible bug in inlineSelectionsFromInlineFragments.go #800

jiajun-brex opened this issue May 14, 2024 · 4 comments

Comments

@jiajun-brex
Copy link

hello, we are evaluating cosmo and one of our complex query which involves inline fragment and @include failed. I am able to pin point to a possible issue in inlineSelectionsFromInlineFragments.go

I tried a test case in inlineSelectionsFromInlineFragments.go

	t.Run("with nested compatible fragments with @include", func(t *testing.T) {
		run(t, inlineSelectionsFromInlineFragments, testDefinition, `
					{
						pet {
							... on Dog {
								... on Dog {
									owner {
										name
									}
								}
								... on Dog @include(if: $includeName){
									nickname
								}
							}
						}
					}`,
			`
					{
						pet {
							... on Dog {
								owner {
									name
								}
							}
							... on Dog @include(if: $includeName){
								nickname
							}
						}
					}`)
	})

However this failed with the following, you can notice the mismatched paranthesis, this causes more selection set issues in the normalization process after this operation


Error:      	Not equal: 
        	            	expected: "{pet {... on Dog {owner {name}} ... on Dog @include(if: $includeName){nickname}}}"
        	            	actual  : "{pet {... on Dog {owner {name} ... on Dog @include(if: $includeName){nickname}}}}"
@jensneuse
Copy link
Member

It seems like $includeName is not defined in your query.

@jiajun-brex
Copy link
Author

jiajun-brex commented May 14, 2024

It fails even I add them it seems

	t.Run("with nested compatible fragments with @include", func(t *testing.T) {
		run(t, inlineSelectionsFromInlineFragments, testDefinition, `
					query test($includeName: Boolean) {
						pet {
							... on Dog {
								... on Dog {
									owner {
										name
									}
								}
								... on Dog @include(if: $includeName){
									nickname
								}
							}
						}
					}`,
			`
					query test($includeName: Boolean) {
						pet {
							... on Dog {
								owner {
									name
								}
							}
							... on Dog @include(if: $includeName){
								nickname
							}
						}
					}`)
	})

with results

Expected :query test($includeName: Boolean){pet {... on Dog {owner {name}} ... on Dog @include(if: $includeName){nickname}}}
Actual   :query test($includeName: Boolean){pet {... on Dog {owner {name} ... on Dog @include(if: $includeName){nickname}}}}

@jensneuse
Copy link
Member

Can you try this again on the latest version and re-open the issue if it's not solved? Thanks

@jiajun-brex
Copy link
Author

jiajun-brex commented May 23, 2024

Thanks, this one is resolved and confirmed not an issue any more!
(Though I found another potential bug in testing, cut an issue #814)

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

No branches or pull requests

2 participants