You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwhisk.apache.org by Michele Sciabarra <mi...@sciabarra.com> on 2018/09/01 09:24:05 UTC

A problem in changing the signature of the action for the Golang runtime

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

Re: A problem in changing the signature of the action for the Golang runtime

Posted by Carlos Santana <cs...@gmail.com>.
oops sorry, blame the phone autocorrect meant Michele not Michael

It’s too early, I need my coffee ☕️
On Sat, Sep 1, 2018 at 8:09 AM Carlos Santana <cs...@gmail.com> wrote:

> Hi Michael
>
> I’m glad to hear your working on this.
>
> Good observation if Json mean Json object or a Json value.
>
> I think me an others do this when we refer to Json we mean Json object.
> Now I would keep this in the back of my head.
>
> Like Rodric said is OK to skip this particular test in case by case.
>
> Maybe we can add a note in the doc or code to make it clear it for the
> next new runtime
>
> I will help review the changes, let me know if we need changes first in
> the go client first.
>
> — Carlos
>
>
> On Sat, Sep 1, 2018 at 7:31 AM Michele Sciabarra <mi...@sciabarra.com>
> wrote:
>
>> Definitely yes :) thx!!!
>>
>> --
>>   Michele Sciabarra
>>   michele@sciabarra.com
>>
>> ----- Original message -----
>> From: Rodric Rabbah <ro...@gmail.com>
>> To: dev@openwhisk.apache.org
>> Subject: Re: A problem in changing the signature of the action for the
>> Golang runtime
>> Date: Sat, 1 Sep 2018 05:31:57 -0400
>>
>> Hey Michele
>>
>> The particular test you mention has a bypass feature for languages which
>> prevent you from returning invalid json (statically typed ones). You can
>> set the skip flag for the test and you’re done. The swift runtime does this
>> for example. In java I also skipped this test but added a second explicit
>> test where I returned null and checked the error handling accordingly.
>>
>> See here for swift test bypass
>>
>> https://github.com/apache/incubator-openwhisk-runtime-swift/blob/2b9bad5b2cc1e273fc61109a6d96c742578cbf1a/tests/src/test/scala/runtime/actionContainers/SwiftActionContainerTests.scala#L48
>>
>> And here for java null test
>> https://
>> .com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
>> https://g://
>> ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
>> <http://ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317>
>>
>> https://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
>>
>>
>> Does this help?
>>
>> -r
>>
>> > On Sep 1, 2018, at 5:24 AM, Michele Sciabarra <mi...@sciabarra.com>
>> wrote:
>> >
>> > 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
>>
>

Re: A problem in changing the signature of the action for the Golang runtime

Posted by Michele Sciabarra <mi...@sciabarra.com>.
agreed - wait for my new PR for swift4.2 with actionloop

-- 
  Michele Sciabarra
  michele@sciabarra.com

----- Original message -----
From: Carlos Santana <cs...@gmail.com>
To: dev@openwhisk.apache.org
Subject: Re: A problem in changing the signature of the action for the Golang runtime
Date: Sat, 1 Sep 2018 09:35:00 -0400

Yep since it’s new let’s start from latest only

On Sat, Sep 1, 2018 at 8:27 AM Michele Sciabarra <mi...@sciabarra.com>
wrote:

> I updated the go runtime to use go1.11, so I guess I do better to go
> straight and submit a PR for swift 4.2, right?
>
>
> --
>   Michele Sciabarra
>   michele@sciabarra.com
>
> ----- Original message -----
> From: Carlos Santana <cs...@gmail.com>
> To: dev@openwhisk.apache.org
> Subject: Re: A problem in changing the signature of the action for the
> Golang runtime
> Date: Sat, 1 Sep 2018 08:20:27 -0400
>
> +1 Yay
> I’m being holding off on a new runtime for swift 4.2 because I want to use
> the loopaction go proxy for it
>
> — Carlos
> On Sat, Sep 1, 2018 at 8:16 AM Michele Sciabarra <mi...@sciabarra.com>
> wrote:
>
> > I am also updating the PR for the swift runtime :)
> >
> > --
> >   Michele Sciabarra
> >   michele@sciabarra.com
> >
> > ----- Original message -----
> > From: Carlos Santana <cs...@gmail.com>
> > To: dev@openwhisk.apache.org
> > Subject: Re: A problem in changing the signature of the action for the
> > Golang runtime
> > Date: Sat, 1 Sep 2018 08:09:18 -0400
> >
> > Hi Michael
> >
> > I’m glad to hear your working on this.
> >
> > Good observation if Json mean Json object or a Json value.
> >
> > I think me an others do this when we refer to Json we mean Json object.
> Now
> > I would keep this in the back of my head.
> >
> > Like Rodric said is OK to skip this particular test in case by case.
> >
> > Maybe we can add a note in the doc or code to make it clear it for the
> next
> > new runtime
> >
> > I will help review the changes, let me know if we need changes first in
> the
> > go client first.
> >
> > — Carlos
> >
> >
> > On Sat, Sep 1, 2018 at 7:31 AM Michele Sciabarra <mi...@sciabarra.com>
> > wrote:
> >
> > > Definitely yes :) thx!!!
> > >
> > > --
> > >   Michele Sciabarra
> > >   michele@sciabarra.com
> > >
> > > ----- Original message -----
> > > From: Rodric Rabbah <ro...@gmail.com>
> > > To: dev@openwhisk.apache.org
> > > Subject: Re: A problem in changing the signature of the action for the
> > > Golang runtime
> > > Date: Sat, 1 Sep 2018 05:31:57 -0400
> > >
> > > Hey Michele
> > >
> > > The particular test you mention has a bypass feature for languages
> which
> > > prevent you from returning invalid json (statically typed ones). You
> can
> > > set the skip flag for the test and you’re done. The swift runtime does
> > this
> > > for example. In java I also skipped this test but added a second
> explicit
> > > test where I returned null and checked the error handling accordingly.
> > >
> > > See here for swift test bypass
> > >
> > >
> >
> https://github.com/apache/incubator-openwhisk-runtime-swift/blob/2b9bad5b2cc1e273fc61109a6d96c742578cbf1a/tests/src/test/scala/runtime/actionContainers/SwiftActionContainerTests.scala#L48
> > >
> > > And here for java null test
> > > https://
> > >
> >
> .com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
> > > https://g://
> > >
> >
> ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
> <http://ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317>
> > <
> http://ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317
> >
> > > <
> >
> http://ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317
> > >
> > >
> > >
> >
> https://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
> > >
> > >
> > > Does this help?
> > >
> > > -r
> > >
> > > > On Sep 1, 2018, at 5:24 AM, Michele Sciabarra <michele@sciabarra.com
> >
> > > wrote:
> > > >
> > > > 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
> > >
> >
>

Re: A problem in changing the signature of the action for the Golang runtime

Posted by Carlos Santana <cs...@gmail.com>.
Yep since it’s new let’s start from latest only

On Sat, Sep 1, 2018 at 8:27 AM Michele Sciabarra <mi...@sciabarra.com>
wrote:

> I updated the go runtime to use go1.11, so I guess I do better to go
> straight and submit a PR for swift 4.2, right?
>
>
> --
>   Michele Sciabarra
>   michele@sciabarra.com
>
> ----- Original message -----
> From: Carlos Santana <cs...@gmail.com>
> To: dev@openwhisk.apache.org
> Subject: Re: A problem in changing the signature of the action for the
> Golang runtime
> Date: Sat, 1 Sep 2018 08:20:27 -0400
>
> +1 Yay
> I’m being holding off on a new runtime for swift 4.2 because I want to use
> the loopaction go proxy for it
>
> — Carlos
> On Sat, Sep 1, 2018 at 8:16 AM Michele Sciabarra <mi...@sciabarra.com>
> wrote:
>
> > I am also updating the PR for the swift runtime :)
> >
> > --
> >   Michele Sciabarra
> >   michele@sciabarra.com
> >
> > ----- Original message -----
> > From: Carlos Santana <cs...@gmail.com>
> > To: dev@openwhisk.apache.org
> > Subject: Re: A problem in changing the signature of the action for the
> > Golang runtime
> > Date: Sat, 1 Sep 2018 08:09:18 -0400
> >
> > Hi Michael
> >
> > I’m glad to hear your working on this.
> >
> > Good observation if Json mean Json object or a Json value.
> >
> > I think me an others do this when we refer to Json we mean Json object.
> Now
> > I would keep this in the back of my head.
> >
> > Like Rodric said is OK to skip this particular test in case by case.
> >
> > Maybe we can add a note in the doc or code to make it clear it for the
> next
> > new runtime
> >
> > I will help review the changes, let me know if we need changes first in
> the
> > go client first.
> >
> > — Carlos
> >
> >
> > On Sat, Sep 1, 2018 at 7:31 AM Michele Sciabarra <mi...@sciabarra.com>
> > wrote:
> >
> > > Definitely yes :) thx!!!
> > >
> > > --
> > >   Michele Sciabarra
> > >   michele@sciabarra.com
> > >
> > > ----- Original message -----
> > > From: Rodric Rabbah <ro...@gmail.com>
> > > To: dev@openwhisk.apache.org
> > > Subject: Re: A problem in changing the signature of the action for the
> > > Golang runtime
> > > Date: Sat, 1 Sep 2018 05:31:57 -0400
> > >
> > > Hey Michele
> > >
> > > The particular test you mention has a bypass feature for languages
> which
> > > prevent you from returning invalid json (statically typed ones). You
> can
> > > set the skip flag for the test and you’re done. The swift runtime does
> > this
> > > for example. In java I also skipped this test but added a second
> explicit
> > > test where I returned null and checked the error handling accordingly.
> > >
> > > See here for swift test bypass
> > >
> > >
> >
> https://github.com/apache/incubator-openwhisk-runtime-swift/blob/2b9bad5b2cc1e273fc61109a6d96c742578cbf1a/tests/src/test/scala/runtime/actionContainers/SwiftActionContainerTests.scala#L48
> > >
> > > And here for java null test
> > > https://
> > >
> >
> .com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
> > > https://g://
> > >
> >
> ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
> <http://ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317>
> > <
> http://ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317
> >
> > > <
> >
> http://ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317
> > >
> > >
> > >
> >
> https://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
> > >
> > >
> > > Does this help?
> > >
> > > -r
> > >
> > > > On Sep 1, 2018, at 5:24 AM, Michele Sciabarra <michele@sciabarra.com
> >
> > > wrote:
> > > >
> > > > 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
> > >
> >
>

Re: A problem in changing the signature of the action for the Golang runtime

Posted by Michele Sciabarra <mi...@sciabarra.com>.
I updated the go runtime to use go1.11, so I guess I do better to go straight and submit a PR for swift 4.2, right?


-- 
  Michele Sciabarra
  michele@sciabarra.com

----- Original message -----
From: Carlos Santana <cs...@gmail.com>
To: dev@openwhisk.apache.org
Subject: Re: A problem in changing the signature of the action for the Golang runtime
Date: Sat, 1 Sep 2018 08:20:27 -0400

+1 Yay
I’m being holding off on a new runtime for swift 4.2 because I want to use
the loopaction go proxy for it

— Carlos
On Sat, Sep 1, 2018 at 8:16 AM Michele Sciabarra <mi...@sciabarra.com>
wrote:

> I am also updating the PR for the swift runtime :)
>
> --
>   Michele Sciabarra
>   michele@sciabarra.com
>
> ----- Original message -----
> From: Carlos Santana <cs...@gmail.com>
> To: dev@openwhisk.apache.org
> Subject: Re: A problem in changing the signature of the action for the
> Golang runtime
> Date: Sat, 1 Sep 2018 08:09:18 -0400
>
> Hi Michael
>
> I’m glad to hear your working on this.
>
> Good observation if Json mean Json object or a Json value.
>
> I think me an others do this when we refer to Json we mean Json object. Now
> I would keep this in the back of my head.
>
> Like Rodric said is OK to skip this particular test in case by case.
>
> Maybe we can add a note in the doc or code to make it clear it for the next
> new runtime
>
> I will help review the changes, let me know if we need changes first in the
> go client first.
>
> — Carlos
>
>
> On Sat, Sep 1, 2018 at 7:31 AM Michele Sciabarra <mi...@sciabarra.com>
> wrote:
>
> > Definitely yes :) thx!!!
> >
> > --
> >   Michele Sciabarra
> >   michele@sciabarra.com
> >
> > ----- Original message -----
> > From: Rodric Rabbah <ro...@gmail.com>
> > To: dev@openwhisk.apache.org
> > Subject: Re: A problem in changing the signature of the action for the
> > Golang runtime
> > Date: Sat, 1 Sep 2018 05:31:57 -0400
> >
> > Hey Michele
> >
> > The particular test you mention has a bypass feature for languages which
> > prevent you from returning invalid json (statically typed ones). You can
> > set the skip flag for the test and you’re done. The swift runtime does
> this
> > for example. In java I also skipped this test but added a second explicit
> > test where I returned null and checked the error handling accordingly.
> >
> > See here for swift test bypass
> >
> >
> https://github.com/apache/incubator-openwhisk-runtime-swift/blob/2b9bad5b2cc1e273fc61109a6d96c742578cbf1a/tests/src/test/scala/runtime/actionContainers/SwiftActionContainerTests.scala#L48
> >
> > And here for java null test
> > https://
> >
> .com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
> > https://g://
> >
> ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
> <http://ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317>
> > <
> http://ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317
> >
> >
> >
> https://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
> >
> >
> > Does this help?
> >
> > -r
> >
> > > On Sep 1, 2018, at 5:24 AM, Michele Sciabarra <mi...@sciabarra.com>
> > wrote:
> > >
> > > 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
> >
>

Re: A problem in changing the signature of the action for the Golang runtime

Posted by Carlos Santana <cs...@gmail.com>.
+1 Yay
I’m being holding off on a new runtime for swift 4.2 because I want to use
the loopaction go proxy for it

— Carlos
On Sat, Sep 1, 2018 at 8:16 AM Michele Sciabarra <mi...@sciabarra.com>
wrote:

> I am also updating the PR for the swift runtime :)
>
> --
>   Michele Sciabarra
>   michele@sciabarra.com
>
> ----- Original message -----
> From: Carlos Santana <cs...@gmail.com>
> To: dev@openwhisk.apache.org
> Subject: Re: A problem in changing the signature of the action for the
> Golang runtime
> Date: Sat, 1 Sep 2018 08:09:18 -0400
>
> Hi Michael
>
> I’m glad to hear your working on this.
>
> Good observation if Json mean Json object or a Json value.
>
> I think me an others do this when we refer to Json we mean Json object. Now
> I would keep this in the back of my head.
>
> Like Rodric said is OK to skip this particular test in case by case.
>
> Maybe we can add a note in the doc or code to make it clear it for the next
> new runtime
>
> I will help review the changes, let me know if we need changes first in the
> go client first.
>
> — Carlos
>
>
> On Sat, Sep 1, 2018 at 7:31 AM Michele Sciabarra <mi...@sciabarra.com>
> wrote:
>
> > Definitely yes :) thx!!!
> >
> > --
> >   Michele Sciabarra
> >   michele@sciabarra.com
> >
> > ----- Original message -----
> > From: Rodric Rabbah <ro...@gmail.com>
> > To: dev@openwhisk.apache.org
> > Subject: Re: A problem in changing the signature of the action for the
> > Golang runtime
> > Date: Sat, 1 Sep 2018 05:31:57 -0400
> >
> > Hey Michele
> >
> > The particular test you mention has a bypass feature for languages which
> > prevent you from returning invalid json (statically typed ones). You can
> > set the skip flag for the test and you’re done. The swift runtime does
> this
> > for example. In java I also skipped this test but added a second explicit
> > test where I returned null and checked the error handling accordingly.
> >
> > See here for swift test bypass
> >
> >
> https://github.com/apache/incubator-openwhisk-runtime-swift/blob/2b9bad5b2cc1e273fc61109a6d96c742578cbf1a/tests/src/test/scala/runtime/actionContainers/SwiftActionContainerTests.scala#L48
> >
> > And here for java null test
> > https://
> >
> .com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
> > https://g://
> >
> ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
> <http://ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317>
> > <
> http://ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317
> >
> >
> >
> https://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
> >
> >
> > Does this help?
> >
> > -r
> >
> > > On Sep 1, 2018, at 5:24 AM, Michele Sciabarra <mi...@sciabarra.com>
> > wrote:
> > >
> > > 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
> >
>

Re: A problem in changing the signature of the action for the Golang runtime

Posted by Michele Sciabarra <mi...@sciabarra.com>.
I am also updating the PR for the swift runtime :) 

-- 
  Michele Sciabarra
  michele@sciabarra.com

----- Original message -----
From: Carlos Santana <cs...@gmail.com>
To: dev@openwhisk.apache.org
Subject: Re: A problem in changing the signature of the action for the Golang runtime
Date: Sat, 1 Sep 2018 08:09:18 -0400

Hi Michael

I’m glad to hear your working on this.

Good observation if Json mean Json object or a Json value.

I think me an others do this when we refer to Json we mean Json object. Now
I would keep this in the back of my head.

Like Rodric said is OK to skip this particular test in case by case.

Maybe we can add a note in the doc or code to make it clear it for the next
new runtime

I will help review the changes, let me know if we need changes first in the
go client first.

— Carlos


On Sat, Sep 1, 2018 at 7:31 AM Michele Sciabarra <mi...@sciabarra.com>
wrote:

> Definitely yes :) thx!!!
>
> --
>   Michele Sciabarra
>   michele@sciabarra.com
>
> ----- Original message -----
> From: Rodric Rabbah <ro...@gmail.com>
> To: dev@openwhisk.apache.org
> Subject: Re: A problem in changing the signature of the action for the
> Golang runtime
> Date: Sat, 1 Sep 2018 05:31:57 -0400
>
> Hey Michele
>
> The particular test you mention has a bypass feature for languages which
> prevent you from returning invalid json (statically typed ones). You can
> set the skip flag for the test and you’re done. The swift runtime does this
> for example. In java I also skipped this test but added a second explicit
> test where I returned null and checked the error handling accordingly.
>
> See here for swift test bypass
>
> https://github.com/apache/incubator-openwhisk-runtime-swift/blob/2b9bad5b2cc1e273fc61109a6d96c742578cbf1a/tests/src/test/scala/runtime/actionContainers/SwiftActionContainerTests.scala#L48
>
> And here for java null test
> https://
> .com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
> https://g://
> ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
> <http://ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317>
>
> https://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
>
>
> Does this help?
>
> -r
>
> > On Sep 1, 2018, at 5:24 AM, Michele Sciabarra <mi...@sciabarra.com>
> wrote:
> >
> > 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
>

Re: A problem in changing the signature of the action for the Golang runtime

Posted by Carlos Santana <cs...@gmail.com>.
Hi Michael

I’m glad to hear your working on this.

Good observation if Json mean Json object or a Json value.

I think me an others do this when we refer to Json we mean Json object. Now
I would keep this in the back of my head.

Like Rodric said is OK to skip this particular test in case by case.

Maybe we can add a note in the doc or code to make it clear it for the next
new runtime

I will help review the changes, let me know if we need changes first in the
go client first.

— Carlos


On Sat, Sep 1, 2018 at 7:31 AM Michele Sciabarra <mi...@sciabarra.com>
wrote:

> Definitely yes :) thx!!!
>
> --
>   Michele Sciabarra
>   michele@sciabarra.com
>
> ----- Original message -----
> From: Rodric Rabbah <ro...@gmail.com>
> To: dev@openwhisk.apache.org
> Subject: Re: A problem in changing the signature of the action for the
> Golang runtime
> Date: Sat, 1 Sep 2018 05:31:57 -0400
>
> Hey Michele
>
> The particular test you mention has a bypass feature for languages which
> prevent you from returning invalid json (statically typed ones). You can
> set the skip flag for the test and you’re done. The swift runtime does this
> for example. In java I also skipped this test but added a second explicit
> test where I returned null and checked the error handling accordingly.
>
> See here for swift test bypass
>
> https://github.com/apache/incubator-openwhisk-runtime-swift/blob/2b9bad5b2cc1e273fc61109a6d96c742578cbf1a/tests/src/test/scala/runtime/actionContainers/SwiftActionContainerTests.scala#L48
>
> And here for java null test
> https://
> .com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
> https://g://
> ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
> <http://ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala%23L317>
>
> https://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
>
>
> Does this help?
>
> -r
>
> > On Sep 1, 2018, at 5:24 AM, Michele Sciabarra <mi...@sciabarra.com>
> wrote:
> >
> > 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
>

Re: A problem in changing the signature of the action for the Golang runtime

Posted by Michele Sciabarra <mi...@sciabarra.com>.
Definitely yes :) thx!!!

-- 
  Michele Sciabarra
  michele@sciabarra.com

----- Original message -----
From: Rodric Rabbah <ro...@gmail.com>
To: dev@openwhisk.apache.org
Subject: Re: A problem in changing the signature of the action for the Golang runtime
Date: Sat, 1 Sep 2018 05:31:57 -0400

Hey Michele

The particular test you mention has a bypass feature for languages which prevent you from returning invalid json (statically typed ones). You can set the skip flag for the test and you’re done. The swift runtime does this for example. In java I also skipped this test but added a second explicit test where I returned null and checked the error handling accordingly.

See here for swift test bypass
https://github.com/apache/incubator-openwhisk-runtime-swift/blob/2b9bad5b2cc1e273fc61109a6d96c742578cbf1a/tests/src/test/scala/runtime/actionContainers/SwiftActionContainerTests.scala#L48

And here for java null test
https://.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
https://g://ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
https://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317


Does this help?

-r

> On Sep 1, 2018, at 5:24 AM, Michele Sciabarra <mi...@sciabarra.com> wrote:
> 
> 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

Re: A problem in changing the signature of the action for the Golang runtime

Posted by Rodric Rabbah <ro...@gmail.com>.
Hey Michele

The particular test you mention has a bypass feature for languages which prevent you from returning invalid json (statically typed ones). You can set the skip flag for the test and you’re done. The swift runtime does this for example. In java I also skipped this test but added a second explicit test where I returned null and checked the error handling accordingly.

See here for swift test bypass
https://github.com/apache/incubator-openwhisk-runtime-swift/blob/2b9bad5b2cc1e273fc61109a6d96c742578cbf1a/tests/src/test/scala/runtime/actionContainers/SwiftActionContainerTests.scala#L48

And here for java null test
https://.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
https://g://ithub.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317ahttps://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317che/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317
https://github.com/apache/incubator-openwhisk-runtime-java/blob/7cd17899c4a06198fa0d783df8520dfe92352954/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala#L317


Does this help?

-r

> On Sep 1, 2018, at 5:24 AM, Michele Sciabarra <mi...@sciabarra.com> wrote:
> 
> 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