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

Cannot validate an array with 'constructor' as unique entry #1476

Closed
Piwaii opened this issue Apr 16, 2018 · 2 comments
Closed

Cannot validate an array with 'constructor' as unique entry #1476

Piwaii opened this issue Apr 16, 2018 · 2 comments
Assignees
Labels
bug Bug or defect
Milestone

Comments

@Piwaii
Copy link

Piwaii commented Apr 16, 2018

Context

  • node version: 8.9.4
  • joi version: 13.1.2
  • environment (node, browser): node
  • used with (hapi, standalone, ...):
  • any other relevant information:

What are you trying to achieve or the steps to reproduce ?

I want to validate arrays with at least one string item and the string is unique in the array.
So I use :

joi.validate(['item1', 'item2'], joi.array().items(joi.string()).min(1).unique()
    .required())

Which result you had ?

It works fine but I have an array to check that is : ['constructor'] and it throw me a "non unique" error

Error: "value" position 0 contains a duplicate value

What did you expect ?

To validate my array

@Marsup Marsup added the bug Bug or defect label Apr 16, 2018
@Marsup Marsup closed this as completed in 4dbc593 Apr 17, 2018
@Marsup Marsup added this to the 13.1.3 milestone Apr 17, 2018
@Marsup Marsup self-assigned this Apr 17, 2018
@Marsup
Copy link
Collaborator

Marsup commented Apr 17, 2018

Thanks for the report.

@Marsup Marsup modified the milestones: 13.1.3, 13.2.0 Apr 17, 2018
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug or defect
Projects
None yet
Development

No branches or pull requests

2 participants