Merge branch '1.2.x'
This commit is contained in:
@@ -158,6 +158,20 @@ public class RequestFieldsSnippetTests extends AbstractSnippetTests {
|
||||
.content("{\"a\": 5, \"b\": 4}").build());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void allUndocumentedFieldsContinueToBeIgnoredAfterAddingDescriptors()
|
||||
throws IOException {
|
||||
this.snippets.expectRequestFields()
|
||||
.withContents(tableWithHeader("Path", "Type", "Description")
|
||||
.row("`b`", "`Number`", "Field b")
|
||||
.row("`c.d`", "`Number`", "Field d"));
|
||||
|
||||
new RequestFieldsSnippet(Arrays.asList(fieldWithPath("b").description("Field b")),
|
||||
true).andWithPrefix("c.", fieldWithPath("d").description("Field d"))
|
||||
.document(this.operationBuilder.request("http://localhost")
|
||||
.content("{\"a\":5,\"b\":4,\"c\":{\"d\": 3}}").build());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void missingOptionalRequestField() throws IOException {
|
||||
this.snippets.expectRequestFields()
|
||||
|
||||
@@ -134,6 +134,21 @@ public class ResponseFieldsSnippetTests extends AbstractSnippetTests {
|
||||
.content("{\"a\": 5, \"b\": 4}").build());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void allUndocumentedFieldsContinueToBeIgnoredAfterAddingDescriptors()
|
||||
throws IOException {
|
||||
this.snippets.expectResponseFields()
|
||||
.withContents(tableWithHeader("Path", "Type", "Description")
|
||||
.row("`b`", "`Number`", "Field b")
|
||||
.row("`c.d`", "`Number`", "Field d"));
|
||||
|
||||
new ResponseFieldsSnippet(
|
||||
Arrays.asList(fieldWithPath("b").description("Field b")), true)
|
||||
.andWithPrefix("c.", fieldWithPath("d").description("Field d"))
|
||||
.document(this.operationBuilder.response()
|
||||
.content("{\"a\":5,\"b\":4,\"c\":{\"d\": 3}}").build());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void responseFieldsWithCustomAttributes() throws IOException {
|
||||
TemplateResourceResolver resolver = mock(TemplateResourceResolver.class);
|
||||
|
||||
Reference in New Issue
Block a user