Swagger-ui: Query parameters and path variables are not read

Created on 11 Jan 2019  Â·  17Comments  Â·  Source: swagger-api/swagger-ui

Q&A

  • OS: linux
  • Browser:chrome
  • Version: 70.0.3538.77
  • Method of installation: npm
  • Swagger-UI version: 3.20.4
  • Swagger/OpenAPI version:"swagger":"2.0"

Not extra configuration used.

To reproduce...

Steps to reproduce the behavior:

  1. Go to main page
  2. Click on any service
  3. Click on 'try it out' and complete a query parameter or path variable
  4. Click on execute
  5. See query parameter or path variable is not in generated curl and not used to call service and input field is empty.

Expected behavior

parameter or path variable is in generated curl

Before execute

captura

After

captura2

support

Most helpful comment

I was having these problems as well, I tried reverting previous version of swagger-ui with no difference.
I also had the same problem with both v2 and v3 versions of the spec files.

I reverted to React version 15.6.2 which was in the current swagger-ui dependency list and it seemed to fix it. Before I was running with the latest react version of 16.8.6.

I tried moving to 16.0.0 and it doesn't work. It probably has to do with some of the other downstream dependencies that swagger-ui pulls in that do not work with the major version upgrade. As a workaround I will probably just set the react version to 15 until they release support for version 16.

All 17 comments

Hi @GonzaloMz!

This is working with the default Petstore definition:

image

Can you provide a definition we can use to reproduce this problem?

Hi!

i am having same problem with this petstore definition.

https://petstore.swagger.io/v2/swagger.json

Extra info

it does not work from the version 3.11.0
3.10.0 it's ok... but it has no support for oauth2...

Thanks!

@GonzaloMz do you see the problem if you use the version of Swagger UI that's running at https://petstore.swagger.io/index.html ?

No, it's ok

i'm using in react app

captura

something missing?

hi!
thanks for answering while you could

I solve mi problem using swagger-ui-dist module in place of swagger-ui.
I think you should update the docs or fix the problem.

captura

I think you should update the documentation or fix the problem, since I understand that in my situation it should work only with the swagger-ui module.

please try using the swagger-ui module in version 3.11.0 or higher to view the pet store documentation to reproduce the problem

fyi I'm having the same problem with swagger-ui 3.20.5 using openapi 3.0.0.

should't this to be a high priority item to fix ? basically it makes swagger not callable for query parameters

@GonzaloMz @balexander @o2h2o, are any of you experiencing this while using Swagger UI in a React 16 application?

Hi Kyle
thanks for reaching out
I have faced exactly same issue while i am developing aws api developer
portal
https://github.com/awslabs/aws-api-gateway-developer-portal
it is a react applicaiton, i tried clean set up without any
customerziation, still have issues, until i downgraded to 3.10.0

it is react "@types/react": {
"version": "16.4.6",

Thanks

On Wed, Feb 6, 2019 at 9:23 AM kyle notifications@github.com wrote:

@GonzaloMz https://github.com/GonzaloMz @balexander
https://github.com/balexander @o2h2o https://github.com/o2h2o, are
any of you experiencing this while using Swagger UI in a React 16
application?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/swagger-api/swagger-ui/issues/5119#issuecomment-460827914,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AVwQzoO8QkwEk931uD6R8EJmssjqwng5ks5vKgRvgaJpZM4Z6iLP
.

--
Regards,
Zhengwei

We are experiencing same with swagger-ui 3.21.0 and react 16.8.4

If field has default value the default value is used even if we set an other one in form.
If field does not have default value, swagger is displaying error that field is empty even if you just put a value.

I just tested our definition with https://petstore.swagger.io and it is working with no issue.

@shockey Do you need more info ?
Do we need to provide anything else to make this issue go forward ?

I was having these problems as well, I tried reverting previous version of swagger-ui with no difference.
I also had the same problem with both v2 and v3 versions of the spec files.

I reverted to React version 15.6.2 which was in the current swagger-ui dependency list and it seemed to fix it. Before I was running with the latest react version of 16.8.6.

I tried moving to 16.0.0 and it doesn't work. It probably has to do with some of the other downstream dependencies that swagger-ui pulls in that do not work with the major version upgrade. As a workaround I will probably just set the react version to 15 until they release support for version 16.

We also reverted to react 15 and all is working fine ;)
Thx @jennifergarcia

Hi @Marc3001 @jennifergarcia - we recently created swagger-ui-react, which declares React as a peer dependency instead of a conventional dependency. If you use it in place of swagger-ui, you should be able to embed Swagger UI in your React projects even if your project is on 16!

Thanks @shockey, I initially tried to use the react version but I ran into limitations on the ability to use all the plugins and customizations that the other version allows.

Any plans to solve this issue with React 16 ?

What's the best way to solve this in 2020, if reverting back to react 15 is not doable?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zilongl picture zilongl  Â·  3Comments

ankon picture ankon  Â·  4Comments

MartinMuzatko picture MartinMuzatko  Â·  4Comments

prabhat1790 picture prabhat1790  Â·  3Comments

songtianyi picture songtianyi  Â·  3Comments