Add support for documenting a portion of a request or response payload
Closes gh-312
This commit is contained in:
@@ -18,7 +18,9 @@ package com.example;
|
||||
|
||||
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||
|
||||
import static org.springframework.restdocs.payload.PayloadDocumentation.beneathPath;
|
||||
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
|
||||
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
|
||||
|
||||
public class Payload {
|
||||
|
||||
@@ -31,4 +33,12 @@ public class Payload {
|
||||
// end::book-descriptors[]
|
||||
}
|
||||
|
||||
public void customSubsectionId() {
|
||||
// tag::custom-subsection-id[]
|
||||
responseFields(beneathPath("weather.temperature").withSubsectionId("temp"),
|
||||
fieldWithPath("high").description("…"),
|
||||
fieldWithPath("low").description("…"));
|
||||
// end::custom-subsection-id[]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user