spring-restdocs icon indicating copy to clipboard operation
spring-restdocs copied to clipboard

Support for Messaging controllers

Open Polve opened this issue 8 years ago • 3 comments

Controllers using MessageMapping(s) instead of rest endpoint have very similar requirements for documentation. Could spring-restdocs be used for those controllers too?

Polve avatar Mar 26 '17 09:03 Polve

There's nothing available out-of-the box for this, but I'm not against adding something. The name REST Docs is already stretched as you can document any HTTP-based API not just those that are RESTful. Stretching things further to include @MessageMapping-based controller doesn't seem unreasonable to me.

It would be interesting to see how far things could get by writing a ChannelInterceptorAdapter subclass and turning the messages it intercepts into a REST Docs Operation. It'll break down quite quickly in some areas (pub-sub vs request-response, for example), but I think it may still be a useful exercise.

wilkinsona avatar Mar 27 '17 08:03 wilkinsona

A ChannelInterceptorAdapter could cover Spring Integration as well, which would be neat. Spring Cloud Contract already has support for "stubs" on messages, but not the documentation part, so a generic messaging adapter (perhaps something that can cover Spring AMQP and Spring Kafka as well) would be awesome.

dsyer avatar Oct 11 '17 11:10 dsyer

I made some sample apps and got them working with Spring Cloud Stream (and Contracts): https://github.com/dsyer/spring-restdocs-messaging

dsyer avatar Jan 30 '18 09:01 dsyer