There is a ton of duplicate logic and checking in the example data generation code base at /lib/helpers. This also creates complex edge cases (like #111 ).
The example data generation should leverage classes so that base Joi rules like defaults, valids, examples, etc can be abstracted into the base Example class. Each "type" can then handle type-specific rules more cleanly, and "meta" types like alternatives and object keys do not have to re-create raw schema and parse the rules/defaults/flags all over again.
There is a ton of duplicate logic and checking in the example data generation code base at
/lib/helpers
. This also creates complex edge cases (like #111 ).The example data generation should leverage classes so that base Joi rules like defaults, valids, examples, etc can be abstracted into the base Example class. Each "type" can then handle type-specific rules more cleanly, and "meta" types like
alternatives
andobject
keys do not have to re-create raw schema and parse the rules/defaults/flags all over again.