Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate _count as always nullable:true #130

Open
Johann01 opened this issue Aug 5, 2022 · 7 comments
Open

Generate _count as always nullable:true #130

Johann01 opened this issue Aug 5, 2022 · 7 comments
Labels
question Further information is requested

Comments

@Johann01
Copy link

Johann01 commented Aug 5, 2022

Is it possible to generate the _count property as always { nullable:true }? I couldn't find the generator option to do that.

@unlight
Copy link
Owner

unlight commented Aug 5, 2022

There is no such option.

For what kind of generated class it should be null (model, input)?
What is corresponding prisma expression which returns null instead of number?

@unlight
Copy link
Owner

unlight commented Aug 5, 2022

Ref: #84

@Johann01
Copy link
Author

Johann01 commented Aug 6, 2022

The problem with the _count property is, that it is automatically generated per default as nullable: false, but the default way of using prisma doesn't include the _count property meaning I always have to include it, which is counterintuitive to using prisma.

@unlight
Copy link
Owner

unlight commented Aug 6, 2022

I dont understand the problem. If you have graphql client error about count property, it means that you must provide it. Using prisma for getting count is not supposing to return null.

@unlight unlight added the question Further information is requested label Sep 1, 2022
@denes16
Copy link

denes16 commented Dec 28, 2022

How can i delete this field?, since this field its not in the type definition on the prisma client type as a part of the model.

@unlight
Copy link
Owner

unlight commented Dec 31, 2022

@denes16
Since v17.1.0 you can hide field in graphql schema using configuration:

  decorate_1_type = "ArticleCount" // outmatch pattern for graphql type
  decorate_1_field = "_count"
  decorate_1_name = "HideField"
  decorate_1_from = "@nestjs/graphql"
  decorate_1_arguments = "[]"

See https://github.com/unlight/prisma-nestjs-graphql#decorate

@unlight unlight mentioned this issue Dec 31, 2022
22 tasks
@0-don
Copy link

0-don commented Apr 2, 2023

how to delete this field from generation or how can I add isAbstract in every @ObjectType({ isAbstract: true })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants