sebastiandaschner blog


Feature list of JAX-RS Analyzer (v0.2)

monday, march 02, 2015

Yesterday I published my JAX-RS Analyzer tool which creates REST documentation for JAX-RS projects by analyzing Java bytecode. Following features are included in the current v0.2 version:

  • JAX-RS 2.0 annotations and features like annotation inheritance, sub resource locators, etc.

  • Response return types (and the corresponding method calls in the resource methods)

  • JSON-P API (e.g. methods with return type JsonObject or JSON-P contained in Response#entity())

  • Analysis of POJO responses (incl. some JAXB features)

  • Analysis of JDK 1.8 lambdas (use of lambda expressions is no problem)

  • Swagger API JSON and plain text backend format

These features are not yet included:

  • More JAXB features (currently only XmlAccessorType#PUBLIC_MEMBER supported)

  • Analysis of @Asynchronous methods with AsyncResponse return types

  • JAX-RS injected fields (on class level, currently injection as method parameters supported)

  • Support of thrown WebApplicationException in the code

  • More backend formats (e.g. AsciiDoc)

The JAX-RS Analyzer tool and the Maven Plugin is available on GitHub.

The following overview has been generated for my TODO’s application:

REST resources:

POST resources/filters:
 Request:
  Accept: application/json
  Request Body: de.sebastian_daschner.todos.business.tasks.entity.Filter
   application/json: {"contexts":["string"],"priorityThreshold":0,"text":"string"}
 Response:
  Content-Type: application/json
  Status Codes: 200
   Response Body: de.sebastian_daschner.todos.business.tasks.entity.Task (application/json):
[{"contexts":["string"],"priority":0,"id":0,"name":"string","dueDate":"date","updated":"date"}]

GET resources/tasks:
 Request:
  Accept: application/json
 Response:
  Content-Type: application/json
  Status Codes: 200
   Response Body: de.sebastian_daschner.todos.business.tasks.entity.Task (application/json):
[{"contexts":["string"],"priority":0,"id":0,"name":"string","dueDate":"date","updated":"date"}]

POST resources/tasks:
 Request:
  Accept: application/json
  Request Body: de.sebastian_daschner.todos.business.tasks.entity.Task
   application/json: {"contexts":["string"],"priority":0,"id":0,"name":"string","dueDate":"date","updated":"date"}
 Response:
  Content-Type: application/json
  Status Codes: 201
   Header: Location

GET resources/tasks/{id}:
 Request:
  Accept: application/json
  Path Param: id, long
 Response:
  Content-Type: application/json
  Status Codes: 200
   Response Body: de.sebastian_daschner.todos.business.tasks.entity.Task (application/json):
{"contexts":["string"],"priority":0,"id":0,"name":"string","dueDate":"date","updated":"date"}

PUT resources/tasks/{id}:
 Request:
  Accept: application/json
  Request Body: de.sebastian_daschner.todos.business.tasks.entity.Task
   application/json: {"contexts":["string"],"priority":0,"id":0,"name":"string","dueDate":"date","updated":"date"}
  Path Param: id, long
 Response:
  Content-Type: application/json
  Status Codes: 204

DELETE resources/tasks/{id}:
 Request:
  Accept: application/json
  Path Param: id, long
 Response:
  Content-Type: application/json
  Status Codes: 204

Feedback, bug reports and ideas for improvement are very welcome!

 

Found the post useful? Subscribe to my newsletter for more free content, tips and tricks on IT & Java: