graphql-type-json
graphql-type-json copied to clipboard
JSONObject can not parse objects with string keys
Considering that a JSON Object can have keys can have non alpha numerical characters like . or -, those should be wrapped in a string in javascript.
I would assume that passing JSONObject input where: { "dot.path.thing": { name: 123 }} should still pass as valid input JSONObject, but the parser throws this error:
Syntax Error GraphQL request (3:30) Expected Name, found String
I'm assuming it's some kind of limitation though... Must all JSONObject keys be Name ?
I don't think I actually have any control over this at all. I think it's just whatever the graphql-js AST parser does.
Has anyone found a solution to this? I am trying to store a JSON Schema in my database via a graphql mutation, but JSON Schema's inherently have keys that start with "$" like "$schema" and "$ref".