richhollis/swagger-docs — pull request #47 by ldnunes (2014-04-14 20:33:47+00:00)
Title: Delay processing docs DSL to allow changing the context of the controllers

If the swagger-docs DSL is processed while the controller class is loaded it can
cause some problems due to the controller class context being different after
load.

For example, in a production environment using the Unicorn webserver the
controllers are first loaded by the master process then forked to the
workers. If the worker process user is no the same, and the docs processing
requires a connection to the database with a different, limited user, then the
DSL would've been already run. Delaying the DSL Procs execution until they're
actually needed solves this problem.

Also, this adds some interesting syntatic dynamics for the docs generation in
the API controllers, such as being able to process the docs according to
different contexts of the application.

Signed-off-by: Lucas Dutra Nunes