rabbah commented on a change in pull request #3253: Efficiently parse 
CompletionMessage.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3253#discussion_r166241465
 
 

 ##########
 File path: common/scala/src/main/scala/whisk/core/connector/Message.scala
 ##########
 @@ -95,6 +95,20 @@ case class CompletionMessage(override val transid: 
TransactionId,
 }
 
 object CompletionMessage extends DefaultJsonProtocol {
+  implicit def eitherResponse =
+    new JsonFormat[Either[ActivationId, WhiskActivation]] {
+      def write(either: Either[ActivationId, WhiskActivation]) = either match {
+        case Right(a) => a.toJson
+        case Left(b)  => b.toJson
+      }
+
+      def read(value: JsValue) = value match {
+        case _: JsString => Left(value.convertTo[ActivationId])
 
 Review comment:
   Can you add a comment that we guarantee activation id to be a string even if 
it?s contains only digits?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to