ajv-keywords icon indicating copy to clipboard operation
ajv-keywords copied to clipboard

uniqueItemsProperties - combined unique properties

Open atng opened this issue 2 years ago • 1 comments
trafficstars

PR in response to the feature request in issue 107.

This PR impliments the suggestion by @epoberezkin by changing the keyword implementation of uniqueItemsProperties.

It extends the uniqueItemsProperties to accepts arrays of strings in addition to strings as items in the array.

You can extend this keyword to accept arrays of strings in addition to strings as items in the array to pass to the keyword.

e.g.

With the schema:

{"uniqueItemProperties": [["email", "username"]]}
[{"email": "[email protected]", username: "one"}, {"email": "[email protected]", username: "two"}]

Would pass.

[{"email": "[email protected]", username: "one"}, {"email": "[email protected]", username: "two"}]

Would pass.

[{"email": "[email protected]", username: "one"}, {"email": "[email protected]", username: "one"}]

Would also pass.

[{"email": "[email protected]", username: "one"}, {"email": "[email protected]", username: "one"}]

But one one would fail since both the username and email matches..

atng avatar Apr 16 '23 18:04 atng

@epoberezkin

atng avatar Apr 16 '23 18:04 atng