schema icon indicating copy to clipboard operation
schema copied to clipboard

Add objects unions and intersections

Open stepaniukm opened this issue 4 years ago • 5 comments

stepaniukm avatar Jan 14 '21 15:01 stepaniukm

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 avatar Jan 14 '21 17:01 typeofweb

@all-contributors please add @stepaniukm for ideas

typeofweb avatar Mar 23 '21 19:03 typeofweb

@mmiszy

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

allcontributors[bot] avatar Mar 23 '21 19:03 allcontributors[bot]

@all-contributors please add @stepaniukm for ideas

typeofweb avatar Mar 23 '21 19:03 typeofweb

@mmiszy

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

allcontributors[bot] avatar Mar 23 '21 19:03 allcontributors[bot]