1

We have several methods in a spring REST API that designed to handle requests that fit our API exactly, or allow for a trailing slash. We use this annotation:

@RequestMapping(value = {"", "/"}, produces = {"application/json"}, method = RequestMethod.POST)
@ResponseBody
public ClassName ...

When enunciate / swagger docs are generated, they have two items generated ("domain.com/api" and "domain.com/api/"), I am wondering if there is a way to tell enunciate to only show one?

crobicha
  • 1,674
  • 1
  • 16
  • 21
  • have you tried removing one of the two paths @RequestMapping(value = {""} or @RequestMapping(value = {"/"} ? – reos Jun 20 '16 at 20:36
  • I'm trying not to change the functionality of my app, just to keep from having duplicate fields in the description – crobicha Jun 21 '16 at 13:47

1 Answers1

0

Consider options for handling the mapping of "/api" and "/api/" at a deeper level instead of defining two endpoints in your Java class. I am sure there are many ways to map these as aliases, such as in web.xml.

Enunciate has the ability to ignore an entire class using the ignore annotation but this would require you to restructure your class definitions (in a beautiful and reusable way) so the two endpoints are handled by different classes, and then one you can annotate one with @Ignore.

Megan D
  • 379
  • 3
  • 13