Forum Discussion

PaulVidler's avatar
PaulVidler
New Contributor
26 days ago

Swagger UI not filling multiple route params

I am implementing Swagger into an ExpressJs API application. In the controller files, we are using nested folders and "const router = require('express').Router({ mergeParams: true });" to inherit path variables from parent folders. When I run my swagger implementation, anything deeper than the parent folder will not dynamically put in the route variables provided from the swagger UI.

Example: I will put in the variables "mineID' and "incidentId" from the text boxes in swagger ui, then this is the exact curl request sent in swagger, where you can see that the second route parameter has not been filled:
curl -X 'GET' \
  'http://localhost:4900/v2/mines/56677888/incidents/{incidentId}/current' \

Above, you can see how the request did not correctly fill the second param it was given in the Swagger UI. I can confirm that the definition for these variables is correct and the route param name and path name in my definition match correctly. Also, this controller is working successfully in production and has been tested thouroughly.

In my implementation of swagger, I am using jsdocs in a seperate file, but in the same folder as the controller code. How might I get these variables to populate correctly? It is working elsewhere in the application and I only need solutions for the swagger implementation, the API code is tested and working fine on its own

Any help would be appreciated, this is causing me more trouble than I'd like. Thanks.