On Tue, Jun 7, 2016 at 10:54 AM, Malaka Silva <[email protected]> wrote:

> But optional Fields are something we need to handle at run time?
>
 Actually there are several ways we could get optional elements. Some API's
will not send the optional elements if they are null or they will send
empty element with or without xsi:nil attribute. Data mapper engine build
and inject the received payload to JS engine. So the problem will arise
when the mapping configuration tries to execute a undefined optional
parameter. So mapping configuration should check the parameters if they are
optional.

>
> On Tue, Jun 7, 2016 at 10:52 AM, Nuwan Pallewela <[email protected]> wrote:
>
>> Hi Malaka,
>>
>> On Tue, Jun 7, 2016 at 10:45 AM, Malaka Silva <[email protected]> wrote:
>>
>>> Hi Sohani,
>>>
>>> I guess we are dealing with optional input/output here. So in that case
>>> are we showing those in a different color or anyway to distinguish?
>>>
>>> On execution side this needs to be handled from data mapper mediator.
>>>
>> This is handled by the mapping configuration generation in data mapper
>> editor so that data mapper engine may have minimum changes.
>>
>>>
>>> On Tue, Jun 7, 2016 at 9:21 AM, Sohani Weerasinghe <[email protected]>
>>> wrote:
>>>
>>>> Hi All,
>>>>
>>>> We are in a process of implementing the $subject and please find the
>>>> implementation details.
>>>>
>>>> *Input*:
>>>>
>>>> <h:person xmlns:h="http://www.w3.org/TR/html4/";>
>>>> <firstName>sample</firstName>
>>>> <phone primary="false">0112655655<ext>01</ext></phone>
>>>> <phone primary="false">0112655655<ext>01</ext></phone>
>>>> </h:person>
>>>>
>>>> After loading the above payload, the generated schema will be as follows
>>>>
>>>> {
>>>>   "$schema" : "http://json-schema.org/draft-04/schema#";,
>>>>   *"nullable" : "false"*,
>>>>   "id" : "http://wso2jsonschema.org";,
>>>>   "title" : "h:person",
>>>>   "type" : "object",
>>>>   "properties" : {
>>>>     "firstName" : {
>>>>       *"nullable" : "false",*
>>>>       "id" : "http://wso2jsonschema.org/firstName";,
>>>>       "type" : "string"
>>>>     },
>>>>     *"nullable" : "false"*,
>>>>     "phone" : {
>>>>       "id" : "http://wso2jsonschema.org/phone";,
>>>>       "type" : "array",
>>>>       "items" : [ {
>>>>         "attributes" : {
>>>>           "primary" : {
>>>>            * "nullable" : "false"*,
>>>>             "id" : "http://wso2jsonschema.org/phone/0/primary";,
>>>>             "type" : "boolean"
>>>>           }
>>>>         },
>>>>         "id" : "http://wso2jsonschema.org/phone/0";,
>>>>         "type" : "object",
>>>>         "value" : {
>>>>           "type" : "number"
>>>>         },
>>>>         "properties" : {
>>>>           "ext" : {
>>>>            * "nullable" : "false",*
>>>>             "id" : "http://wso2jsonschema.org/phone/0/ext";,
>>>>             "type" : "number"
>>>>           }
>>>>         }
>>>>       } ]
>>>>     }
>>>>   },
>>>>   "namespaces" : [ {
>>>>     "prefix" : "h",
>>>>     "url" : "http://www.w3.org/TR/html4/";
>>>>   } ]
>>>> }
>>>>
>>>> Then, user can right click on the node and click on 'Enable Nullable'
>>>> and make the object or array or element, etc nullable.
>>>>
>>>>
>>>> ​The schema will be as follows
>>>>
>>>> {
>>>>   "$schema" : "http://json-schema.org/draft-04/schema#";,
>>>>  * "nullable" : "true",*
>>>>   "id" : "http://wso2jsonschema.org";,
>>>>   "title" : "h:person",
>>>>   "type" : "object",
>>>>   "properties" : {
>>>>     "firstName" : {
>>>>       "nullable" : "false",
>>>>       "id" : "http://wso2jsonschema.org/firstName";,
>>>>       "type" : "string"
>>>>     },
>>>>     "nullable" : "false",
>>>>     "phone" : {
>>>>       "id" : "http://wso2jsonschema.org/phone";,
>>>>       "type" : "array",
>>>>       "items" : [ {
>>>>         "attributes" : {
>>>>           "primary" : {
>>>>             "nullable" : "false",
>>>>             "id" : "http://wso2jsonschema.org/phone/0/primary";,
>>>>             "type" : "boolean"
>>>>           }
>>>>         },
>>>>         "id" : "http://wso2jsonschema.org/phone/0";,
>>>>         "type" : "object",
>>>>         "value" : {
>>>>           "type" : "number"
>>>>         },
>>>>         "properties" : {
>>>>           "ext" : {
>>>>             "nullable" : "false",
>>>>             "id" : "http://wso2jsonschema.org/phone/0/ext";,
>>>>             "type" : "number"
>>>>           }
>>>>         }
>>>>       } ]
>>>>     }
>>>>   },
>>>>   "namespaces" : [ {
>>>>     "prefix" : "h",
>>>>     "url" : "http://www.w3.org/TR/html4/";
>>>>   } ]
>>>> }
>>>>
>>>> If a user wants to disable it then, user can right click on the node
>>>> and click on 'Disable Nullable'
>>>>
>>>>
>>>> ​
>>>> After enabling, we thought of changing the icon of the tree node so
>>>> that user can easily identify whether a particular node is a nullable or
>>>> not.
>>>>
>>>> Thanks,
>>>> Sohani
>>>> Sohani Weerasinghe
>>>> Senior Software Engineer
>>>> WSO2, Inc: http://wso2.com
>>>>
>>>> Mobile  : +94 716439774
>>>> Blog     :http://christinetechtips.blogspot.com/
>>>> Twitter  : https://twitter.com/hanichristine
>>>>
>>>> _______________________________________________
>>>> Architecture mailing list
>>>> [email protected]
>>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>>>
>>>>
>>>
>>>
>>> --
>>>
>>> Best Regards,
>>>
>>> Malaka Silva
>>> Senior Technical Lead
>>> M: +94 777 219 791
>>> Tel : 94 11 214 5345
>>> Fax :94 11 2145300
>>> Skype : malaka.sampath.silva
>>> LinkedIn : http://www.linkedin.com/pub/malaka-silva/6/33/77
>>> Blog : http://mrmalakasilva.blogspot.com/
>>>
>>> WSO2, Inc.
>>> lean . enterprise . middleware
>>> http://www.wso2.com/
>>> http://www.wso2.com/about/team/malaka-silva/
>>> <http://wso2.com/about/team/malaka-silva/>
>>> https://store.wso2.com/store/
>>>
>>> Save a tree -Conserve nature & Save the world for your future. Print
>>> this email only if it is absolutely necessary.
>>>
>>
>> Thanks,
>> Nuwan
>>
>> --
>> ----------------------------------------------------------
>>
>> *Nuwan Chamara Pallewela*
>>
>>
>> *Software Engineer*
>>
>> *WSO2, Inc. *http://wso2.com
>> *lean . enterprise . middleware*
>>
>> Email   *[email protected] <[email protected]>*
>> Mobile  *+94719079739 <%2B94719079739>@*
>>
>>
>>
>
>

> --
>
> Best Regards,
>
> Malaka Silva
> Senior Technical Lead
> M: +94 777 219 791
> Tel : 94 11 214 5345
> Fax :94 11 2145300
> Skype : malaka.sampath.silva
> LinkedIn : http://www.linkedin.com/pub/malaka-silva/6/33/77
> Blog : http://mrmalakasilva.blogspot.com/
>
> WSO2, Inc.
> lean . enterprise . middleware
> http://www.wso2.com/
> http://www.wso2.com/about/team/malaka-silva/
> <http://wso2.com/about/team/malaka-silva/>
> https://store.wso2.com/store/
>
> Save a tree -Conserve nature & Save the world for your future. Print this
> email only if it is absolutely necessary.
>

Thanks,
Nuwan

-- 
----------------------------------------------------------

*Nuwan Chamara Pallewela*


*Software Engineer*

*WSO2, Inc. *http://wso2.com
*lean . enterprise . middleware*

Email   *[email protected] <[email protected]>*
Mobile  *+94719079739@*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to