Simpler GraphQL syntax?
See original GitHub issueThinking out loud…
What if we went from:
repository() {
ref(qualifiedName: "${branch}") {
target {
... on Commit {
history(first: 1, path: "${filePath}") {
nodes {
oid
commitDate
}
}
}
}
}
}
To:
repository()
ref(qualifiedName: "${branch}")
target
... on Commit
history(first: 1, path: "${filePath}")
nodes
oid commitDate
where every line break is a {
and every missing }
is appended.
Most of our queries are allowed with this syntax. Others can keep using the native syntax.
It would be its own helper like:
api.v4(ql`
repository()
ref(qualifiedName: "${branch}")
target
... on Commit
history(first: 1, path: "${filePath}")
nodes
oid commitDate
`)
and multiple queries can be concatenated as strings too:
api.v4(ql`
repository()
ref(qualifiedName: "${branch}")
target
... on Commit
history(first: 1, path: "${filePath}")
nodes
oid commitDate
` + ql`
query2: repository()
name
`)
Thoughts? Worth it? 😂
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Queries and Mutations - GraphQL
On this page, you'll learn in detail about how to query a GraphQL server. Fields#. At its simplest, GraphQL is about asking for...
Read more >4 Simple Ways to Call a GraphQL API
1. Using GraphQL IDEs (Apollo Explorer) · 2. Curl · 3. Fetch · 4. Using GraphQL clients (Apollo Client).
Read more >GraphQL - Query - Tutorialspoint
A GraphQL operation can either be a read or a write operation. A GraphQL query is used to read or fetch values while...
Read more >GraphQL Queries to fetch data - Hasura
Try out GraphQL Query using GraphiQL. Simple and nested GraphQL query examples with parameters, arguments and variables to fetch data dynamically.
Read more >GraphQL vs. REST: A GraphQL Tutorial - Toptal
GraphQL is a new way to fetch APIs, an alternative to REST that is more efficient, simpler, and faster to implement.
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
I find the original syntax more readable.
Big 👍