openwhisk-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michele Sciabarra <mich...@sciabarra.com>
Subject A problem in changing the signature of the action for the Golang runtime
Date Sat, 01 Sep 2018 09:24:05 GMT
Hello, I am in the process of cleaning the Golang runtime, and I am implementing the tests
in the trait BasicActionRunnerTests.

In the process, I am cleaning a number of things. 
I have now a "stupid" problem.

I would like to change (as suggested by Carlos) the signature of an action from the current

   func Main(event json.RawMessage) (json.RawMessage, error) 

to

  func Main(event map[string]interface{}) map[string]interface{}

this express better the fact the input and the output are expected to be object, and is also
saves a "json.Marshal" and "json.Unmarshal" in the main. It is helpful for simple cases.

However, I cannot do it! Because of this (mandatory) test for runtimes:  "testNotReturningJson"

The test checks that the runtime can reject an action that returns something like a  simple
string and not a json object ( BTW, a string IS valid JSON, so test is not named properly:
should be: testNotRetuningObjectJson) 

In any case changing the signature I do not have any more any way to have a misbehaving action
that produces something that is not valid object, because if I force the action to return
a map of strings, it will be always serialized back to a json object. 

Hence I have no way to pass this test!  What I can do?
 
-- 
  Michele Sciabarra
  michele@sciabarra.com

Mime
View raw message