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

Support options for scalar list fields #218

Open
nick-allen opened this issue Aug 5, 2024 · 0 comments
Open

Support options for scalar list fields #218

nick-allen opened this issue Aug 5, 2024 · 0 comments

Comments

@nick-allen
Copy link

nick-allen commented Aug 5, 2024

https://www.prisma.io/docs/orm/prisma-client/special-fields-and-types/working-with-scalar-lists-arrays#setting-the-value-of-a-scalar-list

Using a scalar list in postgres leads to generated type requiring a set field, should support direct setting as outlined in linked doc.

Example model with output types

model Task {
  ...
  categories  String[]
  ...
}
@InputType()
export class TaskCreateInput {

    ...

    @Field(() => TaskCreatecategoriesInput, {nullable:true})
    categories?: TaskCreatecategoriesInput;

    ...

}

@InputType()
export class TaskCreatecategoriesInput {

    @Field(() => [String], {nullable:false})
    set!: Array<string>;
}

This leads to requiring inputs always use the set: [...] form, and prevents being able to set the value directly, or use unset: true.

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

No branches or pull requests

1 participant