{"id":22869946,"url":"https://github.com/iwillig/graphql-checker","last_synced_at":"2025-03-31T11:25:27.110Z","repository":{"id":220820460,"uuid":"752678972","full_name":"iwillig/graphql-checker","owner":"iwillig","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-08T16:01:36.000Z","size":63,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T13:06:13.818Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iwillig.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-04T14:06:32.000Z","updated_at":"2024-02-04T14:07:58.000Z","dependencies_parsed_at":"2024-03-04T16:04:14.179Z","dependency_job_id":null,"html_url":"https://github.com/iwillig/graphql-checker","commit_stats":null,"previous_names":["iwillig/graphql-checker"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwillig%2Fgraphql-checker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwillig%2Fgraphql-checker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwillig%2Fgraphql-checker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwillig%2Fgraphql-checker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iwillig","download_url":"https://codeload.github.com/iwillig/graphql-checker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246460007,"owners_count":20781029,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-13T13:12:54.254Z","updated_at":"2025-03-31T11:25:27.088Z","avatar_url":"https://github.com/iwillig.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# graphql-checker (gqlc)\n\n\u003e **_NOTE:_** This tool is still under development. Some of the code\n\u003e or documentation is a work in progress. PR's welcome\n\nA tool for validating and linting GraphQL Schema and operations.\n\n## Overview\n\nGraphQL Checker is a tool chain for maintaining large and complex\nGraphQL projects.\n\nGraphQL checker parses your schema file and builds a knowledge base\n(Datalog) derived from your schema file.\n\n\n[A longer description of the project, optionally with sub-sections like\n'Features', 'History', 'Motivation', etc.]\n\n## Motivation\n\nAt work we have adopted a workflow where both our backend and frontend\nteam worked directly with the GraphQL Schema. All our documentation\nand types for our API are defined in a single GraphQL Schema\nfile. Both the backend and the frontend read that file and it’s a\nsingle source of truth for the entire engineering organization.\n\nUsing this GraphQL Schema this has introduced a collection of\ntradeoffs at our organization. On one hand, everyone understands and\ncan works directly in the GraphQL Type System. We write our backend\ntests also in the GraphQL query language. Sharing this has been very\nhelpful as we can give the frontend team working GraphQL queries that\nwe know are tested.\n\nBut there have been negative tradeoffs. Our GraphQL Schema file is\nhuge. If you include detailed documentation inline in the GraphQL\nSchema, you lose sight of the GraphQL types themselves.\n\nDuring our process of building a new GraphQL API, our team adopted the\nRelay pattern for designing our GraphQL\nSchema. [Relay](https://relay.dev/docs/guides/graphql-server-specification/)\nhas a couple of useful patterns for Lists of things (Connections),\nglobal unique ids (global ids) and the node API. We want the ability\nto enforce or lint our GraphQL schema to make sure all lists are\n“connection” edges, and every object should implement the Node\ninterface.\n\nThis tool is an attempt to build a GraphQL Tool chain that parses a\nGraphQL schema file and GraphQL operation files (queries and\nmutations). This parsed information is then loaded into a DataScript\nDatabase. DataScript is a Clojure implementation of a datalog\ndatabase. It is based on datomic, authored by Rich Hickey and team.\n\nThis tool chain also uses the language-tools open source library. This\ngives us the ability to check for spelling and grammar mistakes in\nyour GraphqQL files in several languages. Spelling and grammatical\nerrors are added to this database, along with the original source\ncharacter positions.\n\nThen users can run [datalog\nqueries](https://github.com/tonsky/datascript/blob/master/docs/queries.md)\nto ask questions about this GraphQL API. For example, are there any\nspelling mistakes in my GraphQL Schema file? Are all lists associated\nwith a connection object? Is there an object that does not implement\nthe “Node” interface.\n\nIn other words, by using the datalog engine in datascript, we can\nexplore our GraphQL schema system and track changes to it.\n\n## TODO Usage: Init DB\n\n```shell\ngqlc --init-db GraphQL_Schema.graphql\n```\n\nThis creates a new database file called `GraphQL_Schema_gqlc-db.edn`\n\n## TODO Usage: Update-db\n\n```shell\n## Will compare to GraphQL_Schema_ggql-db.edn\ngqlc --update-db GraphQL_Schema.graphql\n```\n\n## TODO Usage: Query\n\nExample query that uses the [language-tool](https://dev.languagetool.org/java-api.html) library to find all of the\nspelling mistakes in a type description. Return the spelling mistake\nand its position.\n\n```shell\ngqlc --db GraphQL_Schema_gqlc-db.edn --query-file query-graphql-schema.datalog\n```\nWhere `query-graphql-schema.datalog` is\n\n```clojure\n[:find  ?spelling-error ?error-position\n :keys  spelling-error error-position\n :where [?description :gql-type-description/value _]             ;; Find all of the type descriptions in your graphql schema\n        [?description :gql-type-description/errors ?error]       ;; Find all of the errors associated with a description\n        [?error       :gql-error/type :error.type/spelling]      ;; Filter all of the error to the spelling\n        [?error       :gql-error/position ?error-position]       ;; Find the original character position of the spelling error\n]\n```\n\n```clojure\n[{:spelling-error \"\" :error-position {}] {:spelling-error \"\" :error-position {}}]\n```\n\n## TODO Usage: Configuration\n\n```clojure\n{:gqlc/db-file \"GraphQL_Schema_gqlc-db.edn\"\n :gqlc/gql-schema-file \"GraphQL_Schema.graphql\"}\n```\n\n## Development\n\nThis tool is written in Clojure. If you use emacs, your normal\n`cider-jack-in` should work.\n\nFor an editor independent experience, you can start the rebel repl\nwith\n\n```shell\n$ make rebel\nclojure -M:rebel\n[Rebel readline] Type :repl/help for online help info\nuser=\u003e (dev)\n:reloading (graphql-checker.main graphql-checker.main-test dev user)\n:ok\ndev=\u003e(k/run 'graphql-checker.main-test) ;; Run main test\n```\n\n## TODO Parse-Schema\n\n```shell\ngqlc --parse-schema --help\ngqlc --parse-schema --help\ngqlc --parse-schema --file graphql-schema.graphql\n\ngqlc --print-schema --graphql-schema graphql-schema.graphql\n```\n\n## TODO Install\n\n```shell\nmake install\n```\n\n## DONE Test\n\n```shell\nmake check\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiwillig%2Fgraphql-checker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiwillig%2Fgraphql-checker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiwillig%2Fgraphql-checker/lists"}