Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resteasy - generate REST documentation from Javadoc and Annotations [closed]

I would like to find a way to generate nice REST API documentation out of java code (WADL or HTML) - based on JAXB, JAX-RS annotations and java doc comments (no doclet please).

Here is my project environment

  • Spring, no XML only annotations
  • Rest-easy as REST provider
  • JAXB and JAX-RS annotations
  • Mime Type for rest API in JSON
like image 816
Maciej Miklas Avatar asked Jan 03 '12 08:01

Maciej Miklas


3 Answers

Try Enunciate.

Enunciate is an engine for dramatically enhancing your Java Web service API. It's simple. You develop your Web service API using standard Java technologies and attach Enunciate to your build process. Suddenly, your Web service API is boasting some pretty impressive features:

  • Full HTML documentation of your services, scraped from your JavaDocs.
  • Client-side libraries (e.g. Java, .NET, iPhone, Ruby, Flex, AJAX, GWT, etc.) for developers who want to interface with your API.
  • Interface Definition Documents (e.g. WSDL, WADL, XML-Schema, etc.)
  • Etc.
like image 55
Marek Avatar answered Sep 19 '22 05:09

Marek


As an alternative to Enunciate, you might also consider MireDot. It grew from a tool we use within our own company and it's free to use for open source projects. It does exactly what you describe: it combines jaxrs annotations and existing javadoc comments to generate a rest api. It works as a maven plugin which you just have to add to your project. Jaxb annotations are not yet supported at the moment of writing, but the tool is under active development and we pick the features to implement based on suggestions/requests/feedback.

like image 45
Yves V. Avatar answered Sep 20 '22 05:09

Yves V.


The Java Compiler APIs allow you to write code that parses Java source and perform your own processing.

Here's an instructional article, which includes information about parsing annotations.

I guess that you can extract the raw information you need using these APIs. However this is going to yield syntactic facts - the REST URLs and actions and parameters, a user would also benefit from additional explanation, which the service author could (should?) provide in Java Doc.

the full solution might be to parse both annotation and java doc and combine the two.

like image 20
djna Avatar answered Sep 22 '22 05:09

djna