@ SuppressWarnings ( "unused" ) // called through reflection by RequestServer public MetadataV3 listRoutes ( int version , MetadataV3 docs ) { MarkdownBuilder builder = new MarkdownBuilder ( ) ; builder . comment ( "Preview with http://jbt.github.io/markdown-editor" ) ; builder . heading1 ( "REST API Routes Table of Contents" ) ; builder . hline ( ) ; builder . tableHeader ( "HTTP method" , "URI pattern" , "Input schema" , "Output schema" , "Summary" ) ; docs . routes = new RouteV3 [ RequestServer . numRoutes ( ) ] ; int i = 0 ; for ( Route route : RequestServer . routes ( ) ) { RouteV3 schema = new RouteV3 ( route ) ; docs . routes [ i ] = schema ; // ModelBuilder input / output schema hackery MetadataV3 look = new MetadataV3 ( ) ; look . routes = new RouteV3 [ 1 ] ; look . routes [ 0 ] = schema ; look . path = route . _url ; look . http_method = route . _http_method ; fetchRoute ( version , look ) ; schema . input_schema = look . routes [ 0 ] . input_schema ; schema . output_schema = look . routes [ 0 ] . output_schema ; builder . tableRow ( route . _http_method , route . _url , Handler . getHandlerMethodInputSchema ( route . _handler_method ) . getSimpleName ( ) , Handler . getHandlerMethodOutputSchema ( route . _handler_method ) . getSimpleName ( ) , route . _summary ) ; i ++ ; } docs . markdown = builder . toString ( ) ; return docs ; }
Return a list of all REST API Routes and a Markdown Table of Contents .