Skip to content

Commit

Permalink
Allow empty schemas in check markdown task (#802)
Browse files Browse the repository at this point in the history
Allow empty schemas in check markdown task
  • Loading branch information
leonz authored Jun 7, 2022
1 parent 747732b commit 7ca8293
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-802.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: fix
fix:
description: Allow empty schemas in check markdown task
links:
- https://github.com/palantir/metric-schema/pull/802
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public final void check() throws IOException {

Map<String, List<MetricSchema>> schemas =
ObjectMappers.mapper.readValue(manifest, new TypeReference<Map<String, List<MetricSchema>>>() {});
if (schemas.isEmpty()) {
if (isEmpty(schemas)) {
return;
}

Expand All @@ -99,4 +99,8 @@ public final void check() throws IOException {
MetricSchemaPlugin.GENERATE_METRICS_MARKDOWN);
}
}

private static boolean isEmpty(Map<String, List<MetricSchema>> schemas) {
return schemas.isEmpty() || schemas.values().stream().allMatch(List::isEmpty);
}
}

0 comments on commit 7ca8293

Please sign in to comment.