Propagate ignoreUndocumentedParamteres with .and()
See gh-676
This commit is contained in:
committed by
Andy Wilkinson
parent
b02fcbee6a
commit
eac7d67c4e
@@ -148,6 +148,10 @@ public abstract class AbstractParametersSnippet extends TemplatedSnippet {
|
||||
return this.descriptorsByName;
|
||||
}
|
||||
|
||||
protected final boolean isIgnoreUndocumentedParameters() {
|
||||
return ignoreUndocumentedParameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a model for the given {@code descriptor}.
|
||||
* @param descriptor the descriptor
|
||||
|
||||
@@ -133,7 +133,7 @@ public class RequestParametersSnippet extends AbstractParametersSnippet {
|
||||
public RequestParametersSnippet and(List<ParameterDescriptor> additionalDescriptors) {
|
||||
List<ParameterDescriptor> combinedDescriptors = new ArrayList<>(getParameterDescriptors().values());
|
||||
combinedDescriptors.addAll(additionalDescriptors);
|
||||
return new RequestParametersSnippet(combinedDescriptors, this.getAttributes());
|
||||
return new RequestParametersSnippet(combinedDescriptors, this.getAttributes(), this.isIgnoreUndocumentedParameters());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -153,6 +153,15 @@ public class RequestParametersSnippetTests extends AbstractSnippetTests {
|
||||
.is(tableWithHeader("Parameter", "Description").row("`a`", "one").row("`b`", "two"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void additionalDescriptorsWithRelaxedRequestParameters() throws IOException {
|
||||
RequestDocumentation.relaxedRequestParameters(parameterWithName("a").description("one"))
|
||||
.and(parameterWithName("b").description("two")).document(this.operationBuilder
|
||||
.request("http://localhost").param("a", "bravo").param("b", "bravo").param("c", "undocumented").build());
|
||||
assertThat(this.generatedSnippets.requestParameters())
|
||||
.is(tableWithHeader("Parameter", "Description").row("`a`", "one").row("`b`", "two"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void requestParametersWithEscapedContent() throws IOException {
|
||||
RequestDocumentation.requestParameters(parameterWithName("Foo|Bar").description("one|two"))
|
||||
|
||||
Reference in New Issue
Block a user