playframework - RPC style API, swagger and Play framework 2 (swagger-core) -
i implementing rpc type api app. using java on play framework. used swagger modules generate swagger documentation simple rest apis each "url" mapped different static function in controllers. here need map 1 url , 1 static function multiple actions in api docs.
the basic structure quite classic
abstract class rpcactionrequest implements serializable{ public int actioncode; //this might enum public rpcactionparam param; } interface rpcactionparam implements serializable{ } abstract class rpcaction { public int actioncode; public abstract rpcactionresult execute(rpcactionparam param); } interface rpcactionresult implements serializable{ public int responsecode; //success, error, fail, ... whatever errors system needs //communicate client. } every single of actions map same static function in rpccontroller mapper such in routes file of play framework
/rpc/ routes.rpccontroller.rpc()
how can document actions, param classes , results classes using swagger , swagger-core doc generations? possible @api* annotations of swagger-play2 module?
refs:
-swagger : https://developers.helloreverb.com/swagger/
-swagger-core : https://github.com/wordnik/swagger-core
Comments
Post a Comment