Skip to content

Commit

Permalink
Use map instead of isEmpty when writing shape docs (#1210)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr authored Mar 15, 2024
1 parent ae49717 commit a17478e
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,11 @@ boolean writeShapeDocs(Shape shape, UnaryOperator<String> preprocessor) {
.replace("}", "\\}");
docs = preprocessor.apply(docs);
if (shape.getTrait(DeprecatedTrait.class).isPresent()) {
DeprecatedTrait deprecatedTrait = shape.getTrait(DeprecatedTrait.class).get();
String deprecationMessage = deprecatedTrait.getMessage().orElse("");
String deprecationString = "@deprecated"
+ (deprecationMessage.isEmpty() ? "" : " " + deprecationMessage);
DeprecatedTrait deprecatedTrait = shape.expectTrait(DeprecatedTrait.class);
String deprecationMessage = deprecatedTrait.getMessage()
.map(msg -> " " + msg)
.orElse("");
String deprecationString = "@deprecated" + deprecationMessage;
docs = deprecationString + "\n\n" + docs;
}
docs = addReleaseTag(shape, docs);
Expand Down

0 comments on commit a17478e

Please sign in to comment.