{"id":16853172,"url":"https://github.com/devxoul/graphql-codegen-typescript-fixtures","last_synced_at":"2025-04-11T07:11:09.807Z","repository":{"id":57137454,"uuid":"408245486","full_name":"devxoul/graphql-codegen-typescript-fixtures","owner":"devxoul","description":"A plugin for graphql-code-generator that generates TypeScript fixtures for testing.","archived":false,"fork":false,"pushed_at":"2022-03-20T12:30:36.000Z","size":234,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-03T17:55:49.012Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devxoul.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":"2021-09-19T21:55:58.000Z","updated_at":"2024-06-27T09:34:45.000Z","dependencies_parsed_at":"2022-09-01T03:01:06.218Z","dependency_job_id":null,"html_url":"https://github.com/devxoul/graphql-codegen-typescript-fixtures","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devxoul%2Fgraphql-codegen-typescript-fixtures","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devxoul%2Fgraphql-codegen-typescript-fixtures/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devxoul%2Fgraphql-codegen-typescript-fixtures/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devxoul%2Fgraphql-codegen-typescript-fixtures/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devxoul","download_url":"https://codeload.github.com/devxoul/graphql-codegen-typescript-fixtures/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239576548,"owners_count":19662109,"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-10-13T13:50:00.371Z","updated_at":"2025-02-19T00:31:24.331Z","avatar_url":"https://github.com/devxoul.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# graphql-codegen-typescript-fixtures\n\n[![npm version](https://badge.fury.io/js/graphql-codegen-typescript-fixtures.svg)](https://badge.fury.io/js/graphql-codegen-typescript-fixtures)\n[![CI](https://github.com/devxoul/graphql-codegen-typescript-fixtures/workflows/CI/badge.svg)](https://github.com/devxoul/graphql-codegen-typescript-fixtures/actions/workflows/ci.yml)\n\nA plugin for [graphql-code-generator](https://www.graphql-code-generator.com/) that generates TypeScript fixtures for testing.\n\n## At a Glance\n\n```tsx\nimport fixture from './generated/graphql-fixtures.ts'\n\nconst user = fixture('User')\nuser.name // \"\"\nuser.followers.totalCount // 0\n\n// with Immer.js\nconst repo = fixture('Repository', repo =\u003e {\n  repo.name = 'my-cool-stuff'\n  repo.stargazerCount = 1234\n})\nrepo.name // \"my-cool-stuff\"\nrepo.stargazerCount // 1234\n```\n\n## Features\n\n* 🍭 Strongly typed.\n\n    \u003cimg width=\"500\" alt=\"type-hints\" src=\"https://user-images.githubusercontent.com/931655/133975704-fbd99da0-d6b3-4155-a1f1-5f18f327c0ca.png\"\u003e\n\n* 🧬 Built-in support for [Immer](https://github.com/immerjs/immer) integration.\n\n    \u003cimg width=\"500\" alt=\"immer\" src=\"https://user-images.githubusercontent.com/931655/133975969-941f5b54-308f-4e1e-a6c7-8b2166f0b8bc.png\"\u003e\n\n## Installation\n\n* Using Yarn:\n  ```console\n  $ yarn add graphql-codegen-typescript-fixtures --dev\n  ```\n* Using npm:\n  ```console\n  $ npm install graphql-codegen-typescript-fixtures --dev\n  ```\n\nAdd lines below in your graphql-codegen configuration file. Check out [Configuration](Configuration) section for more details.\n\n```diff\n  generates:\n    src/generated/graphql.ts:\n      plugins:\n        - \"typescript\"\n        - \"typescript-operations\"\n+   src/generated/graphql-fixtures.ts:\n+     plugins:\n+       - graphql-codegen-typescript-fixtures\n\n  config:\n    scalars:\n      Date: string\n      DateTime: string\n+   fixtures:\n+     typeDefinitionModule: \"path/to/graphql/types.ts\"\n```\n\n## Configuration\n\n### typeDefinitionModule\n\n*(Required)* A path for the GraphQL type definition module. This value is used to import the GraphQL type definitions.\n\nFor example:\n\n```yaml\nconfig:\n  fixtures:\n    typeDefinitionModule: \"@src/generated/graphql\"\n```\n\nAnd the generated code will be:\n\n```ts\n// src/generated/graphql-fixtures.ts\nimport * as types from '@src/generated/graphql'\n```\n\n### immer\n\n*(Optional)* Whether to generate [Immer](https://github.com/immerjs/immer) integration.\n\nFor example:\n\n```yaml\nconfig:\n  fixtures:\n    immer: true\n```\n\nThen the second parameter of `fixture()` will become available.\n\n```ts\nfixture('User', user =\u003e {\n  user.name = 'Suyeol Jeon'\n})\n```\n\n### scalarDefaults\n\n*(Optional)* The default values of scalar types. Note that the values are directly written to the TypeScript code so you need to wrap strings with quotes properly.\n\nFor example:\n\n```yaml\nconfig:\n  fixtures:\n    scalarDefaults:\n      Date: \"'2021-01-01'\"\n      DateTime: \"'2021-01-01T00:00:00+00:00'\"\n      Timestamp: 1609426800\n```\n\n## License\n\nThis project is under MIT license. See the [LICENSE](LICENSE) file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevxoul%2Fgraphql-codegen-typescript-fixtures","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevxoul%2Fgraphql-codegen-typescript-fixtures","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevxoul%2Fgraphql-codegen-typescript-fixtures/lists"}