Allow x-swagger-router-controller value to be a directory of operation files#474
Allow x-swagger-router-controller value to be a directory of operation files#474TuckerCowie wants to merge 2 commits intoapigee-127:masterfrom
Conversation
|
This is pretty cool since it allows easier separation of the individual endpoint handling functions without an artificial and long top level controller file |
|
So you want to break down the controller into separate, per-handler files? |
|
Correct. In a microservice architecture or in servers that only have one top level business concept, certain routes may implement some middleware and utilities while others may not. In our use case sometimes we are dealing with CRUDing basic JSON resources, while other times we are exposing business logic through an endpoint. Splitting the controlling logic into per-handler files helps alleviate unnecessary overhead for those routes that do not share any implementation details even though they may share a common parent route. |
Given a swagger config:
and a router config:
and the following directory structure:
This request will invoke
getPetByIdas a functionOtherwise, all preexisting functionality is present.