Hi All, As per the offline discussion we had, we have finalized the array representation as below.
If we consider an xml which contains an array of Ids, the json schema representation would be as follows <queryMoreResponse> <result type="QueryResult"> <done>false</done> <queryLocator>01gD0000001vELkIAM-400</queryLocator> <records> * <Id>001D000000HS2PPIA1</Id>* * <Id>001D000000HS2PPIA1</Id>* </records> <size>427</size> </result> </queryMoreResponse> "sf:records": { "id": "http://jsonschema.net/queryMoreResponse/result/sf:records", "type": "array", "items": [{ "id": "http://jsonschema.net/queryMoreResponse/result/sf:records/0", "type": "object", "properties": { "sf:Id": { "id": "http://jsonschema.net/queryMoreResponse/result/sf:records/0/sf:Id", "type": "array", *"items": [{* * "id": "http://jsonschema.net/queryMoreResponse/result/sf:records/0/sf:Id/0 <http://jsonschema.net/queryMoreResponse/result/sf:records/0/sf:Id/0>",* * "type": "string"* * }]* }, "sf:type": { "id": "http://jsonschema.net/queryMoreResponse/result/sf:records/0/sf:type", "type": "string" }, "sf:Name": { "id": "http://jsonschema.net/queryMoreResponse/result/sf:records/0/sf:Name", "type": "string" }, "@type": { "id": "http://jsonschema.net/queryMoreResponse/result/sf:records/0/@type", "type": "string" } } }] } Sohani Weerasinghe Software Engineer WSO2, Inc: http://wso2.com Mobile : +94 716439774 Blog :http://christinetechtips.blogspot.com/ Twitter : https://twitter.com/sohanichristine On Wed, Mar 23, 2016 at 11:56 AM, Sohani Weerasinghe <soh...@wso2.com> wrote: > Hi All, > > As per the offline discussion we had, we have finalized the array > representation as below. > > If we consider an xml which contains an array of Ids, the json schema > representation would be as follows > > <queryMoreResponse> > <result type="QueryResult"> > <done>false</done> > <queryLocator>01gD0000001vELkIAM-400</queryLocator> > <records> > * <Id>001D000000HS2PPIA1</Id>* > * <Id>001D000000HS2PPIA1</Id>* > </records> > <size>427</size> > </result> > </queryMoreResponse> > > > > "sf:records": { > "id": "http://jsonschema.net/queryMoreResponse/result/sf:records", > "type": "array", > "items": [{ > "id": "http://jsonschema.net/queryMoreResponse/result/sf:records/0", > "type": "object", > "properties": { > "sf:Id": { > "id": "http://jsonschema.net/queryMoreResponse/result/sf:records/0/sf:Id", > "type": "array", > "items": [{ > "id": "http://jsonschema.net/queryMoreResponse/result/sf:records/0/sf:Id/0 > ", > "type": "string" > }] > }, > "sf:type": { > "id": "http://jsonschema.net/queryMoreResponse/result/sf:records/0/sf:type > ", > "type": "string" > }, > "sf:Name": { > "id": "http://jsonschema.net/queryMoreResponse/result/sf:records/0/sf:Name > ", > "type": "string" > }, > "@type": { > "id": "http://jsonschema.net/queryMoreResponse/result/sf:records/0/@type", > "type": "string" > } > } > }] > } > > > > Sohani Weerasinghe > Software Engineer > WSO2, Inc: http://wso2.com > > Mobile : +94 716439774 > Blog :http://christinetechtips.blogspot.com/ > Twitter : https://twitter.com/sohanichristine > > On Wed, Mar 23, 2016 at 10:00 AM, Susinda Perera <susi...@wso2.com> wrote: > >> Hi Sohani >> >> I do not think this is a correct representation, >> *"items": [] , *this says id is an empty array, but it is not (in this >> example it has 2, and also it has some value inside id tag, which is string >> in this example. if we say its empty array we loose all these information. >> Therefore i believe it should be something like below. >> >> *"items": [{* >> * "id": >> "http://jsonschema.net/queryMoreResponse/result/sf:records/0/sf:Id/0 >> <http://jsonschema.net/queryMoreResponse/result/sf:records/0/sf:Id/0>",* >> * "type": "string"* >> * }]* >> >> >> >> On Mon, Mar 21, 2016 at 9:18 PM, Sohani Weerasinghe <soh...@wso2.com> >> wrote: >> >>> Hi All, >>> >>> As per the offline discussion we had, please find the summary of >>> representing the arrays in JSON Schema. >>> >>> If we consider an xml which contains an array of Ids, (Id) which does >>> not contain any items inside it, >>> >>> eg: >>> <queryMoreResponse> >>> <result type="QueryResult"> >>> <done>false</done> >>> <queryLocator>01gD0000001vELkIAM-400</queryLocator> >>> <records> >>> * <Id>001D000000HS2PPIA1</Id>* >>> * <Id>001D000000HS2PPIA1</Id>* >>> </records> >>> <size>427</size> >>> </result> >>> </queryMoreResponse> >>> >>> Then, the expected json schema should be as follows >>> >>> "sf:records": { >>> "id": "http://jsonschema.net/queryMoreResponse/result/sf:records", >>> "type": "array", >>> "items": [{ >>> "id": "http://jsonschema.net/queryMoreResponse/result/sf:records/0", >>> "type": "object", >>> "properties": { >>> "sf:Id": { >>> "id":"http://jsonschema.net/queryMoreResponse/result/sf:records/0/sf:Id >>> ", >>> "type": "array", >>> *"items": []* >>> } >>> } >>> }] >>> } >>> >>> If we have elements inside, then we can add those as items accordingly. >>> >>> Please find the image which represents the array as shown below >>> >>> >>> >>> Thanks, >>> Sohani >>> >>> Sohani Weerasinghe >>> Software Engineer >>> WSO2, Inc: http://wso2.com >>> >>> Mobile : +94 716439774 >>> Blog :http://christinetechtips.blogspot.com/ >>> Twitter : https://twitter.com/sohanichristine >>> >> >> >> >> -- >> *Susinda Perera* >> Software Engineer >> B.Sc.(Eng), M.Sc(Computer Science), AMIE(SL) >> Mobile:(+94)716049075 >> Blog: susinda.blogspot.com >> WSO2 Inc. http://wso2.com/ >> Tel : 94 11 214 5345 Fax :94 11 2145300 >> >> >
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev