{"id":16641812,"url":"https://github.com/samthor/graphql-query-codegen","last_synced_at":"2025-09-08T22:45:47.120Z","repository":{"id":58481374,"uuid":"530988437","full_name":"samthor/graphql-query-codegen","owner":"samthor","description":"Custom GraphQL queries → typesafe code","archived":false,"fork":false,"pushed_at":"2022-09-28T05:59:32.000Z","size":33,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-21T00:15:29.502Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samthor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-31T08:01:18.000Z","updated_at":"2022-08-31T08:03:15.000Z","dependencies_parsed_at":"2023-01-18T23:31:05.102Z","dependency_job_id":null,"html_url":"https://github.com/samthor/graphql-query-codegen","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/samthor/graphql-query-codegen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fgraphql-query-codegen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fgraphql-query-codegen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fgraphql-query-codegen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fgraphql-query-codegen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samthor","download_url":"https://codeload.github.com/samthor/graphql-query-codegen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fgraphql-query-codegen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274231239,"owners_count":25245659,"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","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-10-12T07:47:57.426Z","updated_at":"2025-09-08T22:45:47.100Z","avatar_url":"https://github.com/samthor.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nGraphQL query code generator for TypeScript types.\nThis generates code specific to provided queries.\n\n## Example\n\nYou might have a model like this:\n\n```graphql\n# model.graphql\ntype Query {\n  getFoo(a: Int) {\n    b\n    c\n  }\n}\n```\n\nBut want to write a query with a limited selection:\n\n```graphql\n# query.graphql\nquery GetFoo {\n  getFoo(a: 123) {\n    b\n  }\n}\n```\n\nThis library will generate limited types for you.\nIt can be run either as a binary or as a library.\nFor use as a binary, run:\n\n```bash\n$ graphql-query-codegen -q query.graphql model.graphql\n```\n\nYou can also specify `--loose` to be less restrictive on checks, and `-s ScalarName:tsTypeName` to specify a scalar resolution.\n(e.g., `-s AWSDateTime:string` tells this code to render `AWSDateTime` as a `string`).\n\n## Library\n\nYou can also import this library.\nIt exports a `Builder` class which is typed.\n\n## Notes\n\nThis treats the field `__typename` specially, and asssume it looks like `String!` but with a constant value of name of the type being requested (\u0026hellip;unless that type specifically overrides it).\n(This is part of the spec, but is a bit weird.)\n\n## Known Issues\n\n### Input Validation\n\nThis library doesn't check that the input types of variables match the expected values in field arguments.\nFor example, this is still allowed:\n\n```graphql\ntype Query {\n  getFoo(a: Int!) {\n    b\n    c\n  }\n}\n\n# This probably shouldn't pass: String is not Int.\n# ...(although GraphQL treats both as \"scalars\" anyway)\nquery GetFoo($a: String!) {\n  getFoo(a: $a) {\n    b\n  }\n}\n```\n\n### Fragments, Unions \u0026 Interfaces\n\nThis package has limited support for fragments, unions and interfaces.\n\nIt does not support top-level fragment definitions, but this should work fine:\n\n```graphql\n# query.graphql\n\nquery GetWhatever {\n  getInterface {\n    __typename\n    ... on OneOption {\n      hasFieldA\n    }\n    ... on AnotherOption {\n      hasFieldB\n    }\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamthor%2Fgraphql-query-codegen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamthor%2Fgraphql-query-codegen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamthor%2Fgraphql-query-codegen/lists"}