-
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
enum and boolean type in parameters cause Objects are not valid as a child in swagger-ui-react #8218
Comments
This combination may be the culprit, though it might still be indicating an actual problem that is getting swallowed. That said, I tried to reproduce using the provided definition on the current SwaggerUI build locally, as well as on editor-next.swagger.io (which uses swagger-ui-react), but see no error on expansion of an operation or changing of a boolean/enum. As you noted, editor.swagger.io also does not display errors. Are you able to observe a visual difference in SwaggerUI between actual vs expected, which might not rely on console/devtools? |
No difference. In my real app, I can switch serveral sources of API json url, and some of them work well. An API json url with multiple endpoints fails only for those had enum/boolean in parameters, but work well for other endpoints that don't contain enum/boolean. I also think it may due to swagger-ui-react (maybe react-redux? behaviors) in preact/vite environment cause this weird errors. I have used SwggerUIBundle in html to render the same json url and no errors. |
closed via #8231 |
@cywhale eventually did you have success with preact? i see similar errors on very basic schema |
Ya. New release >= v4.15.1 actually solve this problem. I have a test repo |
Reproduce example:
https://github.com/cywhale/test_swagger
To reproduce...
Steps to reproduce the behavior:
Example Swagger/OpenAPI definition:
test data in repo: public/test.json (format had been validated in https://editor.swagger.io/ without errors)
link: https://github.com/cywhale/test_swagger/blob/main/public/test.json
Swagger-UI configuration options:
js source in src/components/Swagger/index.jsx
link: https://github.com/cywhale/test_swagger/blob/main/src/components/Swagger/index.jsx
Describe the bug you're encountering
That's, if I have boolean or enum type in json, just like the following, error occurred (logs pasted in the end of this issue), and the swagger-ui-react cannot correctly render. If I remove boolean/enum, it correctly render.
Expected behavior
Screenshots
Error logs (in devTool)
Additional context or thoughts
I use preactjs 10.11.1(latest version), and vite 3.1.4. I'm not sure if it's will be a cause for this issue
The text was updated successfully, but these errors were encountered: