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

Add objects unions and intersections #20

Open
stepaniukm opened this issue Jan 14, 2021 · 5 comments
Open

Add objects unions and intersections #20

stepaniukm opened this issue Jan 14, 2021 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@stepaniukm
Copy link

No description provided.

@typeofweb
Copy link
Member

Unions are already covered thanks to oneOf:

const userSchema = object({
  name: string(),
  role: oneOf(['USER']),
})
const adminSchema = object({
  name: string(),
  role: oneOf(['ADMIN']),
})

const x = validate(oneOf([userSchema, adminSchema]))();

@typeofweb typeofweb added the help wanted Extra attention is needed label Jan 27, 2021
@typeofweb
Copy link
Member

@all-contributors please add @stepaniukm for ideas

@allcontributors
Copy link
Contributor

@mmiszy

This project's configuration file has malformed JSON: .all-contributorsrc. Error:: Unexpected token ] in JSON at position 2105

@typeofweb
Copy link
Member

@all-contributors please add @stepaniukm for ideas

@allcontributors
Copy link
Contributor

@mmiszy

I've put up a pull request to add @stepaniukm! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants