Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Spring REST Docs - Documenting RESTful APIs usi...

Andreas Evers
November 09, 2015

Spring REST Docs - Documenting RESTful APIs using your tests

Writing documentation for truly RESTful APIs is often done by Swagger or similar tools. However, they provide no support for documenting hypermedia elements, they are URI-centric, leaky and intrusive.

Wouldn't it be nice if your documentation could fail your build in case it gets out-of-date with your production code? Wouldn't you want to write your documentation using a format which is designed for writing? Can't there be a tool which documents your code without using the actual implementation?

Meet Spring REST Docs.

REST Docs allows you to write your documentation as part of your integration tests. In case your documentation doesn't match with your integration test result, your test will fail. This ensures accurate documentation while avoiding the need to put annotations on your production code. It uses the same integration tests to generate snippets, both for request and response bodies, and for hypermedia links. As a writing format it uses asciidoc which is designed for writing.

Andreas Evers

November 09, 2015
Tweet

More Decks by Andreas Evers

Other Decks in Technology

Transcript

  1. WHOAMI • Work for Ordina Belgium • Open source enthusiast

    • Spring contributor • Speaker • Technical lead & coding architect @ Proximus • Marathon runner
  2. Snippets for - Hypermedia links - Request & response payloads

    - Request parameters - Path parameters - HTTP headers