Skip to content

Label in object.and() #844

@jorge-pascual

Description

@jorge-pascual

When the engine generates an error because a object.and() fails, the label for keys isn't showed. For example:

schema = Joi.object().keys({
  CustomerName: Joi.string().min(1).required(),
  CustomerUniqueDebitMandateReference: Joi.string().label('Label1'),
  CustomerMandateSignatureDate: Joi.date().format('DD/MM/YYYY').label('Label2'),
}).and('CustomerUniqueDebitMandateReference', 'CustomerMandateSignatureDate');

Joi.validate({
  CustomerName: 'name',
  CustomerMandateSignatureDate: '12/02/2016',
}, schema, log);

Generates

value contains CustomerMandateSignatureDate without its required peers CustomerUniqueDebitMandateReference

instead of

value contains Label2 without its required peers Label1

Is that correct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug or defect

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions