Skip to content

Commit

Permalink
Propagate ignoreUndocumentedParamteres with .and()
Browse files Browse the repository at this point in the history
See gh-676
  • Loading branch information
bric3 authored and wilkinsona committed Sep 1, 2020
1 parent b02fcbe commit eac7d67
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ protected final Map<String, ParameterDescriptor> getParameterDescriptors() {
return this.descriptorsByName;
}

protected final boolean isIgnoreUndocumentedParameters() {
return ignoreUndocumentedParameters;
}

/**
* Returns a model for the given {@code descriptor}.
* @param descriptor the descriptor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public RequestParametersSnippet and(ParameterDescriptor... additionalDescriptors
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());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ public void additionalDescriptors() throws IOException {
.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"))
Expand Down

0 comments on commit eac7d67

Please sign in to comment.