fix: Cast boolean values in filter parameter (#9260)

This commit is contained in:
Elias Meire
2024-05-02 17:01:00 +02:00
committed by GitHub
parent d3e0640674
commit 30c8efc4cc
2 changed files with 32 additions and 5 deletions

View File

@@ -32,9 +32,15 @@ function parseSingleFilterValue(
type: FilterOperatorType,
strict = false,
): ValidationResult {
return type === 'any' || value === null || value === undefined
? ({ valid: true, newValue: value } as ValidationResult)
: validateFieldType('filter', value, type, { strict, parseStrings: true });
if (type === 'any' || value === null || value === undefined) {
return { valid: true, newValue: value } as ValidationResult;
}
if (type === 'boolean' && !strict) {
return { valid: true, newValue: Boolean(value) };
}
return validateFieldType('filter', value, type, { strict, parseStrings: true });
}
const withIndefiniteArticle = (noun: string): string => {