Hi all, having big issues in finding any documentation on this. There is a related issue but its from long ago and doesnt give any useful explanation on how it was solved.
I have a rails api exposing a PUT item/:id/upload endpoint to upload a file for an item. In order to upload a file, im creating a FormData object in js and want to send this object along with the 'id' needed as path parameter to reference the correct endpoint.
So while this works fine in my swagger-ui in rails (I just have two inputs, type number in path and type file in formdata) I couldnt find any way to trigger a request using the tags interface of swagger-js which would send both the id and the formdata object. Referring to the sample above these are all ways I tried which didnt succeed:
Q&A
Content & configuration
Swagger/OpenAPI definition:
Swagger-Client usage:
How can we help?
Hi all, having big issues in finding any documentation on this. There is a related issue but its from long ago and doesnt give any useful explanation on how it was solved.
I have a rails api exposing a PUT
item/:id/upload
endpoint to upload a file for an item. In order to upload a file, im creating a FormData object in js and want to send this object along with the 'id' needed as path parameter to reference the correct endpoint.So while this works fine in my swagger-ui in rails (I just have two inputs, type number in path and type file in formdata) I couldnt find any way to trigger a request using the tags interface of swagger-js which would send both the id and the formdata object. Referring to the sample above these are all ways I tried which didnt succeed:
It does send the formdata If I just pass that as first argument to the function like this:
but then it would lament missing an id in the path. Also tried appending id inside the formdata object and didnt work.
If the sample above is not clear enough, I found a very similar use case in the test pet sample in this repository: https://github.com/swagger-api/swagger-js/blob/master/test/data/petstore.json#L376
my question essentially is, how would you use the '/pet/{petId}/uploadImage' endpoint through swagger-js's tags interface?
Thanks :-)