Skip to content
Merged
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 @@ -182,7 +182,7 @@ private String itemContent(
.append(itemContent("Schema:", "", indent))
.append(changedMediaType.isCompatible() ? "Backward compatible" : "Broken compatibility")
.append(System.lineSeparator());
if (!changedMediaType.isCompatible()) {
if (!changedMediaType.isCompatible() && changedMediaType.getSchema() != null) {
sb.append(incompatibilities(changedMediaType.getSchema()));
}
return sb.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ private String itemContent(
.append("Schema: ")
.append(changedMediaType.isCompatible() ? "Backward compatible" : "Broken compatibility")
.append(System.lineSeparator());
if (!changedMediaType.isCompatible()) {
if (!changedMediaType.isCompatible() && changedMediaType.getSchema() != null) {
sb.append(incompatibilities(changedMediaType.getSchema()));
}
return sb.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,11 @@ protected String itemContent(String title, String mediaType, MediaType content)
}

protected String itemContent(int deepness, String mediaType, ChangedMediaType content) {
return itemContent("Changed content type", mediaType) + schema(deepness, content.getSchema());
String result = itemContent("Changed content type", mediaType);
if (content.getSchema() != null) {
result += schema(deepness, content.getSchema());
}
return result;
}

protected String schema(ChangedSchema schema) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,16 @@ public void validateAsciiDocRangeStatus() {
+ "\n"
+ "WARNING: API changes broke backward compatibility\n");
}

@Test
public void issue870_renderDoesNotFailWhenSchemaIsNullButExampleChanged() {
AsciidocRender render = new AsciidocRender();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream);
ChangedOpenApi diff =
OpenApiCompare.fromLocations(
"issue-865-null-schema-1.yaml", "issue-865-null-schema-2.yaml");
render.render(diff, outputStreamWriter);
assertThat(outputStream.toString()).isNotBlank();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,16 @@ public void renderShowsWhatsChangedSectionWithCorrectFormattingWhenEndpointIsCha
.contains("What's Changed")
.containsSubsequence("- GET /widgets", "Parameter:", "- Changed query-param-1 in query");
}

@Test
public void issue870_renderDoesNotFailWhenSchemaIsNullButExampleChanged() {
ConsoleRender render = new ConsoleRender();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream);
ChangedOpenApi diff =
OpenApiCompare.fromLocations(
"issue-865-null-schema-1.yaml", "issue-865-null-schema-2.yaml");
render.render(diff, outputStreamWriter);
assertThat(outputStream.toString()).isNotBlank();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,16 @@ public void renderDoesNotFailWhenHTTPStatusCodeIsRange() {
render.render(diff, outputStreamWriter);
assertThat(outputStream.toString()).isNotBlank();
}

@Test
public void issue870_renderDoesNotFailWhenSchemaIsNullButExampleChanged() {
MarkdownRender render = new MarkdownRender();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream);
ChangedOpenApi diff =
OpenApiCompare.fromLocations(
"issue-865-null-schema-1.yaml", "issue-865-null-schema-2.yaml");
render.render(diff, outputStreamWriter);
assertThat(outputStream.toString()).isNotBlank();
}
}
Loading