Merge branch '1.2.x'
This commit is contained in:
@@ -31,6 +31,9 @@ import org.springframework.restdocs.templates.TemplateResourceResolver;
|
||||
import org.springframework.restdocs.templates.mustache.MustacheTemplateEngine;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.springframework.restdocs.payload.PayloadDocumentation.beneathPath;
|
||||
@@ -446,6 +449,17 @@ public class RequestFieldsSnippetTests extends AbstractSnippetTests {
|
||||
.build());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void typeDeterminationDoesNotSetTypeOnDescriptor() throws IOException {
|
||||
this.snippets.expectRequestFields()
|
||||
.withContents(tableWithHeader("Path", "Type", "Description").row("`a.b`",
|
||||
"`Number`", "one"));
|
||||
FieldDescriptor descriptor = fieldWithPath("a.b").description("one");
|
||||
new RequestFieldsSnippet(Arrays.asList(descriptor)).document(this.operationBuilder
|
||||
.request("http://localhost").content("{\"a\": {\"b\": 5}}").build());
|
||||
assertThat(descriptor.getType(), is(nullValue()));
|
||||
}
|
||||
|
||||
private String escapeIfNecessary(String input) {
|
||||
if (this.templateFormat.equals(TemplateFormats.markdown())) {
|
||||
return input;
|
||||
|
||||
@@ -31,6 +31,9 @@ import org.springframework.restdocs.templates.TemplateResourceResolver;
|
||||
import org.springframework.restdocs.templates.mustache.MustacheTemplateEngine;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.springframework.restdocs.payload.PayloadDocumentation.beneathPath;
|
||||
@@ -457,6 +460,17 @@ public class ResponseFieldsSnippetTests extends AbstractSnippetTests {
|
||||
.build());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void typeDeterminationDoesNotSetTypeOnDescriptor() throws IOException {
|
||||
this.snippets.expectResponseFields()
|
||||
.withContents(tableWithHeader("Path", "Type", "Description").row("`id`",
|
||||
"`Number`", "one"));
|
||||
FieldDescriptor descriptor = fieldWithPath("id").description("one");
|
||||
new ResponseFieldsSnippet(Arrays.asList(descriptor)).document(
|
||||
this.operationBuilder.response().content("{\"id\": 67}").build());
|
||||
assertThat(descriptor.getType(), is(nullValue()));
|
||||
}
|
||||
|
||||
private String escapeIfNecessary(String input) {
|
||||
if (this.templateFormat.equals(TemplateFormats.markdown())) {
|
||||
return input;
|
||||
|
||||
Reference in New Issue
Block a user