Dgraph 1.1.0
Yes
Running on docker for Mac
Send this mutation:
{
"set": [
{
"uid": "0x1",
"friends_with": [
{
"uid": "0x3",
"friends_with|good": false,
}
]
}
]
}
There's a mistake since there's an extra , after false.
I expect to see a parsing error on line 8, where the extra comma is found. Maybe on line 9?
Instead, I get this error:
Error Name: t
Message: while lexing {
"set": [
{
"uid": "0x1",
"friends_with": [
{
"uid": "0x3",
"friends_with|good": false,
}
]
}
]
} at line 2 column 2: Unrecognized character inside mutation: U+0022 '"'
URL: http://localhost:8080/mutate?commitNow=true
So it looks like when the mutate endpoint will try to parse the input as JSON. If that fails, it will try to do the mutation in the rdf format. So that's what the error message means. I am not sure how to fix it when Dgraph is making a guess about the format. If the mutation is invalid, how could it tell it's an invalid JSON or and invalid RDF?
Maybe it's enough to include the format it's using for parsing in the error message
Maybe we can determine the format based on left curly bracket in the front. And then return parsing error accordingly.
Is this then a Ratel bug since it tries to figure out the mutation format?
When sent via curl with the right Content-Type header, I get this error:
{"errors":[{"message":"invalid character '}' looking for beginning of object key string","extensions":{"code":"ErrorInvalidRequest"}}]}
I guess it's better, but still not really helpful.
It would depend on what we are using to parse the JSON. I don't think we are using the same parser as the RDF so we cannot add line numbers. But I'll look into it to see if we can improve it somehow.
Any update on this issue, @martinmr ?
sorry, I haven't had a chance to look at it, yet. I'll get to it once I am done with the type system PRs I have open.