amaster507
(Anthony Master)
February 1, 2021, 5:57pm
1
Report a GraphQL Bug
What edition and version of Dgraph are you using?
Edition:
SlashGraphQL
Dgraph (community edition/Dgraph Cloud)
Have you tried reproducing the issue with the latest release?
N/A
Steps to reproduce the issue (paste the query/schema if possible)
type Location {
id: ID
boundsBox: Polygon
}
mutation addLocation {
addLocation(
input: [{
boundsBox:{
coordinates:{
points:[
{longitude:-104.057879,latitude:42.479635},
{longitude:-104.057879,latitude:45.94545},
{longitude:-96.436589,latitude:42.479635},
{longitude:-96.436589,latitude:45.94545},
{longitude:-104.057879,latitude:42.479635} # close the polygon.
]
}
}
}]
) {
numUids
location {
id
}
}
}
Expected behaviour and actual result.
Expected: Coerce simple polygon coordinates into an array of coordinates
Actual Results: Internal Server Error - a panic was trapped. This indicates a bug in the GraphQL server. A stack trace was logged. Please let us know by filing an issue with the stack trace.
@pbassham , Thank you for working through this!
pbassham
(Philip)
February 1, 2021, 6:00pm
2
the problem in this particular example is that coordinates
wants an array
so it should be
{ coordinates: [{ points }] }
1 Like
JatinDevDG
(Jatin Dev )
February 3, 2021, 6:16am
4
Hi @amaster507 , above bug is fixed in below PR and merged in 20.11.1. But I guess we are still using 20.11 for slash.
dgraph-io:master
β dgraph-io:jatin/GRAPHQLInputArrayCoercion
opened 10:28AM - 14 Dec 20 UTC
Fixes GRAPHQL-745
Filter with id as a string was giving panic because we were e⦠xpecting it to be of `["0x1"] ` type.
```
query {
queryAuthor(filter:{id: "0x1"}) {
name
}
}
```
So, we added input coercion such that if we require an object of type list and the input object is scalar then we coerce it to list.
<!--
Your title must be in the following format: topic(Area): Feature
Topic must be one of build|ci|docs|feat|fix|perf|refactor|chore|test
Sample Titles:
feat(Enterprise): Backups can now get credentials from IAM
fix(Query): Skipping floats that cannot be Marshalled in JSON
perf: [Breaking] json encoding is now 35% faster if SIMD is present
chore: all chores/tests will be excluded from the CHANGELOG
Please add a description with these things:
1. A good description explaining the problem and what you changed.
2. If it fixes any GitHub issues, say "Fixes #GitHubIssue".
3. If it corresponds to a Jira issue, say "Fixes DGRAPH-###".
4. If this is a breaking change, please put "[Breaking]" in the title. In the description, please put a note with exactly who these changes are breaking for.
-->
---
This change isβ[<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/dgraph-io/dgraph/7133)