-
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
Sending an object list in the URL #4064
Comments
@webron looking at: #3822 (comment) |
Well, in OAS 3.0 deepObject style is declared.
Swagger UI in TryIt mode render a simple text input field fot this parameter, the value "test" will be serialized to |
@shockey, no, there is simple (not indexed) array (now I need url-encoded real deep object like this |
Would confirm that the serialization isn't working, |
I seems like the serialization is still not working. I've tried both Swaggerhub and running swagger-ui locally (node_modules/swagger-client/package.json:_id is indeed 3.4.8) and it still gives the same error. Can anyone else confirm this? |
@jfboismenu, the original ticket was about bad result data, not an error message - can you open a new ticket for the error you're getting? Thanks! |
* fix deepObject serialization might fix swagger-api/swagger-ui#4064 * lint fix * fix: test: deepObject can be used with explode: true only as per the spec only explode = true allowed for deepObject
I am having the same issue as @mevl
Doesn't matter what you enter into the string for "Try It Out" it just splits all the characters up into an entry into the array. This is on swaggerhub by the way. |
Yeah my fix commit didn't really do the job fully. There's something else I am missing |
Reopening! |
@shockey anywhere else in the process a |
We are running into the same problem in LoopBack (see @mevl @championswimmer Have you found any (workaround?) solution for this problem? I found the following two comments that may be relevant for us:
swagger-api/swagger-js#1140 (comment)
@shockey @webron What's your opinion on this? If we contributed a patch to swagger-js that will serialize deeply-nested properties using the style described above, would you accept such change, despite the fact that OpenAPI specification does not explicitly describe how to serialize deeply-nested properties? FWIW, this serialization style is supported by https://www.npmjs.com/package/qs, which is used by http://expressjs.com as the default query parser, which means that a vast number of Node.js API servers are already expecting this serialization style. |
Also, since the problem of deeply-nested objects may be slightly different from the original problem described in this issue, should I open a new issue to keep track of this discussion? |
This shockey/swagger-js@8818f2d |
I created a new issue in swagger-js, sometimes it's best to not start a new discussion in an old issue that has been closed long time ago. Let's continue our discussion there: swagger-api/swagger-js#1385 |
FWIW, I created a proposal to enhance OpenAPI spec to support deep objects - see OAI/OpenAPI-Specification#1706. |
note: nested query object is not supported in swagger docs? ref: swagger-api/swagger-ui#4064
This is coming from my research on Issue #4056
It seems that arrays of objects are not quite easy/intuitive to send from the UI....
The list of integers or strings are working fine. But not the list of objects...
Demonstration API definition
http://swashbuckletest.azurewebsites.net/swagger/ui/index?filter=ArrayTest#/ArrayTest/ArrayTest_Get3
Expected Behavior
Here is how we properly send an object list in a .NET WebApi:
http://swashbuckletest.azurewebsites.net/api/ArrayTest/list_location?p[0][Lat]=1.11&p[0][Lon]=2.22&p[1][Lat]=5.55&p[1][Lon]=6.66
Here is a breakdown of the params
Current Behavior
The current implementation seems to url encode the items and concatenate them
http://swashbuckletest.azurewebsites.net/api/ArrayTest/list_location?p=Lat%3D1.1&p=Lat%3D5.55
I've tried a lot of different combinations and nothing, I've not seen an output close to the expected behavior
Possible Solution
...Still banging my head for one possible solution.
The text was updated successfully, but these errors were encountered: