diff --git a/src/core/components/parameter-row.jsx b/src/core/components/parameter-row.jsx index 8ed25ecc..d935e91e 100644 --- a/src/core/components/parameter-row.jsx +++ b/src/core/components/parameter-row.jsx @@ -188,7 +188,7 @@ export default class ParameterRow extends Component { required={ required } description={param.get("description") ? `${param.get("name")} - ${param.get("description")}` : `${param.get("name")}`} onChange={ this.onChangeWrapper } - errors={ param.get("errors") } + errors={ paramWithMeta.get("errors") } schema={ isOAS3 && isOAS3() ? param.get("schema") : param }/> } diff --git a/test/e2e/scenarios/bugs/4374.js b/test/e2e/scenarios/bugs/4374.js new file mode 100644 index 00000000..601a6d91 --- /dev/null +++ b/test/e2e/scenarios/bugs/4374.js @@ -0,0 +1,32 @@ +describe("bug #4374: OAS3 parameters should be visibly validated in Try-It-Out", function () { + let mainPage + beforeEach(function (client, done) { + mainPage = client + .url("localhost:3230") + .page.main() + + client.waitForElementVisible(".download-url-input", 10000) + .pause(1000) + .clearValue(".download-url-input") + .setValue(".download-url-input", "http://localhost:3230/test-specs/bugs/4374.yaml") + .click("button.download-url-button") + .pause(1000) + + done() + }) + afterEach(function (client, done) { + done() + }) + it("indicates an error when a required parameter is not selected", function (client) { + client.waitForElementVisible(".opblock-tag-section", 10000) + .assert.containsText(".opblock-summary-path span", "/pet/findByStatus") + .click(".opblock") + .waitForElementVisible(".opblock.is-open", 5000) + .click(".try-out__btn") + .click(".btn.execute") + .pause(100) + .assert.cssClassPresent(".parameters-col_description select", "invalid") + + client.end() + }) +}) diff --git a/test/e2e/specs/bugs/4374.yaml b/test/e2e/specs/bugs/4374.yaml new file mode 100644 index 00000000..61ecf810 --- /dev/null +++ b/test/e2e/specs/bugs/4374.yaml @@ -0,0 +1,228 @@ +--- +openapi: 3.0.0 +servers: +- url: http://localhost:3204/ +info: + description: 'This is a sample server Petstore server. You can find out more about + Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For + this sample, you can use the api key `special-key` to test the authorization filters.' + version: 1.0.0 + title: Swagger Petstore + termsOfService: http://swagger.io/terms/ + contact: + email: apiteam@swagger.io + license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html +tags: +- name: pet + description: Everything about your Pets + externalDocs: + description: Find out more + url: http://swagger.io +- name: store + description: Access to Petstore orders +- name: user + description: Operations about user + externalDocs: + description: Find out more about our store + url: http://swagger.io +paths: + "/pet/findByStatus": + get: + tags: + - pet + summary: Finds Pets by status + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - name: status + in: query + description: Status values that need to be considered for filter + required: true + explode: true + schema: + type: array + items: + type: string + enum: + - available + - pending + - sold + default: available + responses: + '200': + description: successful operation + content: + application/xml: + schema: + type: array + items: + "$ref": "#/components/schemas/Pet" + application/json: + schema: + type: array + items: + "$ref": "#/components/schemas/Pet" + '400': + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +components: + schemas: + Order: + type: object + properties: + id: + type: integer + format: int64 + petId: + type: integer + format: int64 + quantity: + type: integer + format: int32 + shipDate: + type: string + format: date-time + status: + type: string + description: Order Status + enum: + - placed + - approved + - delivered + complete: + type: boolean + default: false + xml: + name: Order + Category: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: Category + User: + type: object + properties: + id: + type: integer + format: int64 + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + type: integer + format: int32 + description: User Status + xml: + name: User + Tag: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: Tag + Pet: + type: object + required: + - name + - photoUrls + properties: + id: + type: integer + format: int64 + category: + "$ref": "#/components/schemas/Category" + name: + type: string + example: doggie + photoUrls: + type: array + xml: + name: photoUrl + wrapped: true + items: + type: string + tags: + type: array + xml: + name: tag + wrapped: true + items: + "$ref": "#/components/schemas/Tag" + status: + type: string + description: pet status in the store + enum: + - available + - pending + - sold + xml: + name: Pet + ApiResponse: + type: object + properties: + code: + type: integer + format: int32 + type: + type: string + message: + type: string + requestBodies: + Pet: + content: + application/json: + schema: + "$ref": "#/components/schemas/Pet" + application/xml: + schema: + "$ref": "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + type: array + items: + "$ref": "#/components/schemas/User" + description: List of user object + required: true + securitySchemes: + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + api_key: + type: apiKey + name: api_key + in: header