gcanti / tcomb-json-schema

Transforms a JSON Schema to a tcomb type
MIT License
144 stars 33 forks source link

support 'anyOf', 'allOf', 'oneOf', 'not' #4

Open ahdinosaur opened 9 years ago

ahdinosaur commented 9 years ago

heya! tcomb seems really awesome, as i share a passion for domain-driven development, and this seems like a great library for bridging tcomb with json-schema, nice work! :smile_cat: i'm interested in the possibility of using tcomb with my project's domain models described in json-schema.

first up, tcomb-json-schema doesn't support anyOf, allOf, oneOf, not logical primitives. i reckon we can implement this using fcomb?

mqklin commented 5 years ago

You can use this instead of oneOf: t.irreducible('x', x => ['confirmed', 'pending', 'failed', {}, ['something', {else: 123}]].some(y => _.isEqual(x, y))),