Skip to content

ignoreUndocumentedParamters is lost when using and() on PathParametersSnippet and RequestParametersSnippet #676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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