paljs / prisma-tools

Prisma tools to help you generate CRUD system for GraphQL servers
https://paljs.com
MIT License
683 stars 54 forks source link

StringFieldUpdateOperationsInput should work without also "set" #147

Closed DregondRahl closed 3 years ago

DregondRahl commented 3 years ago

Update requires "set:" for each input

input UserUpdateInput {
  countPosts: IntFieldUpdateOperationsInput
  email: StringFieldUpdateOperationsInput
  id: StringFieldUpdateOperationsInput
  name: NullableStringFieldUpdateOperationsInput
  posts: PostUpdateManyWithoutAuthorInput
}

Create works without using "set:"

input UserCreateInput {
  countPosts: Int
  email: String!
  id: String
  name: String
  posts: PostCreateManyWithoutAuthorInput
}

Primsa generates below, which makes it optional.

export type UserUpdateInput = {
  id?: string | StringFieldUpdateOperationsInput
  email?: string | StringFieldUpdateOperationsInput
  name?: string | NullableStringFieldUpdateOperationsInput | null
  countPosts?: number | IntFieldUpdateOperationsInput
  posts?: PostUpdateManyWithoutAuthorInput
}

Can we generate it in a similar way?

Thanks,

AhmedElywa commented 3 years ago

We can't generate like Prisma. Because Prisma generate TypeScript code, they can add many types for one field but in GraphQL, we can just add one type

More info will be in this issue #136