Today, we’re introducing Schema Checks, a new feature of Grafbase that integrates schema checking into your CI/CD pipeline, ensuring your GraphQL schemas are error-free, efficient, and ready for deployment.
Schema Checks are a suite of validation, linting and operational checks designed to optimize your GraphQL schema development. This tool is essential in detecting potential issues early in the development cycle, significantly enhancing the reliability and quality of your GraphQL projects.
- Lint Checks: Automated linting ensures that your GraphQL schemas adhere to best practices and coding standards. The linter will check for the correct casing for fields, types, inputs, enums, other naming rules, and unused or inconsistent elements. Fixing these will result in cleaner, more maintainable code.
- Validation: Schema Checks rigorously validate your schemas to ensure they are correctly formatted and comply with GraphQL specifications.
- Breaking Change Detection: One of the most critical aspects of Schema Checks is its ability to detect breaking changes in new schema versions. This feature helps maintain backward compatibility and minimizes disruptions to existing applications.
- Improved Code Quality: Automatic linting and validation lead to higher code standards and fewer errors. This translates into more robust and reliable schemas, enhancing the application's overall performance and user experience.
- Early Error Detection: Identifying potential issues early in development saves time and resources. This proactive approach prevents the escalation of minor issues into major problems, ensuring a smoother development cycle.
- Seamless CI/CD Integration: Schema Checks fit naturally into your existing CI/CD pipelines, providing a streamlined development process. This helps maintain continuous integration and deployment with minimal disruptions, fostering a more efficient release cycle.
- Enhanced Team Collaboration: With clear guidelines and checks, teams can collaborate more effectively, reducing conflicts and misunderstandings.
- Checks History: In the Grafbase dashboard, you can see all past checks, which Git commit and branch they originated from, the schema that was checked and the errors it generated. It can help reconstitute your schema evolution when you need it.
In addition to the Dashboard and the Grafbase CLI, we packaged Schema Checks into a simple GitHub Action that you can easily plug into your GitHub workflows or use as a reference to integrate into another CI/CD system. It optionally integrates with Slack to notify you when a check fails.
With the Action, integrating Schema Checks in your CI pipeline can look like this:
- uses: grafbase/schema-check-action@v1
with:
grafbase-access-token: ${{ secrets.GRAFBASE_ACCESS_TOKEN }}
project-ref: tomhoule/grafbase-single-graph-ci-example@main
schema-path: ./sdl.graphql
To integrate Schema Checks into your workflow, visit our documentation for setup instructions and best practices. We believe Grafbase Schema Checks will be a game-changer in your GraphQL development process and are eager to hear your feedback.