What is @graphql-tools/github-loader?
The @graphql-tools/github-loader npm package is designed to load GraphQL schemas directly from a GitHub repository. This is particularly useful for developers who want to integrate and manage their GraphQL schemas and documents within their version-controlled source code on GitHub.
What are @graphql-tools/github-loader's main functionalities?
Load GraphQL schemas from GitHub
This feature allows developers to load GraphQL schemas directly from a GitHub repository by specifying the repository path, branch, and schema file location. The function requires a GitHub personal access token for authentication.
import { loadSchema } from '@graphql-tools/github-loader';
async function getSchema() {
const schema = await loadSchema('github:user/repo#branch:path/to/schema.graphql', {
token: 'YOUR_GITHUB_PERSONAL_ACCESS_TOKEN'
});
return schema;
}
Other packages similar to @graphql-tools/github-loader
@graphql-tools/git-loader
Similar to @graphql-tools/github-loader, this package allows loading GraphQL schemas from a Git repository. It supports various Git services, not limited to GitHub, making it more versatile for projects hosted on other platforms like GitLab or Bitbucket.
@graphql-tools/url-loader
This package enables loading GraphQL schemas from any remote endpoint. While @graphql-tools/github-loader is specific to GitHub, @graphql-tools/url-loader can fetch schemas from any URL, providing flexibility for schemas hosted on different web services.