15

Has anyone configured swagger with spring-data-rest. I know swagger has DocumentationConfig class which scans for all spring-mvc request mappings. But, how to use that for spring-data-rest as there are no explicit request mappings defined. Any help in this regard is greatly appreciated. Also, like to know, if there are any other documentation framework which supports Spring-Data-Rest.

user1917034
  • 401
  • 5
  • 11
  • As you mentioned already Spring MVC does not support Spring Data Rest. Recently someone opened an issue on [Github](https://github.com/martypitt/swagger-springmvc/issues/238#issuecomment-38524612) for this. Hopefully we will get support for Spring Data Rest soon. – ksokol Mar 29 '14 at 17:52
  • It's me who has opened the issue on Github :-) They have asked to write the implementation for Spring-Data-Rest – user1917034 Mar 31 '14 at 15:01
  • Ok. Good to know that :-) – ksokol Apr 01 '14 at 11:11

3 Answers3

6

In version greater than 2.6.0 of SpringFox, support for spring data rest was added (but it's still in incubation). In order to add support for Spring Data Rest, you need to include the dependency below:

<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-data-rest</artifactId>
    <version>2.6.1</version>
</dependency>
Claudio Tasso
  • 417
  • 5
  • 13
4

This has been lingering out there a while, but as others have mentioned, there are (still) no Swagger implementations that support Spring Data Rest. However, Spring Data Rest does follow the HAL specification, and the HAL Browser integrated really seamlessly with any SDR project. Coupled together with the newer versions of SDR that expose ALPS metadata, this should be very sufficient for your documentation goals.

bvulaj
  • 5,023
  • 5
  • 31
  • 45
  • But ALPS is not supported in Spring MVC controller. This provides an inconsistency. Is there a solution which can be there for both? – Naresh Mar 07 '16 at 04:33
0

Answer for your second question: AsciiDoctor combined with Spring REST Docs/RestAssured can be neat way of documenting SDR endpoints. It does require a bit of manual effort though, as the only automated part will be the creation of snippets. These can then be loaded into your AsciiDoc files.

Coos
  • 1