tlivings / enjoi

Converts a JSON schema to a Joi schema.
Apache License 2.0
283 stars 57 forks source link

implement default value handling #109

Closed nlundquist closed 3 years ago

nlundquist commented 3 years ago

Add an option useDefaults (named the same as the similar property in AJV) which uses the JSONSchema default keyword to populate missing values via joi.default.

This is behind an option since default in JSONSchema is an annotation (i.e metadata) and doesn't strictly imply any behavior during validation. The choice to insert defaults in place of missing values is an optional implementation detail provided by some JSONSchema implementations and allowed in the spec.

tlivings commented 3 years ago

Oops. Need to resolve conflicts.