Widget inputargs, what types am I working with when it comes to lists and attributes ?

What is the optimal way of getting the type of an attribute or list items passed to a widget's inputargs ? As example, I have the following in a widgetFile: <property key='attr' type='attribute' isPath="optional" pathType="reference"> <caption>Attribute</caption> <category>Data Source</category> <description>Attribute to display as a column.</description> <attributeTypes> <attributeType name='String'/> <attributeType name='Boolean'/> <attributeType name='Enum'/> </attributeTypes> </property> Now as 'inputargs.attr' I get a string with the attribute name. (1) Can I assume if there is a '/' anywhere in this string that it is always a path ? (2) Can I assume if there is a ';' anywhere that it always denotes a list of input arguments (if the property was of type object) ? (3) How can I get the type of an input argument ? I understand that you define the input arguments in your javascript file and as such the type of the property is defined, but there is still ambiguity whether a string is of property type attribute, string and perhaps others. Also ambiguity of the type of the property if it is presented as a list. (4) How can I get the type of an attribute ? Can it be done without querying the associated entity ? I would like to write a mixin that gives you an object, which already parsed the inputargs, such that 'objects'/lists are already split with ';', attributes are converted to the right types with some meta to say whether it is a path or not (and perhaps other meta). Some best practices around these questions or a reference to some documentation I missed is appreciated.
1 answers
  1. Yes, if it is in the name of an attribute
  2. Mostly, but as this applies to the contents of the inputargument, this could be anything, even strings (which can contain ';' themselves). This however rarely happens.
  3. You can check an attribute's type using either an actual MxObject you already have or by retrieving the meta data using the entity name. Both of these have functions for the important ones, isDate, isNumber, isEnum. Besides these you can usually consider them as strings for the scope of your widget.
  4. We use a similar function in our widgets: JS Fiddle - Splitprop()