-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Wrap auto-completed list input values with square brackets if required #587
Comments
+1 Currently Relay will cast a single value to a string; graphiql's deviation from this causes incompatibilities. |
If I understand what you are describing correctly, then this aspect is covered by the GraphQL spec:
In other words, it is ok to skip list syntax (e.g. |
@KyleAMathews Is Gatsby doing something custom on top of Relay or is this a bug with Relay? I don't know enough to tell (couldn't find the intermediary files produced by Relay in my |
@coreyward so, gatsby is not using relay, they have their own graphql schema implementation on top of graphql-js. what @OlegIlyenko's pointing out here is a valid bug in |
I couldn't find an example of this in the SWAPI API, so I went to GitHub's API where they have the Issuing this query: {
ai: marketplaceCategories(includeCategories: "ai-assisted") {
name
slug
}
aiOrChat: marketplaceCategories(includeCategories: ["ai-assisted", "chat"]) {
name
slug
}
} against the GitHub API correctly returns this result: {
"data": {
"ai": [
{
"name": "AI Assisted",
"slug": "ai-assisted"
}
],
"aiOrChat": [
{
"name": "AI Assisted",
"slug": "ai-assisted"
},
{
"name": "Chat",
"slug": "chat"
}
]
}
} As @OlegIlyenko correctly points out the "Input Coercion" section of TypeSystem > List in the GraphQL spec allows for a single list item to be specified without using the brackets. GraphiQL seems to support this just fine, so I don't think we have a bug here. That said, having the auto-complete automatically insert list wrappers around an option selected from a list type would be a welcome addition as sometimes people rely on auto-complete rather than the docs and do not realise that a list is possible in a particular position. |
i was able to reproduce the error the other day, its a bug |
Can you expand on what the error/bug is, please? |
given @OlegIlyenko 's point re: the spec, do we feel this is indeed a bug? @coreyward do you feel this behavior is to spec? or is there a way we can support the spec and multiple expectations here? |
@acao I want to contribute in open source in graphql. How can I start? |
this is a place where
our most important |
In Gatsby's connections, you can add a sort input like the following:
But in graphiql, it doesn't enforce that fields must be an array so people regularly complain sorting is broken as they just add a field in the UI and then when they try to copy that into a project it won't work.
Is there a reason graphiql is like this? It seems to be casting the single values to an array which is why it seems to work.
The text was updated successfully, but these errors were encountered: