diff --git a/lib/Tuba/Doc.pm b/lib/Tuba/Doc.pm index 08bd280a..e43b55af 100644 --- a/lib/Tuba/Doc.pm +++ b/lib/Tuba/Doc.pm @@ -104,7 +104,6 @@ sub api_reference { $c->stash(placeholders => \@placeholders); } ); - } 1; diff --git a/lib/Tuba/DocManager.pm b/lib/Tuba/DocManager.pm index 026eec62..9994c8fe 100644 --- a/lib/Tuba/DocManager.pm +++ b/lib/Tuba/DocManager.pm @@ -251,6 +251,7 @@ sub find_doc { note => $entry->{note}, tags => $entry->{tags}, response_headers => $entry->{response_headers}, + formats => $entry->{formats}, ); } @@ -308,6 +309,11 @@ sub _show_defaults { return ( brief => "Get a representation of $an $phrase.", description => "Get JSON which represents the structure of $an $phrase.", + formats => [ + 'application/json', 'application/x-turtle', 'text/turtle', + 'application/n-triples', 'text/n3', 'text/rdf+n3', 'application/ld+json', + 'application/rdf+xml', 'application/rdf+json', + ], $a{withs} ? ( params => [ @@ -394,7 +400,7 @@ sub _walk_routes { headers => $doc->response_headers || {} } }, - produces => [ "application/json" ], + produces => $doc->formats || [ "application/json" ], tags => $doc->tags || [ "misc" ], ( parameters => \@params ) x !!@params, } diff --git a/lib/Tuba/RouteDoc.pm b/lib/Tuba/RouteDoc.pm index c8c58884..86ac218d 100644 --- a/lib/Tuba/RouteDoc.pm +++ b/lib/Tuba/RouteDoc.pm @@ -14,6 +14,7 @@ has 'params'; has 'note'; has 'tags'; has 'response_headers'; +has 'formats'; 1;