Skip to content

Spring REST Docs 3.0 Release Notes

Andy Wilkinson edited this page Sep 9, 2024 · 4 revisions

New and noteworthy

Documenting Form Parameters

Support for documenting form parameters has been added. Please refer to the reference documentation for further details. This new support partially replaces the support for documenting request parameters which mixed query and form parameters together.

Documenting Query Parameters

Support for documenting query parameters has been added. Please refer to the reference documentation for further details. This new support partially replaces the support for documenting request parameters which mixed query and form parameters together.

Documenting Request and Response Cookies

Support for documenting request and response cookies has been added. Please refer to the reference documentation for further details.

Body Snippets' Language

The language is now specified automatically in request and response body snippets. It is determined using the Content-Type of the request or response. For example, a response whose Content-Type is application/json will have the language of its body snippet set to json.

spring-restdocs-bom

Spring REST Docs now publishes a bill-of-materials (bom). The bom’s coordinates are org.springframework.restdocs:spring-restdocs-bom.

Upgrading

Request Parameters Support Removed

Support for documenting request parameters has been removed. Request parameters are a server-side construct of the Servlet API that mix form and query parameters together. To provide accurate, client-focussed documentation, form and query parameters should be documented separately.

As a result of this change, when using Spring Framework’s MockMvc, you may have to update how your tests send parameters to your API. Instead of using param to populate the server-side map of request parameters, queryParam (for query parameters) or application/x-www-form-urlencoded body content (for form parameters) should be used instead.

Pre-processing Support to Modify Parameters Removed

Support for pre-processing a request to modify its parameters has been removed. Where possible, the request should be made with the required parameters from the outset, either in its query string or in its form URL encoding body. Where this is not possible, its form URL encoded body can be modified prior to it being documented to change the parameters that it contains.

Spring Framework 6.0

Spring REST Docs 3.0 requires Spring Framework 6.0.

REST Assured 5.2

Spring REST Docs' REST Assured integration now requires REST Assured 5.2 and now resides in the org.springframework.restdocs.restassured package.

Java 17

Spring REST Docs now requires Java 17 or later.

Deprecations from Spring REST Docs 2.0

Classes and methods that were deprecated in Spring REST Docs 2.0 have been removed.