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

Gql types permit nonsensical inline array filters #528

Closed
Tracked by #100
AndrewSisley opened this issue Jun 15, 2022 · 3 comments
Closed
Tracked by #100

Gql types permit nonsensical inline array filters #528

AndrewSisley opened this issue Jun 15, 2022 · 3 comments
Labels
area/query Related to the query component bug Something isn't working

Comments

@AndrewSisley
Copy link
Contributor

Gql types permit nonsensical inline array filters, for example the following test passes but should result in a gql type error:

func TestQueryInlineArrayWithBooleanFilter(t *testing.T) {
	test := testUtils.QueryTestCase{
		Description: "Simple query with basic float filter",
		Query: `query {
					users (filter: {LikedIndexes: {_eq: true}}){
						Name
					}
				}`,
		Docs: map[int][]string{
			0: {
				`{
					"Name": "John",
					"LikedIndexes": null
				}`,
			},
		},
		Results: []map[string]interface{}{},
	}

	executeTestCase(t, test)
}

We don't have to necessarily add support for inline array filters, but the above test should not pass.

@AndrewSisley AndrewSisley added bug Something isn't working area/query Related to the query component labels Jun 15, 2022
@fredcarle
Copy link
Collaborator

@AndrewSisley This is out of my lack of fully understanding the query language but why should this return a type error?

@AndrewSisley
Copy link
Contributor Author

AndrewSisley commented Jun 16, 2022

@AndrewSisley This is out of my lack of fully understanding the query language but why should this return a type error?

Sorry, test is hard to see here - LikedIndexes is an array of booleans, but the filter is a single boolean, is like doing [true, false, true, ...] == true in Go.

The generator code likely needs to be adjusted so that this is not possible.

@AndrewSisley
Copy link
Contributor Author

Fixed as part of #779

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/query Related to the query component bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants