Skip to content

fix: Validation returns an unknownValue error for strings when forbidUnknownValues: false #2616

Open
@aklemen

Description

@aklemen

Description

Even though forbidUnknownValues: false is set on the validation options, the validation of string values still returns an unknownValue error.

Minimal code-snippet showcasing the problem

const someString = 'test';
const validationErrors = validateSync(someString, { forbidUnknownValues: false });

Expected behavior

validationErrors should be

[] // no errors

Actual behavior

validationErrors is

[{"children": [], "constraints": {"unknownValue": "an unknown value was passed to the validate function"}, "property": undefined, "target": {"forbidUnknownValues": false}, "value": undefined}]

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs triageIssues which needs to be reproduced to be verified report.type: fixIssues describing a broken feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions