If I want to have controllers under different subdirectories such as 'User','Product' how do I configure the swagger file ? I think by default all controllers have to be under a directory called 'controllers'. Is this configurable ?I think one way to do it is to specify the value of options.controllers in swagger router options. I wanted to know if there is a better way to do it?
Hi Hemanth,
No, there is no way to configure the controller directories directly from the swagger file. However, you may certainly specify multiple controller (and mock, if you'd like) paths in your configuration files if you'd like.
For example, in config/default.yaml, you'd add a section like this:
a127.magic: swaggerFile: api/swagger/swagger.yaml controllers: controllers: - api/controllers/user - api/controllers/product mocks: - api/mocks/user - api/mocks/product volos: helpers: 'api/helpers'
Note that the other sections (controllers and volos) will be required. The above shows the defaults for those values.
Also note that paths will be searched in order and exist in the same namespace, so be sure to avoid naming collisions.
Hope that helps!
Scott