Actually those are options for the given configuration. We don't really have a clear idea what are the optional response elements. (Unless we refer api docs)
So I guess we can proceed with sample values. >From datamapper mediator(ESB Side) level we need to handle if we receive a null value. Guess this is already considered? On Wed, May 18, 2016 at 12:02 PM, Sohani Weerasinghe <[email protected]> wrote: > > > Sohani Weerasinghe > Software Engineer > WSO2, Inc: http://wso2.com > > Mobile : +94 716439774 > Blog :http://christinetechtips.blogspot.com/ > Twitter : https://twitter.com/sohanichristine > > On Wed, May 18, 2016 at 12:00 PM, Nuwan Pallewela <[email protected]> wrote: > >> Hi All, >> >> @Vivekanathan : If we need to process/map any value in the payload though >> it is optional we have to know the type when generating the schema. So the >> sample pay load should not contain null values first place. We need to >> modify the sample payload with expected values so that in the schema >> generation we could set the type correctly for that field. >> >> @Sohani : +1 for the above mention approach in the schema generation. One >> small suggestion to remove the arrow head of type null elements to restrict >> users from mapping such elements. >> > > Will do. > >> >> Thanks, >> Nuwan >> >> On Wed, May 18, 2016 at 11:51 AM, Vivekananthan Sivanayagam < >> [email protected]> wrote: >> >>> Hi Sohani, >>> >>> Normally we are getting null value for optional parameter in the API >>> response, suppose if we get the actual value for that json object , does >>> this schema handle that case? >>> >>> >>> >>> >>> >>> *Thank youVivekananthan Sivanayagam* >>> >>> *Associate Software Engineer | WSO2* >>> >>> *E:[email protected] <e%[email protected]>* >>> *M:+94752786138 <%2B94752786138>* >>> >>> On Wed, May 18, 2016 at 11:19 AM, Sohani Weerasinghe <[email protected]> >>> wrote: >>> >>>> Hi All, >>>> >>>> If a json payload has null values as shown below, how are we going to >>>> represent this in the json schema? >>>> >>>> { >>>> "root": { >>>> "tasklist_id": "12345", >>>> "test"=null >>>> } >>>> } >>>> >>>> If we are serializing that value, then the generated schema and the >>>> tree view will be as follows >>>> >>>> { >>>> "$schema" : "http://json-schema.org/draft-04/schema#", >>>> "id" : "http://wso2jsonschema.org", >>>> "title" : "root", >>>> "type" : "object", >>>> "properties" : { >>>> *"test" : {* >>>> * "id" : "http://wso2jsonschema.org/test >>>> <http://wso2jsonschema.org/test>",* >>>> * "type" : "null"* >>>> * },* >>>> "tasklist_id" : { >>>> "id" : "http://wso2jsonschema.org/tasklist_id", >>>> "type" : "string" >>>> } >>>> } >>>> } >>>> >>>> >>>> >>>> >>>> Appreciate your input on this >>>> >>>> Thanks, >>>> Sohani >>>> Sohani Weerasinghe >>>> Software Engineer >>>> WSO2, Inc: http://wso2.com >>>> >>>> Mobile : +94 716439774 >>>> Blog :http://christinetechtips.blogspot.com/ >>>> Twitter : https://twitter.com/sohanichristine >>>> >>> >>> >> >> >> -- >> ---------------------------------------------------------- >> >> *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 Tech 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.
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
