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

fix(GraphQL): handle filters for enum properly (#6887) #6916

Merged
merged 1 commit into from
Nov 19, 2020

Conversation

minhaj-shakeel
Copy link
Contributor

@minhaj-shakeel minhaj-shakeel commented Nov 19, 2020

This PR is a breaking change for the eq filter on the List of enum Types.

This PR fixes bugs in the filter generated for enum types. For the given schema:-

enum Status {
   ACTIVE
   DEACTIVATED
}

type VerificationFilter {
    status: [Status]! @search
}

the hash filter generated for status was:

input Status_hash {
   eq: [Status]!
   in: [Status]
}

whereas, it should be:

input Status_hash {
    eq: Status
    in: [Status]
}

This PR also fixes incorrect filter generated for exact index in List of enum types.
Earlier it was being generated like:

input Status_exact {
	eq: [Status]
	in: [Status]
	le: [Status]
	lt: [Status]
	ge: [Status]
	gt: [Status]
	between: Status
}

but it should be like:

input Status_exact {
	eq: Status
	in: [Status]
	le: Status
	lt: Status
	ge: Status
	gt: Status
	between: Status
}

Breaking change lies in the generation of eq filters. Earlier it was eq: [Status]! but now it is eq: Status. Both are syntactically fine but eq: [Status]! conflicts with the expected usage of eq filter.

(cherry picked from commit 40b20c7)


This change is Reviewable

This PR is a breaking change for the `eq` filter on the List of `enum` Types.

This PR fixes bugs in the filter generated for enum types. For the given schema:-
```
enum Status {
   ACTIVE
   DEACTIVATED
}

type VerificationFilter {
    status: [Status]! @search
}
```

the `hash` filter generated for `status` was:
```
input Status_hash {
   eq: [Status]!
   in: [Status]
}
```
whereas, it should be:
```
input Status_hash {
    eq: Status
    in: [Status]
}
```

This PR also fixes incorrect filter generated for `exact` index in List of enum types.
Earlier it was being generated like:
```
input Status_exact {
	eq: [Status]
	in: [Status]
	le: [Status]
	lt: [Status]
	ge: [Status]
	gt: [Status]
	between: Status
}
```
but it should be like:
```
input Status_exact {
	eq: Status
	in: [Status]
	le: Status
	lt: Status
	ge: Status
	gt: Status
	between: Status
}
```

Breaking change lies in the generation of `eq` filters. Earlier it was `eq: [Status]!` but now it is `eq: Status`. Both are syntactically fine but `eq: [Status]!` conflicts with the expected usage of `eq` filter.

(cherry picked from commit 40b20c7)
@github-actions github-actions bot added the area/graphql Issues related to GraphQL support on Dgraph. label Nov 19, 2020
@minhaj-shakeel minhaj-shakeel merged commit 2c2ceb4 into release/v20.11 Nov 19, 2020
@minhaj-shakeel minhaj-shakeel deleted the minhaj/cherry-pick-5 branch November 19, 2020 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/graphql Issues related to GraphQL support on Dgraph.
Development

Successfully merging this pull request may close these issues.

2 participants