enjoi
enjoi copied to clipboard
feature: allow unique keys on array schema
1 Uniques by key
Example: I have an array of objects and need uniques elements by "key1", "key2", "key3"
Schema should have {type:"array", uniques:[ "key1", "key2", "key3"]}
Valid schema
[
{key1: "200-300", key2: "wishlist_1", key3: "bid1.", indicator: true},
{key1: "200-300", key2: "wishlist_2", key3: "bid1.", indicator: false},
{key1: "200-300", key2: "wishlist_3", key3: "bid1.", indicator: true},
]
Invalid schema. Has duplicates values for keys ("key1", "key2", "key3")
[
{key1: "200-300", key2: "wishlist_1", key3: "bid1.", indicator: true},
{key1: "200-300", key2: "wishlist_1", key3: "bid1.", indicator: false},
{key1: "200-300", key2: "wishlist_3", key3: "bid1.", indicator: true},
]
2 Add label by description
3 Add greater and less using Joi reference
Is this valid JSON schema? Can you point to the spec? I couldn't find it.