Skip to content

Allow treating arrays as objects #659

@pluma

Description

@pluma

I know there are no plans to support having joi.array() apply different schemas to items at different indexes, but it would be very useful to be able to circumvent that by simply treating arrays as objects (like JS generally does already).

Example:

joi.object().type(Array).validate([])

Expected outcome: validation passes

Actual outcome: validation fails with "must be an object".

Metadata

Metadata

Assignees

Labels

featureNew functionality or improvement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions