Skip to content

feature: allow unique keys on array schema#93

Open
ederEnriquez wants to merge 3 commits intotlivings:masterfrom
ederEnriquez:feature/unique-keys
Open

feature: allow unique keys on array schema#93
ederEnriquez wants to merge 3 commits intotlivings:masterfrom
ederEnriquez:feature/unique-keys

Conversation

@ederEnriquez
Copy link

@ederEnriquez ederEnriquez commented Jul 2, 2020

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

@tlivings
Copy link
Owner

tlivings commented Jul 3, 2020

Is this valid JSON schema? Can you point to the spec? I couldn't find it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants