Spring REST Doc v1.1.0 發布,RESTful 服務文檔管理

jopen 8年前發布 | 19K 次閱讀

Spring REST Docs 幫助你管理 RESTful 服務文檔,使用 Asciidoctor 來編寫文檔,使用 Spring MVC Test. 自動生成片段。

更新日志

Highlights

REST Assured

As an alternative to the lightweight server-less documentation generation offered by Spring Framework’s MockMvc, you can now use REST Assured to test and document your RESTful services. This opens up Spring REST Docs to all four corners of the JVM and beyond, allowing you to document anything that you can access via HTTP.

The samples now include an app that is documented using REST Docs, built using Grails, and tested using Spock. A third-party sample that uses REST Docs to document an API implemented using Ratpack is also available. My thanks to Jenn Strater who wrote both samples.

Markdown

Support has been added for generating Markdown snippets. On its own, Markdown isn’t as capable as Asciidoctor, but can work very well when combined with existing documentation toolchains such as Slate.

TestNG

In addition to the existing support for using JUnit, you can now use Spring REST Docs withTestNG.

Reusable snippets

Snippets can now be created once with some common configuration and then reused. This reduces repetition when documenting common parts on an API, such as self links. My thanks to Marcel Overdijk whose feedback and pull requests have significantly improved this new feature.

Relaxed snippets

By default, Spring REST Docs will cause your tests to fail if you’ve neglected to document something or if you’ve attempted to document something that doesn’t exist. This is great for detailed API documentation, but can be restrictive when documenting a scenario where you want to focus on a specific part of a request or response. Rather than having to explicitly ignore everything that you don’t want to document, you can now use relaxed snippets for documenting links, request and response fields, and request and path parameters.

下載

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!