Skip to content

Commit

Permalink
Address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
david-perez committed Sep 20, 2022
1 parent 53bd2ed commit d7e8572
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ fun ServiceShape.hasEventStreamOperations(model: Model): Boolean = operations.an
model.expectShape(id, OperationShape::class.java).isEventStream(model)
}

fun MemberShape.redactIfNecessary(model: Model, safeToPrint: String) =
model.expectShape(this.target).redactIfNecessary(safeToPrint)

fun Shape.redactIfNecessary(safeToPrint: String) =
if (this.hasTrait<SensitiveTrait>()) {
"*** Sensitive Data Redacted ***".dq()
} else {
safeToPrint
fun Shape.redactIfNecessary(model: Model, safeToPrint: String): String =
when (this) {
is MemberShape -> model.expectShape(this.target).redactIfNecessary(model, safeToPrint)
else -> if (this.hasTrait<SensitiveTrait>()) {
"*** Sensitive Data Redacted ***".dq()
} else {
safeToPrint
}
}

/*
Expand Down

0 comments on commit d7e8572

Please sign in to comment.