Skip to content

Commit 54b6732

Browse files
lukaszzazulakkirill-of-turov
authored andcommitted
Revert "fix(utils): disallow schema type array value string (swagger-api#10691)" (swagger-api#10710)
This reverts commit e87ecd7.
1 parent bb2bac5 commit 54b6732

4 files changed

Lines changed: 3 additions & 37 deletions

File tree

src/core/utils/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ function validateValueBySchema(value, schema, requiredByParam, bypassRequiredChe
466466
let stringCheck = type === "string" && value
467467
let arrayCheck = type === "array" && Array.isArray(value) && value.length
468468
let arrayListCheck = type === "array" && Im.List.isList(value) && value.count()
469+
let arrayStringCheck = type === "array" && typeof value === "string" && value
469470
let fileCheck = type === "file" && value instanceof win.File
470471
let booleanCheck = type === "boolean" && (value || value === false)
471472
let numberCheck = type === "number" && (value || value === 0)
@@ -474,7 +475,7 @@ function validateValueBySchema(value, schema, requiredByParam, bypassRequiredChe
474475
let objectStringCheck = type === "object" && typeof value === "string" && value
475476

476477
const allChecks = [
477-
stringCheck, arrayCheck, arrayListCheck, fileCheck,
478+
stringCheck, arrayCheck, arrayListCheck, arrayStringCheck, fileCheck,
478479
booleanCheck, numberCheck, integerCheck, objectCheck, objectStringCheck,
479480
]
480481

test/e2e-cypress/e2e/features/try-it-out-schema-type-array-example-type-string.cy.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

test/e2e-cypress/static/documents/features/try-it-out-schema-type-array-example-type-string.yaml

Lines changed: 0 additions & 23 deletions
This file was deleted.

test/unit/core/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ describe("utils", () => {
749749
type: "array"
750750
}
751751
value = "[1]"
752-
assertValidateParam(param, value, ["Required field is not provided"])
752+
assertValidateParam(param, value, [])
753753

754754
// valid array, items match type
755755
param = {

0 commit comments

Comments
 (0)