Skip to content

Commit

Permalink
Fine tuning for std reporter + doc extension
Browse files Browse the repository at this point in the history
  • Loading branch information
galovics committed Oct 1, 2023
1 parent 0b845d1 commit 47b2a16
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
17 changes: 12 additions & 5 deletions src-docs/src/configuration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,18 @@ Gradle configuration [here](../gradle/README.md#customizing-reporting).
An example JSON report looks the following:
```json
{
"pathDeletedBreakingChange" : [ {
"path" : "/pet",
"method" : "POST",
"message" : "Path /pet POST has been deleted"
} ]
"info": {
"title": "Example API title",
"description": "API description",
"version": "1.0.0"
},
"breakingChanges": {
"pathDeletedBreakingChange" : [ {
"path" : "/pet",
"method" : "POST",
"message" : "Path /pet POST has been deleted"
} ]
}
}
```
In case of no breaking changes, the JSON report will be an empty JSON.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
class StdOutReporter implements Reporter, CheckableReporter {
@Override
public void report(Collection<BreakingChange> breakingChanges, Options options, ApiInfo apiInfo) {
printApiInfo(apiInfo);
printBreakingChangesIfAny(breakingChanges);
}

Expand All @@ -26,20 +25,6 @@ private void printBreakingChangesIfAny(Collection<BreakingChange> breakingChange
}
}

private void printApiInfo(ApiInfo apiInfo) {
if (apiInfo != null) {
printIfNotNull(apiInfo.getTitle());
printIfNotNull(apiInfo.getDescription());
printIfNotNull(apiInfo.getVersion());
}
}

private void printIfNotNull(String str) {
if (str != null) {
System.out.println(str);
}
}

@Override
public boolean canReport(OutputFormat format) {
return true;
Expand Down

0 comments on commit 47b2a16

Please sign in to comment.