1

I need your help with a interesting problem: I want to use swagger for easy API Documentation and I got two classes: a versionController and a PersonController. The version controller has 2 annotations:

- @RestController
- @Requestmapping(value = "/version")

While the person controller has one annotation on top:

-@RepositoryRestController

And has the following annotation on the create Person Method:

-@RequestMapping(method = RequestMethod.POST, value = "/persons")
-@RequestMapping(value = "/persons/{id}", method = RequestMethod.PUT)

My question is this. Why is versionController visible in swagger and is PersonController not? I mean, personcontroller has the mappings right, so swagger can 'see' it? The source documentation didn't had any information on it, so I hope you guys/girls can help me out. Thanks in advance!

Greetings, Frederick

  • Are you using Springfox or something else to generate your Swagger documentation? I am going to guess that the issue is that `@RepositoryRestController` is not picked up as a Controller annotation, since it does not itself contain the `@Controller` annotation, whereas `@RestController` does. – woemler Mar 03 '16 at 18:57
  • I am using springfox woelmer, And what you said sounds reasonble, however, I was wondering if it's possible somehow to generate the swagger documentation. – frederick van der meulen Mar 04 '16 at 06:51
  • Unfortunately, I don't have an answer for you. This seems like something Springfox should support, though, so I'd suggest asking the devs about it: https://github.com/springfox/springfox/issues – woemler Mar 04 '16 at 14:13
  • Then I shall ask the developers, anyway, thanks for your time! – frederick van der meulen Mar 04 '16 at 15:38

1 Answers1

0

4 years later, in Springfox, support is still missing for @RepositoryRestController.

See this issue - https://github.com/springfox/springfox/issues/2656

A workaround is to use both @RepositoryRestController and @RestController annotations on the controller class.

Vlad Dinulescu
  • 1,173
  • 1
  • 14
  • 24