TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Is it GraphQL best practice to limit root query types?

2 pointsby geekjockalmost 7 years ago
I was looking at the GitHub GraphQL API (https:&#x2F;&#x2F;developer.github.com&#x2F;v4&#x2F;query) and noticed that they only expose a few root query types.<p>For example, to get a pull request you must use the `repository` Query type and access a pull request through the `Repository` object fields.<p><pre><code> { repository(name: &#x27;test&#x27;) { pull_request(number: 2) { title } } } </code></pre> You can&#x27;t just access a pull request by ID via a root query type:<p><pre><code> { pull_request(id: 12345) { title } } </code></pre> Is this a recommended practice? Is there an argument for limiting root query types in favor of using nested object types to keep the schema cleaner?

no comments

no comments