Skip to content

Fix NPE when only description changed in request content #65

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

Merged
merged 3 commits into from
Feb 19, 2019
Merged
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 @@ -104,6 +104,7 @@ protected String listEndpoints(List<ChangedOperation> changedOperations) {
if (operation.resultRequestBody().isDifferent()) {
details
.append(titleH5("Request:"))
.append(metadata("Description", operation.getRequestBody().getDescription()))
.append(bodyContent(operation.getRequestBody().getContent()));
}
if (operation.resultApiResponses().isDifferent()) {
Expand Down Expand Up @@ -212,6 +213,9 @@ protected String itemHeader(String title, String mediaType, String description)
}

protected String bodyContent(String prefix, ChangedContent changedContent) {
if (changedContent == null) {
return "";
}
StringBuilder sb = new StringBuilder("\n");
sb.append(listContent(prefix, "New content type", changedContent.getIncreased()));
sb.append(listContent(prefix, "Deleted content type", changedContent.getMissing()));
Expand Down Expand Up @@ -499,7 +503,7 @@ protected String metadata(String beginning, String name, ChangedMetadata changed
if (changedMetadata == null) {
return "";
}
if (isUnchanged(changedMetadata) && showChangedMetadata) {
if (!isUnchanged(changedMetadata) && showChangedMetadata) {
return format(
"Changed %s:\n%s\nto:\n%s\n\n",
name,
Expand Down