[nodejs] Missing paths/methods : a simple workaround
This is related to bug : https://github.com/swagger-api/swagger-codegen/issues/652
As api/swagger.json is not currently well generated, there is a simple way to fix this
- Add "x-swagger-router-controller" at the path level of the original Swagger Specification for each defined path of the specification (it's mandatory by swagger-tools/router).
- Get the nodejs generated code and unzip wherether you want !
- Replace the api/swagger.json generated file by the original file (I.E, download json file from editor.swagger.io).
After that, you can see all the operations of all paths with http://localhost:8080/docs and all the functions (named by operationId) are well routed with paths.
Hope it help to wait the v2.1.0 !
@Cooker-Monster Im experiencing the reference bug and having problems applying your solution.
A part of my swagger file looks like this:
paths:
/users:
get:
summary: Users
description: |
Get Users
tags:
- Users
responses:
200:
description: Array of users
post:
summary: Users
description: |
Register User
tags:
- Users
responses:
200:
description: Register successful
Only the POST path is generated when exporting to NodeJS. Where am i supposed to add x-swagger-router-controller to fix this problem?
Hi Nume ! As I said, your own swagger file must contain the x-swagger-router-controller attribute but that will not fix the problem on his own ! You also must replace the generated swagger file by your own file, as the generated file don't respect the Swagger spec syntax.
The generated swagger file should represent what you used directly. Please reopen if you still see an issue with this.
The generated code is now correct ! Thx a lot for this well done job.