ryankennedy / swagger-jaxrs-doclet

Apache License 2.0
87 stars 136 forks source link

Merge methods of root resources #74

Open enriquerodbe opened 10 years ago

enriquerodbe commented 10 years ago

If you have to root resources like:

@Path("/resource")
public interface ResourceInterfaceOne {
    @GET
    @Path("/foo")
    void doSomething();
}

@Path("/resource")
public interface ResourceInterfaceTwo {
    @POST
    @Path("/bar")
    void doSomething();
}

The doclet will generate two json files with the same name (resource.json) and it will break the UI.

One solution would be taking all the methods from both resources and combining them into a single one.

conorroche commented 10 years ago

ive a fork that also supports this https://github.com/Carma-Public/swagger-jaxrs-doclet using the -crossClassResources option, this fork is for swagger 1.2 btw.

bobpiece commented 10 years ago

@conorroche indeed your "-crossClassResources" option resolves problem, but it doesn't work for projects where you have both: cross class resources and sub class resources. As long as CrossClassApiParser have no support for sub-resources, I would recommend to enhance older parser with cross class resources support(solution provided by @enriquerodbe).

conorroche commented 10 years ago

@bobpiece thanks i have that (support for sub resources on the cross class parser) on my roadmap but will bring it forward to the 1.0 release and try to work on it in the next couple of days

conorroche commented 10 years ago

i have now committed support for sub resources to the cross class parser and removed the old one so there is now a single parser. the old doclet option to choose the cross class parser is no longer necessary. I have also added test cases for sub resource classes, combinations of sub resources and cross class resources and for the original example given by @enriquerodbe