Skip to content

Joi 8.x breaks describe().meta in alternatives #851

@Sebmaster

Description

@Sebmaster

Context

  • node version: v5.9.0
  • joi version: 8.0.4
  • environment (node, browser): node
  • used with (hapi, standalone, ...): standalone
  • any other relevant information:

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

Joi 8.0.4 removes meta in the alternative's describe() schema. I'm guessing unintentionally since it's not in the release notes. It also still works for other types.

Repro:

var Joi = require('joi');
var describe = Joi.when('x', {is: Joi.any(), then: Joi.any(), otherwise: Joi.any()}).meta({a: 1}).describe();

console.log(describe.meta);
sebastian@host:~/trello/shop-api$ npm i joi@7
sebastian@host:~/trello/shop-api$ node test
[ { a: 1 } ]
sebastian@host:~/trello/shop-api$ npm i joi@8
sebastian@host:~/trello/shop-api$ node test
undefined

Metadata

Metadata

Assignees

Labels

bugBug or defect

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions