Input is empty when using generated InputType
See original GitHub issueIts a bit confusing to me but when using the generated input types im not able to get args from my graphql mutations. When using my own dto as described in the nestjs docs everything works as expected.
My resolver:
@Mutation(() => Business, { nullable: true })
async createBusiness(
@UserEntity() user: User,
@Args('business') business: BusinessCreateInput,
) {
console.log(business); // output: BusinessCreateInput {}
return this.businessesService.create(business, user);
}
My graphql mutation
mutation CreateBusiness{
createBusiness(business: { name: "Test business" })
}
Any ideas why this happens when using the generated types?
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
why input value is an empty string in this form? - Stack Overflow
I've created the form with the Id that i use for the variables and then after the submit i want to see the...
Read more ><input type="time"> - HTML: HyperText Markup Language | MDN
<input> elements of type time create input fields designed to let the user easily enter a time (hours and minutes, and optionally seconds)....
Read more >Empty Input Type for many to many relationship join tables #19
After excecute npx prisma generate we have some Input Types that's are empty, so, when i tried to run the nest app i...
Read more >Checking if an input is empty with CSS - Zell Liew
You add a placeholder to your input · If the placeholder is hidden, it means the user typed something into the field ·...
Read more >How to check if an input is empty with CSS - freeCodeCamp
You add a placeholder to your input · If the input is hidden, it means the user typed something into the field ·...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
What is your prisma schema, what version of nestjs and library are you using?
I think problem in
whitelist = true
. But it does not make sense to use whitelist = true with graphql, graphql is typed. I think you have some options here:@UsePipes
) or parameters where its needed (@Param
,@Body
)@Allow
decorator to all fields (from class-validator, see https://github.com/typestack/class-validator#whitelisting) to all generated graphql classes, seedecorate
config option - https://github.com/unlight/prisma-nestjs-graphql#decorate