fix(utils): fix validation for required values without specified type (#9863)

Refs #8007
This commit is contained in:
Oliwia Rogala
2024-04-23 10:09:32 +02:00
committed by GitHub
parent cf7b7691f5
commit 6fccf9e219
2 changed files with 30 additions and 1 deletions

View File

@@ -439,13 +439,26 @@ function validateValueBySchema(value, schema, requiredByParam, bypassRequiredChe
const isValidNullable = nullable && value === null
// required value is not provided and there's no type defined in the schema
const requiredNotProvided =
schemaRequiresValue
&& !hasValue
&& !isValidNullable
&& !bypassRequiredCheck
&& !type
if (requiredNotProvided) {
errors.push("Required field is not provided")
return errors
}
// will not be included in the request or [schema / value] does not [allow / require] further analysis.
const noFurtherValidationNeeded =
isValidNullable
|| !type
|| !requiresFurtherValidation
if(noFurtherValidationNeeded) {
if (noFurtherValidationNeeded) {
return []
}