-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
bugBug or defectBug or defect
Milestone
Description
Context
It is not possible to create an example for an array schema, as the value passed into the example function is concatenated with existing examples.
- node version: 4.0.0
- joi version: 7.2.3
- environment (node, browser): no
- used with (hapi, standalone, ...): standalone
- any other relevant information:
What are you trying to achieve or the steps to reproduce ?
Trying to provide examples for a joi.array, so that schema.describe().examples will provide an array of arrays.
Describe your issue here, include schemas and inputs you are validating if needed.
const schema = Joi.array()
.example(['a', 'b'])
.example(['c', 'd'])
let examples = schema.describe().examples;
assert(examples.length == 2); //failsWhich result you had ?
examples.length is 1
What did you expect ?
examples.length is 2
Offending line of code:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugBug or defectBug or defect