{"id":17932726,"url":"https://github.com/michallytek/typegraphql-reflection-poc","last_synced_at":"2025-07-14T01:16:22.400Z","repository":{"id":39160995,"uuid":"170388706","full_name":"MichalLytek/typegraphql-reflection-poc","owner":"MichalLytek","description":"Proof of concept of an enhanced reflection system for TypeScript","archived":false,"fork":false,"pushed_at":"2021-05-10T07:11:25.000Z","size":43,"stargazers_count":41,"open_issues_count":0,"forks_count":2,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-04T21:44:27.638Z","etag":null,"topics":["plugin","reflection","transform","typegraphql","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":false,"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/MichalLytek.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}},"created_at":"2019-02-12T20:46:02.000Z","updated_at":"2024-03-10T20:09:06.000Z","dependencies_parsed_at":"2022-09-19T23:21:02.904Z","dependency_job_id":null,"html_url":"https://github.com/MichalLytek/typegraphql-reflection-poc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MichalLytek/typegraphql-reflection-poc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MichalLytek%2Ftypegraphql-reflection-poc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MichalLytek%2Ftypegraphql-reflection-poc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MichalLytek%2Ftypegraphql-reflection-poc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MichalLytek%2Ftypegraphql-reflection-poc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MichalLytek","download_url":"https://codeload.github.com/MichalLytek/typegraphql-reflection-poc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MichalLytek%2Ftypegraphql-reflection-poc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265228987,"owners_count":23731092,"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":["plugin","reflection","transform","typegraphql","typescript"],"created_at":"2024-10-28T21:30:09.882Z","updated_at":"2025-07-14T01:16:22.061Z","avatar_url":"https://github.com/MichalLytek.png","language":"TypeScript","readme":"# TypeGraphQL reflection (PoC)\n\nProof of concept of an enhanced reflection system for TypeScript.\n\n## How it works?\n\nI uses a custom transform plugin and TS compiler API with a bit of help from [`ts-morph`](https://github.com/dsherret/ts-morph) to read deeply nested generic types info for GraphQL schema making purposes.\n\n## What does it do?\n\nIt can read type definitions of this class declaration:\n\n```ts\n@ObjectType\nexport class Sample {\n  @Field\n  dateField!: Date;\n\n  @Field\n  optionalStringField?: string;\n\n  @Field\n  optionalStringArrayField?: string[];\n\n  @Field\n  nullableStringArrayField!: Array\u003cstring | null\u003e;\n\n  @Field\n  nullableStringPromiseField!: Promise\u003cstring | null\u003e;\n\n  @Field\n  nullableStringNullableArrayPromiseField!: Promise\u003cArray\u003cstring | null\u003e | null\u003e;\n}\n```\n\nAnd emit that metadata, which then allows to read and transform them into this GraphQL type definition (SDL):\n\n```graphql\ntype Sample {\n  dateField: Date!\n  optionalStringField: String\n  optionalStringArrayField: [String!]\n  nullableStringArrayField: [String]!\n  nullableStringPromiseField: String\n  nullableStringNullableArrayPromiseField: [String]\n}\n```\n\n## How to run it?\n\nYou can run the example by `npm start` - it will run a `ts-node` with a special `ttypescript` compiler flag (`ts-node -C ttypescript src/example/index.ts`) that allows to apply the plugins defined in `tsconfig.json` during the TS files transpilation.\n\nThe transform plugin files are located in `src/transformer` directory. The example code (class source file and reading the metadata) are in `src/example` folder and the related supporting code is in `src/helpers` dir. In `src/sdl` you can find some simple helpers for creating GraphQL type SDL string for this demo purposes.\n\n## Further work\n\nThis proof of concept supports only basic subset of types - primitive types, array, nullability.\n\nThere is a lot of work to do next, both on the reflection plugin side and the TypeGraphQL core side.\n\nIf you like this idea of making TypeGraphQL easier to use without all the additional boilerplate, please consider supporting the project and our development efforts!\n\n[![](https://opencollective.com/typegraphql/donate/button.png?color=blue)](https://opencollective.com/typegraphql)\n","funding_links":["https://opencollective.com/typegraphql"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichallytek%2Ftypegraphql-reflection-poc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichallytek%2Ftypegraphql-reflection-poc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichallytek%2Ftypegraphql-reflection-poc/lists"}