-
Notifications
You must be signed in to change notification settings - Fork 80
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
Avoid using BTreeMap in Value::Object
and use Vec<(String, Value::Object)
instead?
#59
Comments
Value::Object
?Value::Object
and use Vec<(String, Value::Object)
instead?
This sounds like specifying key twice is useless, just we don't check for that speficically, right? Can we just add a check to the parser and keep |
Yeah, but according to the spec, this is not a concern for the GraphQL parser - the parser needs to just parse both. If a user executes the following query:
With the current behavior, based on I know this might be a breaking change to the API of the existing @tailhook I can open a PR if that helps :) |
I'm not sure yet. I wonder what others think on this. |
Hi @tailhook , any update on that? thanks! |
Is this something where the server wants the |
I think even from the point of view of a client, it's not a good practice to override keys? It might lead to unexpected behavior. Also, this crate is not "taking a side" (client/server), so I believe it's better to just stick to the GraphQL spec/reference implementation when it comes to parsing and handling of those? |
@tailhook how should we proceed with this issue? |
GraphQL-JS (the reference implementation) implements the values as an array of key->value.
This is done in order to allow parsing things like:
And be able to have in the result
[ {key: "f", value: true}, {key: "f", value: false }]
. Today it's just{ f: false}
ingraphql-parser
.Where a field can be specified multiple times. In terms of parsing, it should be better to use the array.
The spec/graphql-js also implements a validation rule (
UniqueInputFieldNamesRule
) to strictly enforce the existence of only one field.Currently, this creates an ambiguity issue, since the consumer of the parsed
Value
is getting the "latest" value specific.The text was updated successfully, but these errors were encountered: