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

question: how to validate array.length? #2552

Open
toknT opened this issue Nov 5, 2024 · 1 comment
Open

question: how to validate array.length? #2552

toknT opened this issue Nov 5, 2024 · 1 comment
Labels
type: question Questions about the usage of the library.

Comments

@toknT
Copy link

toknT commented Nov 5, 2024

I am using nestjs+gql it's the code

@InputType()
export class InsertSessionsInput {
  @Max(1000, { message: 'limit 1000 items' })
  @Field(() => [InMemoSession])
  sessions: InMemoSession[];
}

The problem:

it check the length of object.toString() not the length of array,

@toknT toknT added the type: question Questions about the usage of the library. label Nov 5, 2024
@aseyfpour
Copy link

Use these:

@IsArray()
@ArrayMinSize(1)
@ArrayMaxSize(1000)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Questions about the usage of the library.
Development

No branches or pull requests

2 participants