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 25, 2016 at 2:48 PM, Nuwan Pallewela <nuw...@wso2.com> wrote: > Hi Sohani, > > On Wed, May 25, 2016 at 11:03 AM, Sohani Weerasinghe <soh...@wso2.com> > wrote: > >> Hi All, >> >> Since there can be JSON payloads without a root element as shown below, >> we are in a process of generating the JSON schema for such payloads. Please >> find the implementation details >> >> eg 1: >> >> *Input*: >> >> [ >> "777925", >> "732321" >> ] >> >> *JSON schema:* >> >> { >> "$schema" : "http://json-schema.org/draft-04/schema#", >> "id" : "http://wso2jsonschema.org", >> "title" : "root", >> "type" : "array", >> "items" : { >> "id" : "http://wso2jsonschema.org/0", >> "type" : "string" >> } >> } >> >> >> I think this primitive array should be able to map. > Yes, This should be able to map and I'm in a process of implementing it > eg 2: >> >> *Input*: >> >> [ >> { >> "id": 0, >> "species": "Capra hircus", >> "name": "Goat" >> }, >> { >> "id": 1, >> "species": "Panthera pardus", >> "name": "Leopard" >> }, >> { >> "id": 2, >> "species": "Equus zebra", >> "name": "Zebra" >> } >> ] >> >> *JSON Schema:* >> >> { >> "$schema" : "http://json-schema.org/draft-04/schema#", >> "id" : "http://wso2jsonschema.org", >> "title" : "root", >> "type" : "array", >> "items" : { >> "id" : "http://wso2jsonschema.org/0", >> "type" : "object", >> "properties" : { >> "species" : { >> "id" : "http://wso2jsonschema.org/0/species", >> "type" : "string" >> }, >> "name" : { >> "id" : "http://wso2jsonschema.org/0/name", >> "type" : "string" >> }, >> "id" : { >> "id" : "http://wso2jsonschema.org/0/id", >> "type" : "number" >> } >> } >> } >> } >> >> >> 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 *nuw...@wso2.com <nuw...@wso2.com>* > Mobile *+94719079739 <%2B94719079739>@* > > >
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev