Add a test that shows problem with sometimes null field within an array
Closes gh-399
This commit is contained in:
committed by
Andy Wilkinson
parent
dff9062a32
commit
288ebf771a
@@ -378,6 +378,23 @@ public class ResponseFieldsSnippetTests extends AbstractSnippetTests {
|
||||
.build());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void responseWithSomeNullOcurrencesOfAField() throws IOException {
|
||||
this.snippets.expectResponseFields()
|
||||
.withContents(tableWithHeader("Path", "Type", "Description")
|
||||
.row("`assets[].name`", "`String`", "one"));
|
||||
new ResponseFieldsSnippet(Arrays.asList(
|
||||
fieldWithPath("assets[].name").description("one")))
|
||||
.document(this.operationBuilder.response()
|
||||
.content(
|
||||
"{\"assets\": [" +
|
||||
"{\"name\": \"sample1\"}, " +
|
||||
"{\"name\": null}, " +
|
||||
"{\"name\": \"sample2\"}]}")
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
private String escapeIfNecessary(String input) {
|
||||
if (this.templateFormat.equals(TemplateFormats.markdown())) {
|
||||
return input;
|
||||
|
||||
Reference in New Issue
Block a user