Skip to content

Impossible to submit required params in react app which is using SwaggerUi component #4745

@kokoc

Description

@kokoc

Prerequisites

  • OS: macOS
  • Browser: chrome
  • Version: 67
  • Method of installation: npm
  • Swagger-UI version: 3.17.3
  • Swagger/OpenAPI version: OpenAPI 3.0

Content & configuration

Swagger UI is used inside react component. React version is ^16.3.2

Example Swagger/OpenAPI definition: https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml

Swagger-UI configuration options:

SwaggerUI({
  dom_id: "#swagger",
  url: spec_url,
})

Describe the bug you're encountering

Impossible to specify the required parameter for routes like /get/{petId}. The UI just remove it when I'm clicking on Try it Out -> Execute button.

To reproduce...

Steps to reproduce the behavior:

  1. Click on any route with required parameter. E.g. /pet/{petId}
  2. Click "Try it out" button
  3. Specify pet id
  4. Click on "execute" button
  5. See error - pet id was removed, petId field is red. UI doesn't send any http request

Expected behavior

UI sends the HTTP request and display the results

Screenshots

video

Additional context or thoughts

This is most visible issue that have direct impact on functionality. However, there are tons of JS errors in the chrome console. They appear on almost every stage: page load, authorization modal window, submiting requests, etc.

I think most of problems come from different react versions used in app and swagger ui

Other related issues: textarea with console curl command always show curl -X "undefined" instead of actual command(HTTP request is different)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions