Skip to content

Array management on normalized #353

@DenisFerrero

Description

@DenisFerrero

When trying to normalize a schema, if you don't provide the items on an array type element, the function throws an error.
To prevent this, I think that when trying to parse an array it should apply a default value to the items field if it is not provided.

if(result.type === "array") {
	if (!result.items)
		result.items = 'any';
	result.items = this.normalize(result.items);
	return result;
}

https://github.com/icebob/fastest-validator/blob/cec103b471cca5db6e8f9f3c3530e2dea8aa5bdb/lib/validator.js#L645-647

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions