I have an existing Restify server and I want to retrofit Swagger into the application in order to validate the requests and responses.
Problem
When I use swagger project create command to create a new Restify server wrapped with swagger-restify-mw, it uses the Swagger Router fitting to route the request to the corresponding controller function, as specified through the x-swagger-router-controller and operationId properties.
However, the application I am working on is large and I don't want to change how we structure our application and convert all endpoints to controller functions.
I.e. I want to keep defining how requests are handled normally:
Since requests are passed through the swagger_controllers pipe, I tried to take out the swagger_router pipe from the default.yaml file. The API endpoints responds properly as before, but it is no longer carrying any form of validation.
I've been scratching my head for a few days now, looking into the source code of swagger-node-runner, and sway, any pointers in the right direction would be appreciated. 🙇
Background
I have an existing Restify server and I want to retrofit Swagger into the application in order to validate the requests and responses.
Problem
When I use
swagger project create
command to create a new Restify server wrapped withswagger-restify-mw
, it uses the Swagger Router fitting to route the request to the corresponding controller function, as specified through thex-swagger-router-controller
andoperationId
properties.However, the application I am working on is large and I don't want to change how we structure our application and convert all endpoints to controller functions.
I.e. I want to keep defining how requests are handled normally:
My Attempt
Since requests are passed through the
swagger_controllers
pipe, I tried to take out theswagger_router
pipe from thedefault.yaml
file. The API endpoints responds properly as before, but it is no longer carrying any form of validation.My
default.yaml
file is as follows:I've been scratching my head for a few days now, looking into the source code of
swagger-node-runner
, andsway
, any pointers in the right direction would be appreciated. 🙇