Skip to end of metadata
Go to start of metadata

Let's say you'd love to use Enunciate's documentation features and you've got a REST API, but you're not using JAX-RS. You've got a couple of options.

Option 1: Create some interfaces without an implementation

One thing you could do is just create some interfaces that define your API in terms of JAX-RS, but don't supply an associated implementation class. Enunciate will pick up on your interfaces and generate the associated documentation.

Option 2: Apply "hints" to your existing code

The problem with option 1 is that you have to maintain the metadata in a separate place from where you maintain your API. There is a higher probability that the documentation will be out-of-sync.

The second option is that you can supply Enunciate with the necessary JAX-RS metadata using the @org.codehaus.enunciate.contract.jaxrs.ResourceMethodSignature annotation. Here's an example of how you might use this annotation:

  • No labels

1 Comment

  1. Hi Ryan,

    Could you do me a favor? I am meeting an exception below during invoking enunciate in ant. I don't know where is wrong. Can you point it out? Thanks so much.


    @ResourceMethodSignature(output = F4FeeModel.class, pathParams = {@PathParam("recordIds")}, queryParams = {@QueryParam("fields")})
    public ResponseModel getFeeItemsByCapID(@PathParam("recordIds") String recordIds,
    @QueryParam("fields") String fields) throws Exception



    java.lang.IllegalStateException: D:\AA7.2.0\main-dev\biz\modules\rest-apis\java\com\accela\restapis\jaxrs\agency\service\ the el
    ement 'value' must have a value specified.
    at net.sf.jelly.apt.decorations.declaration.DecoratedAnnotationMirror.<init>(
    at net.sf.jelly.apt.decorations.DeclarationDecorator.decorate(
    at net.sf.jelly.apt.decorations.DeclarationDecorator.decorateAnnotationMirrors(
    at net.sf.jelly.apt.decorations.declaration.DecoratedDeclaration.getAnnotationMirrors(
    at net.sf.jelly.apt.decorations.declaration.DecoratedDeclaration.getAnnotations(
    at net.sf.jelly.apt.decorations.declaration.DecoratedDeclaration.getAnnotation(
    at org.codehaus.enunciate.contract.jaxrs.ResourceParameter.<init>(
    at org.codehaus.enunciate.contract.jaxrs.ExplicitResourceParameter.<init>(
    at org.codehaus.enunciate.contract.jaxrs.ResourceMethod.loadResourceParameters(
    at org.codehaus.enunciate.contract.jaxrs.ResourceMethod.<init>(
    at org.codehaus.enunciate.contract.jaxrs.Resource.getResourceMethods(
    at org.codehaus.enunciate.contract.jaxrs.Resource.<init>(
    at org.codehaus.enunciate.contract.jaxrs.RootResource.<init>(
    at org.codehaus.enunciate.apt.EnunciateAnnotationProcessor.getRootModel(
    at org.codehaus.enunciate.apt.EnunciateAnnotationProcessor.process(