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

Provide a fluent API for snippet configuration

Open rhuss opened this issue 9 years ago • 1 comments

Since REST assured is based on a fluent API it would be awesome if Spring REST docs could provide a fluent (builder) API in addition to the varargs based approach.

(haven't looked in the Spring MVC usage pattern yet).

For example, instead of

responseFields( 
            fieldWithPath("contact").description("The user's contact details"), 
            fieldWithPath("contact.email").description("The user's email address"))

maybe sth like

request()
    .param("id","User's id")
response()
    .field("contact","The user's contact details")
    .field("contact.email","The user's email address")

Just a minor enhancement but would probably better align the paradigms. Nothing serious ;-)

rhuss avatar Feb 03 '16 22:02 rhuss

I'd like to investigate this one as part of 2.1. I'm interested in what's possible with a Java 8 baseline and lambdas.

wilkinsona avatar Mar 28 '18 10:03 wilkinsona