mattwelke commented on a change in pull request #50:
URL: 
https://github.com/apache/openwhisk-runtime-dotnet/pull/50#discussion_r613426347



##########
File path: 
core/dotnet2.2/proxy/Apache.OpenWhisk.Runtime.Common/Apache.OpenWhisk.Runtime.Common.csproj
##########
@@ -28,7 +28,7 @@
         <Version>2.2.0</Version>
       </PackageReference>
       <PackageReference Include="Newtonsoft.Json">
-        <Version>12.0.2</Version>
+        <Version>13.0.1</Version>

Review comment:
       Right now, because the runtime depends on version 12.0.2 in particular, 
the instructions for making an action that uses the runtime say that the user 
must add a dependency to version 12.0.2 in particular of Newtonsoft.Json to 
their action project. Examples:
   
   
https://github.com/apache/openwhisk-runtime-dotnet/blob/master/core/dotnet3.1/QUICKSTART.md
   https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-prep#prep_dotnet (a 
particular provider of OpenWhisk as a service)
   Doesn't this mean that for OpenWhisk operators and providers, when they 
update their version of the 3.1 runtime, they would want their users to be able 
to continue deploying actions made for previous versions of the 3.1 runtime 
without having to make changes (that runtime version updates are non-breaking)? 
If so, we would need to stick to version 12.0.2 of Newtonsoft.Json.
   
   I think the change that @kamyker made to use the built in System.Text.Json 
instead improves this situation, because there's no 3rd party library for the 
runtime and actions to need to be in sync with. The earliest version of .NET 
that System.Text.Json was available in was 3.1 (then known as .NET Core) 
(https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to?pivots=dotnet-5-0),
 but it wasn't used here for the 3.1 runtime. So, if my understanding of our 
semver problem is true, then we're stuck with Newtonsoft.Json v12.x.x for the 
2.2 and 3.1 runtimes, but we could look into using it for the next runtime (6.0 
as you state).
   
   I think a better solution btw for the JSON problem is instead if having the 
actions and runtimes depend on a third party JSON library, create a library 
managed by OpenWhisk which has a class representing the data that the action's 
Main method must return. The library could be called the "dotnet6.0 action 
contract" library etc. Or, 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 can depend on the same major version of that library. 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