spring-projects / spring-restdocs

Test-driven documentation for RESTful services
https://spring.io/projects/spring-restdocs
Apache License 2.0
1.16k stars 733 forks source link

Provide a fluent API for snippet configuration #192

Open rhuss opened 8 years ago

rhuss commented 8 years ago

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 ;-)

wilkinsona commented 6 years ago

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.