diff --git a/src/core/utils/index.js b/src/core/utils/index.js index 9e9934d9066..9b008587f84 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -466,6 +466,7 @@ function validateValueBySchema(value, schema, requiredByParam, bypassRequiredChe let stringCheck = type === "string" && value let arrayCheck = type === "array" && Array.isArray(value) && value.length let arrayListCheck = type === "array" && Im.List.isList(value) && value.count() + let arrayStringCheck = type === "array" && typeof value === "string" && value let fileCheck = type === "file" && value instanceof win.File let booleanCheck = type === "boolean" && (value || value === false) let numberCheck = type === "number" && (value || value === 0) @@ -474,7 +475,7 @@ function validateValueBySchema(value, schema, requiredByParam, bypassRequiredChe let objectStringCheck = type === "object" && typeof value === "string" && value const allChecks = [ - stringCheck, arrayCheck, arrayListCheck, fileCheck, + stringCheck, arrayCheck, arrayListCheck, arrayStringCheck, fileCheck, booleanCheck, numberCheck, integerCheck, objectCheck, objectStringCheck, ] diff --git a/test/e2e-cypress/e2e/features/try-it-out-schema-type-array-example-type-string.cy.js b/test/e2e-cypress/e2e/features/try-it-out-schema-type-array-example-type-string.cy.js deleted file mode 100644 index cf25a9c030c..00000000000 --- a/test/e2e-cypress/e2e/features/try-it-out-schema-type-array-example-type-string.cy.js +++ /dev/null @@ -1,12 +0,0 @@ -describe("Try it out with schema type array but example type string", () => { - it("shows a validation error message when Execute is clicked", () => { - cy - .visit("?tryItOutEnabled=true&url=/documents/features/try-it-out-schema-type-array-example-type-string.yaml") - .get("#operations-default-get_") - .click() - .get(".btn.execute") - .click() - .get(".validation-errors") - .should("exist") - }) - }) diff --git a/test/e2e-cypress/static/documents/features/try-it-out-schema-type-array-example-type-string.yaml b/test/e2e-cypress/static/documents/features/try-it-out-schema-type-array-example-type-string.yaml deleted file mode 100644 index 118afd1e871..00000000000 --- a/test/e2e-cypress/static/documents/features/try-it-out-schema-type-array-example-type-string.yaml +++ /dev/null @@ -1,23 +0,0 @@ -openapi: 3.0.3 -info: - title: test - version: 1.0.0 -paths: - /: - get: - parameters: - - in: query - name: test - required: true - schema: - type: array - example: 'test1' - items: - type: string - enum: - - 'test1' - - 'test2' - - 'test3' - responses: - default: - description: ok diff --git a/test/unit/core/utils.js b/test/unit/core/utils.js index b69a03edd5d..5787fd7de88 100644 --- a/test/unit/core/utils.js +++ b/test/unit/core/utils.js @@ -749,7 +749,7 @@ describe("utils", () => { type: "array" } value = "[1]" - assertValidateParam(param, value, ["Required field is not provided"]) + assertValidateParam(param, value, []) // valid array, items match type param = {