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

feature: allow unique keys on array schema #93

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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