Skip to content

Chaining multiple examples does not overwrite the old examples #1555

@Niketin

Description

@Niketin

Context

  • node version: v9.6.0
  • joi version: 13.4.0
  • environment (node, browser): node
  • used with (hapi, standalone, ...): hapi
  • any other relevant information:

What are you trying to achieve or the steps to reproduce ?

const some_common_schema = Joi.number()
  .integer()
  .positive()
  .example(15);
const other_schema = some_common_schema.required().example(200);

Which result you had ?

other_schema did have example value of 15. Console logging the other_schema shows that the id 200
is pushed to array _examples: [ 15, 200 ],

What did you expect ?

I expected it to replace the old example value with the new one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changesChange that can breaking existing codefeatureNew functionality or improvement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions