ajv-keywords
ajv-keywords copied to clipboard
uniqueItemsProperties - combined unique properties
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..
@epoberezkin