0
 Followers
8
 Likes

Pluggable Object converters

Integration
Not right now

The Object type of the platform is able to hold reference to both platform derived types (Lists, String, Structures, etc) and plain javascript objects. For this reason this can be used for many ends such has passing platform objects from action to action and even to javascript nodes.

Many times there's a need to pass some object/data to external javascript code with a specific structure and the current solutions that I am aware are:

  • If the structure is known, manually create a javascript object with the desired structure and set the respected values
  • Use JSON.stringify() on a platform Object and later JSON.parse(). This adds unnecessary overhead 
  • Same as previous but with serialize/deserialize actions from the platform


And when we want to get data from external code into platform's context types we have:

  • A defined Structure that knows how to parse objects from JSON


My idea would be to have a pluggable system for type converters in a way that the user defines how a specific type should be converted from plain javascript to a platform type. This, coupled with http://www.outsystems.com/ideas/2878/interface-oriented-object-validation would make a powerful toolset.



Created on 10 Feb 2017
Comments (3)

Wouldn't it be simpler if you could use Entities, Structures and Lists as parameters for JavaScript nodes? The Entities and Structures could be converted to plain JavaScript objects and the Lists to JavaScript arrays. I don't see the need for custom conversions. Would it be enough for your needs?

Being able to use Entities, Strucutures and Lists would be a starting point but currently Entities are only able to be initialized by giving a JSON object, what I am proposing is to have a similar functionality that would allow initializing Entities from a javascript plain Object instead of a JSON.

Additionally this would also allow for functional transformation while converting data

Changed the status to
Not right now


Hi João,


Sorry for the late reply, but we are not planning on delivering this in the near future.


Although this makes sense, with the upcoming new features that we have in mind we currently don't have plans to tackle this in the near future.


Nonetheless, thank you very much for your idea and keep it coming.

If you believe we missed some context that would change our perception about it, please give us more details about why you would need this and for what is the use case.


 Thanks!

views
318
Followers
0