Skip to content

defaults in ordered array are not filled #2404

@everhardt

Description

@everhardt

Support plan

  • is this issue currently blocking your project? (yes/no): no
  • is this issue affecting a production system? (yes/no): no

Context

  • node version: v14.4.0
  • module version with issue: 17.1.1
  • last module version without issue: unknown
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): standalone
  • any other relevant information:

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

const Joi = require('@hapi/joi');

const schema = Joi.array().ordered(
  Joi.string().required(),
  Joi.number().default(0),
  Joi.number().default(6),
).required();

const validationResult = schema.validate(['test']);

console.log(validationResult.value);

What was the result you got?

['test']

What result did you expect?

['test', 0, 6]

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