-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Impossible to submit required params in react app which is using SwaggerUi component #4745
Comments
I am facing the same issue. Also using swagger-ui imported into my own react project. |
Hey @kokoc, this is because you're using React 16 in your project - we currently don't support that. You might be able to get away with isolating Swagger UI: consider using an iframe or Shadow DOM for the time being. Take a look at the other tickets in This is something that we want to fix, but more input would be great 😄 |
Thanks for clarifications. You right, iframes fix the issue. Here is a snippet that might be useful for other people:
|
Same issue for me - unable to submit required params from a SwaggerUI component in a react 16.5.2 app. Details all identical to above. If there's any more info I could provide that would be useful, let me know - Would love to know if there was any timeline for full react 16 support. |
@tomwatt, I don't have a timeline for you, but just so you know - this is on our radar. We see you! |
Adding this note in case someone comes upon this issue and thinks "I'm not integrating this into a React 16 app, why might I be seeing this?" This also happens in a dev environment running Swagger UI "standalone" with another React-dependent tool being used in the same dev install. To recreate, install Storybook as a devDependency, and implement a simple one page Swagger UI display separately in the same dev environment (meaning, installed as a devDependency as well) following the Swagger UI documentation. Storybook's React dependency is hard-set, so it's impossible to avoid installing 16 in this scenario, and this bug is then exposed for any required field. I'm looking at breaking either Storybook or Swagger into a separate project, but due to requirements around our project, both have to live in the same repository and aren't easily built separately. If I can contribute to one of the outstanding issues in the React 16 epic, I'll give it a shot. |
I'm glad I found this issue was raised, I always thought it was something in my code that was causing it grief and I just never had the time to look at it. Given that React 16 is pretty much the default now hopefully this can be addressed. I'm not sure what I can do to help it along but I certainly will be help to test the fix. |
Hello, I solve this problem with these version "react": "16.2.0", |
Hi everyone! I'm going to be working on this in the near future. Since it largely involves integrations within existing applications, I'd like to have some folks test out what I come up with before we ship it. If you'd like to help out, please email me (address in profile) and I'll be in touch. |
This works locally with |
So, I ran into this issue & solved it by removing the debounce on the input. That PR is available here: #4982 Could other people affected merge in that PR to their project and see if it fixes their use case? If so, that PR should either be merged or we should investigate why that input was debounced when others aren't, if it needs to be, and if lodash or a homegrown debounce can be put in its place instead. |
Fixed! We've just released |
So, I have that case mentioned earlier.. I have an angular app! Why is there a react dependency conflict? Thanks to that comment and
|
@djeikyb brilliant find! thanks for writing this up 😄 |
I'm using this in a Vue app and it still shows curl -X "undefined" using
Do I have to use swagger-ui-react instead? |
Prerequisites
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:
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:
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)The text was updated successfully, but these errors were encountered: