Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@RestDoc should be allowed on classes (which model subresources) #18

Closed
koppor opened this issue Sep 5, 2013 · 4 comments
Closed

@RestDoc should be allowed on classes (which model subresources) #18

koppor opened this issue Sep 5, 2013 · 4 comments

Comments

@koppor
Copy link

koppor commented Sep 5, 2013

I'm using classes as subresources, which are instantiated by the parent resource. I tried to annotate that resource class with @RestDoc(resourceDescription = "..."), but the location class is not allowed for @RestDoc.

@hoegertn
Copy link
Owner

hoegertn commented Sep 5, 2013

RestDoc resources have to be callable endpoints so only methods can be annotated. Subresources are only parts of the endpoint.

@koppor
Copy link
Author

koppor commented Sep 6, 2013

Maybe, I don't get, what a callable endpoint is :). I have the URL http://.../winery/winerypropertiesdefinition, where I can POST to. Is that an endpoint?

public class WinerysPropertiesDefinitionResource {

    @POST
    @RestDoc(methodDescription = "switches the mode to winery properties")
    public Response onPost() {
        // ...
    }

}

That resource is created by the parent resource.

    @Path("winery/")
    public WinerysPropertiesDefinitionResource getWinerysPropertiesDefinitionResource() {
        return new WinerysPropertiesDefinitionResource();
    }

I see that I could make the annotation there. I currently think it is better positioned at the place where the actual implementation (or interface definition ;)) resides.

@hoegertn
Copy link
Owner

hoegertn commented Sep 6, 2013

I see the problem, I think I will split resourceDescription and methodDescription into separate annotations. That may solve the problem.

@koppor
Copy link
Author

koppor commented Sep 6, 2013

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants