spring-projects / spring-data-rest

Simplifies building hypermedia-driven REST web services on top of Spring Data repositories
https://spring.io/projects/spring-data-rest
Apache License 2.0
905 stars 558 forks source link

Swagger support [DATAREST-410] #787

Open spring-projects-issues opened 9 years ago

spring-projects-issues commented 9 years ago

Adrian Kelly opened DATAREST-410 and commented

I'm one of the core contributors on swagger-springmvc (https://github.com/martypitt/swagger-springmvc). We've had some requests to support SDR (https://github.com/martypitt/swagger-springmvc/issues/238) and was wondering how we might go about this. Right now we infer the paths, parameter types, model types and other meta data from a combination of Spring MVC's RequestMappingHandlerMapping's, HandlerMethod's and a number of the org.springframework.web.bind.annotation annotations applied to controllers. Wondering if it is possible to hook into SDR to infer the same type of information needed for swagger? Does SDR maintain a cache of the api paths, their parameters and returned models types?


2 votes, 4 watchers

spring-projects-issues commented 9 years ago

Oliver Drotbohm commented

You might wanna hook into the ResourceMappings instance that Spring Data REST exposes, which has basically all information about the resource mappings. However - and to phrase it politely - we think that URI based documentation of REST web services is basically subverting fundamental principles of REST. Hence, our focus is on hypermedia and we consider it bad practice to expose URI structures to clients, esp. for documentation purposes.

Also, be aware that because of this, we assume to be able to change the URI space and structure that Spring Data REST exposes at any time. Our API is the link relations and resource types that we expose

spring-projects-issues commented 6 years ago

Dudi Maroshi commented

Few years past, hope you changed your perception about the usefulness of Swagger. Please consider Swagger auto documentation to the REST api