I am looking for tools to generate documentation and client code (in various languages such as Java, Scala, Ruby, JavaScript, etc.) using annotation on my JAX-RS REST service. Ideally, I'd like to run a post-build tool that, given the package where my REST service classes live, will generate both documentation and code using (custom) annotation on the source code and some minimal configuration. Kind of what Swagger does but without having to deploy its servlet and all that stuff. I tried bending swagger-codegen to do this with no luck. The documentation is small and fragmented and the examples are few. I can't imagine this isn't a solved problem. Ideas?
If you're using Jersey then it will automatically generate WADL from your JAX-RS services. You can then use wadl2java to create client stubs.
You can use CXF to generate client code from your annotated server side code. See http://blog.rjsang.com/2014/01/using-cxf-as-jax-rs-server-and-client.html.
In the example CXF is both the server and client but it doesn't have to be as long as you are using JAX-RS standard annotations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With