Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(GraphQL): don't generate orderable enum value for list fields (#6392
) Fixes GRAPHQL-650. For this user schema: ``` type Starship { id: ID! name: String! @search(by: [term]) length: Int64 tags: [String] createdAt: DateTime } ``` we were generating complete GraphQL schema with StarshipOrderable as: ``` enum StarshipOrderable { name length tags createdAt } ``` that would cause a DQL query to be formed which errors out, see this GraphQL query: ``` query { queryStarship(order: {asc: tags}) { id name length tags } } ``` It gives back: ``` { "errors": [ { "message": "Dgraph query failed because Dgraph execution failed because : Sorting not supported on attr: Starship.tags of type: [scalar]" } ], "data": { "queryStarship": [] } } ``` which means we should not allow even list of scalar along with object types in orderable. Only scalar field should be allowed in orderable. So, the correct orderable should be without tags field: ``` enum StarshipOrderable { name length createdAt } ``` This PR fixes the above bug. (cherry picked from commit dc66617)
- Loading branch information