You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2020/02/03 21:45:51 UTC
[GitHub] [openwhisk] mcdan commented on a change in pull request #4756:
Create AES128 and AES256 encryption for parameters
mcdan commented on a change in pull request #4756: Create AES128 and AES256 encryption for parameters
URL: https://github.com/apache/openwhisk/pull/4756#discussion_r374358935
##########
File path: common/scala/src/main/scala/org/apache/openwhisk/core/entity/Parameter.scala
##########
@@ -80,15 +81,33 @@ protected[core] class Parameters protected[entity] (private val params: Map[Para
params.keySet filter (params(_).init) map (_.name)
}
+ protected[core] def getMap = {
+ params
+ }
protected[core] def toJsArray = {
JsArray(params map { p =>
- if (p._2.init) {
- JsObject("key" -> p._1.name.toJson, "value" -> p._2.value.toJson, "init" -> JsTrue)
- } else JsObject("key" -> p._1.name.toJson, "value" -> p._2.value.toJson)
+ val init = p._2.init match {
+ case true => Some("init" -> p._2.init.toJson)
+ case _ => None
+ }
+ val encrypt = p._2.encryption match {
+ case (JsNull) => None
+ case _ => Some("encryption" -> p._2.encryption.toJson)
+ }
+ // Have do use this slightly strange construction to get the json object order identical.
+ JsObject(ListMap() ++ encrypt ++ init ++ Map("key" -> p._1.name.toJson, "value" -> p._2.value.toJson))
Review comment:
I double checked by mixing up the append order and this assert fails: https://github.com/apache/openwhisk/blob/master/tests/src/test/scala/org/apache/openwhisk/core/entity/test/SchemaTests.scala#L708
As it asserts the string equality of the json output. Given that I was hesitant to alter its order.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services