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

support nested controllers #14

Closed
aeisele opened this issue Aug 24, 2012 · 2 comments
Closed

support nested controllers #14

aeisele opened this issue Aug 24, 2012 · 2 comments

Comments

@aeisele
Copy link

aeisele commented Aug 24, 2012

Hi,

I have controllers that are mapped like this:

@Controller
@RequestMapping("/foo")
public class FooController {

    @ResponseBody
    @RequestMapping(method = RequestMethod.GET)
    public String getFoo() {
        return "foo";
    }

}

@Controller
@RequestMapping("/foo/bar")
public class BarController {

    @ResponseBody
    @RequestMapping(method = RequestMethod.GET)
    public String getBar() {
        return "bar";
    }

}

This results in spring endpoints like:

GET /foo
GET /foo/bar

Swagger-springmvc seems to group swagger "APIs" on a per controller level. But for my usecase to work in swagger I guess it would need to somehow merge both controllers into the "/foo" api. Therefore at the moment only my "root" controllers are browsable in swagger-ui as springmvc does not call the DocumentationController.getApiDocumentation if apiName contains slashes like it would be the case with "/foo/bar".

Is something like this possible with swagger-springmvc? I can't simply merge all controller classes as the web service sports a lot of endpoints that are grouped hierarchically.

@mnimer
Copy link

mnimer commented Oct 3, 2012

I had a similar problem, if the primary request mapping has slashes swagger can't pull the documentation for the class.

this breaks
@RequestMapping("/image/info")
public class ImageInfoController

but this would work
@RequestMapping("/info")
public class ImageInfoController

@dilipkrish
Copy link
Member

@mnimer This issue should now be fixed.

@aeisele currently it does not support your use case. I will say that your need is very specific and may not be prioritized but the library is now extensible so that you could write your own Filters to generate the shape of the documentation you need. There are different extensibility points that allow you to write filters at the documentation, endpoint, operation and even parameter levels that would let you achieve what you need.

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

3 participants