Wrap auto-completed list input values with square brackets if required
See original GitHub issueIn Gatsby’s connections, you can add a sort input like the following:
allMarkdownRemark(sort: { fields: [frontmatter___title], order: DESC}) {
edges {
node {
id
}
}
}
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.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:10 (7 by maintainers)
Top Results From Across the Web
why are square brackets used in javascript function calls? jquery
It's a requirement from jQuery 's trigger function that the second parameter be an array (prior to 1.6.2), thus the wrapping to make...
Read more >Outlook advanced editing options - Microsoft Support
Learn how to use the advanced editing options in Outlook.
Read more >Frequently Asked Questions - Snakemake - Read the Docs
A named tuple that contains a list of values for each wildcard is returned. Here, this named tuple has only one item, that...
Read more >Language Configuration Guide - Visual Studio Code
Autosurrounding. When you select a range in VS Code and enter an opening bracket, VS Code surrounds the selected content with a pair...
Read more >Editable Combobox With List Autocomplete Example - W3C
This example illustrates the autocomplete behavior known as list ... but it does not prevent input of any other arbitrary value.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
[...]
) if list has only one element.+1 Currently Relay will cast a single value to a string; graphiql’s deviation from this causes incompatibilities.