scottie1984 / swagger-ui-express

Adds middleware to your express app to serve the Swagger UI bound to your Swagger document. This acts as living documentation for your API hosted from within your app.
MIT License
1.41k stars 225 forks source link

duplicate ID in case of nested path #279

Closed AmitThakkar closed 2 years ago

AmitThakkar commented 2 years ago

When we have nested routes e.g.

/users
/users/{id}/addresss

swagger-ui-express generate HTLM(swaggerUi.generateHTML(swaggerJson)) generates two div with the same id(as shown in the below picture) in the same block.

Screenshot 2021-12-13 at 08 39 56

Whenever I click on /users post method it opens both the post div blocks (/users and /users/{id}/address) and the same behaviour whenever I click on /users/{id}/addresss.

How can I separate both the routes(/users and /users/{id}/address) so only one desired gets open.

I am using the tsoa module to generate routes and swagger.

scottie1984 commented 2 years ago

Do they have different operationId properties?

AmitThakkar commented 2 years ago

Hello @scottie1984 ,

Thanks for your quick response and for looking into this. I looked at the swagger.json file and noticed it I have duplicate operationId for each REST API also found an open issue at tsoa.

Thanks again for pointing this.