Open Polve opened 7 years ago
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.
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.
I made some sample apps and got them working with Spring Cloud Stream (and Contracts): https://github.com/dsyer/spring-restdocs-messaging
Controllers using MessageMapping(s) instead of rest endpoint have very similar requirements for documentation. Could spring-restdocs be used for those controllers too?