MichalLytek / MichalLytek/typegraphql-prisma
Graphql schema generation fails when using @TypeGraphQL.omit() on Int field
@MichalLytek is already working on this.
Since Feb 8, 2022.
- Dominant language
- TypeScript
- Stars
- 918
- Forks
- 130
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the Bug**
If a prisma model contains only one single `Int` field which is omitted using `/// @TypeGraphQL.omit(output: true, input: true)`, the following error occurs when generating the graphql schema:
```
> @ start /Users/luca/Projects/libraries/typegraphql-prisma/examples/4-nest-js
> ts-node --transpile-only ./index.ts
[Nest] 66831 - 07.02.2022, 23:17:42 LOG [NestFactory] Starting Nest application...
[Nest] 66831 - 07.02.2022, 23:17:42 LOG [InstanceLoader] AppModule dependencies initialized +39ms
[Nest] 66831 - 07.02.2022, 23:17:42 ERROR [ExceptionHandler] Some errors occurred while generating GraphQL schema:
Input Object type PostAvgOrderByAggregateInput must define one or more fields.
, Input Object type PostSumOrderByAggregateInput must define one or more fields.
Please check the `details` property of the error to get more detailed info.
Error: Some errors occurred while generating GraphQL schema:
Input Object type PostAvgOrderByAggregateInput must define one or more fields.
, Input Object type PostSumOrderByAggregateInput must define one or more fields.
Please check the `details` property of the error to get more detailed info.
at Function.generateFromMetadata (/Users/luca/Projects/libraries/typegraphql-prisma/examples/4-nest-js/node_modules/type-graphql/dist/schema/schema-generator.js:20:23)
at async Object.buildSchema (/Users/luca/Projects/libraries/typegraphql-prisma/examples/4-nest-js/node_modules/type-graphql/dist/utils/buildSchema.js:10:20)
```
**To Reproduce**
I have created a pull request in my fork of this repository to reproduce the bug, see https://github.com/luca-rath/typegraphql-prisma/pull/1
**Expected Behavior**
There should be no error
**Environment (please complete the following information):**
- OS: macOS Monterey 12.2
- Node 14.19.0
- `typegraphql-prisma` version 0.18.4
- Prisma version 3.8.1
- TypeScript version 4.5.5
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.