mattwelke opened a new issue #51:
URL: https://github.com/apache/openwhisk-runtime-dotnet/issues/51


   Based on conversation in 
https://github.com/apache/openwhisk-runtime-dotnet/issues/34 and 
https://github.com/apache/openwhisk-runtime-dotnet/pull/50...
   
   Problem:
   
   OpenWhisk users creating .NET actions need to add a dependency on a 3rd 
party JSON library (currently Newtonsoft.Json as of the dotnet:3.1 runtime) 
because the contract between action and runtime provides the action main 
function with a `JObject` via paramter and requires the main function to return 
a `JObject`). This adds friction to creating an action (User: "Why do I need to 
use this 3rd party library?") and could result in errors when the versions of 
the 3rd party library differ between the runtime and the action. Testing so far 
has found that it's okay for a runtime to use a version of Newtonsoft.Json with 
a higher major version than the action, but the other way around hasn't been 
tested yet.
   
   Potential solution:
   
   Since the contract between runtimes and actions is really just an arbitrary 
map of data (as seen in the Node.js runtime instructions as 
https://github.com/apache/openwhisk/blob/master/docs/actions-nodejs.md where 
they just return { done: true } and { message: 'my message' } etc), no common 
library would be needed, and you just have the action return a map data 
structure. C# has Dictionary for that 
(https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.dictionary-2?view=net-5.0).
   
   That way, all versions of the runtime and every action ever created for the 
runtime would not depend on things that need major version updates throughout 
the lifecycle of a runtime (like dotnet:3.1). The runtime would control the 
implementation of how JSON is handled. It could choose for example between 
different versions of Newtonsoft.Json or even other JSON libraries like 
System.Text.Json whenever it wants, with the runtime versions being updated 
without the action implementers ever having to worry about it.


-- 
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:
[email protected]


Reply via email to