Thanks Nuwan

On Tue, May 17, 2016 at 3:26 PM, Nuwan Pallewela <[email protected]> wrote:

> Hi Shakila,
>
> We can use "http:\/\/wso2jsonschema.org\/root\/0" as the id here. As log
> as it is unique from other sub-schema's it is ok to use any value as the
> id. But it is better to go with a convention.
>
> Thanks,
> Nuwan
>
> On Tue, May 17, 2016 at 3:11 PM, Shakila Sivagnanarajah <[email protected]>
> wrote:
>
>> Thanks Nuwan,
>>
>> In the id of the items element, the *ids *is the name of the root
>> element. So what would be the id here?
>>
>>   "id":"http:\/\/wso2jsonschema.org\/*ids*\/0",
>>
>> Thanks
>>
>> On Tue, May 17, 2016 at 2:49 PM, Nuwan Pallewela <[email protected]> wrote:
>>
>>> Hi Shakila,
>>>
>>> The JSON schema for above mention payload [1] should be as follows.
>>>
>>> {
>>>    "id":"http:\/\/wso2jsonschema.org",
>>>    "title":"root",
>>>    "$schema":"http:\/\/json-schema.org\/draft-04\/schema#",
>>>    "items":[
>>>       {
>>>          "id":"http:\/\/wso2jsonschema.org\/ids\/0",
>>>          "type":"string"
>>>       }
>>>    ],
>>>    "type":"array"
>>> }
>>>
>>> Schema title represent the name for the most outer JSON element. In this
>>> case we give the name as root and it is a array. So the "type" attribute
>>> should be "array".
>>>
>>> And then the "items" list down the type of elements in the array, in
>>> this case they are string elements.
>>>
>>> Thanks,
>>> Nuwan
>>>
>>> On Tue, May 17, 2016 at 2:30 PM, Shakila Sivagnanarajah <
>>> [email protected]> wrote:
>>>
>>>> Hi,
>>>>
>>>> If the payload does not contain the root element, It is not loading the
>>>> file to generate the schema as reported in [1]. I manually added a root
>>>> element and a child element in the payload [2] as shown in [3] and
>>>> generated the schema [4]. Then I deleted the root element and child
>>>> (highlighted parts in [4]). The final schema looks like [5]. Could you
>>>> please make sure that the output schema [5] is in a correct format?
>>>>
>>>> [1] https://wso2.org/jira/browse/DEVTOOLESB-226
>>>>
>>>> [2]
>>>> [
>>>> "777925",
>>>> "732321"
>>>> ]
>>>>
>>>> [3]
>>>> {
>>>> "rootelem": [
>>>> "777925",
>>>> "732321"
>>>> ],
>>>> "dummychild": "dummyval"
>>>> }
>>>>
>>>> [4]
>>>> {
>>>> "id": "http:\/\/wso2jsonschema.org",
>>>> "title": "root",
>>>> "$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
>>>> "properties": {
>>>> "rootelem": {
>>>> "id": "http:\/\/wso2jsonschema.org\/rootelem",
>>>> "items": [
>>>> {
>>>> "id": "http:\/\/wso2jsonschema.org\/rootelem\/0",
>>>> "type": "string"
>>>> }
>>>> ],
>>>> "type": "array"
>>>> },
>>>> "dummychild": {
>>>> "id": "http:\/\/wso2jsonschema.org\/dummychild",
>>>> "type": "string"
>>>> }
>>>> },
>>>> "type": "object"
>>>> }
>>>>
>>>> [5]
>>>> {
>>>> "id": "http:\/\/wso2jsonschema.org",
>>>> "title": "root",
>>>> "$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
>>>> "properties": {
>>>> "items": [
>>>> {
>>>> "id": "http:\/\/wso2jsonschema.org\/ids\/0",
>>>> "type": "string"
>>>> }
>>>> ]
>>>> },
>>>> "type": "object"
>>>> }
>>>>
>>>>
>>>> Thank you
>>>> --
>>>> Shakila Sivagnanarajah
>>>> Associate Software Engineer
>>>> Mobile :+94 (0) 768 856837
>>>> [email protected]
>>>>
>>>
>>>
>>>
>>> --
>>> ----------------------------------------------------------
>>>
>>> *Nuwan Chamara Pallewela*
>>>
>>>
>>> *Software Engineer*
>>>
>>> *WSO2, Inc. *http://wso2.com
>>> *lean . enterprise . middleware*
>>>
>>> Email   *[email protected] <[email protected]>*
>>> Mobile  *+94719079739 <%2B94719079739>@*
>>>
>>>
>>>
>>
>>
>> --
>> Shakila Sivagnanarajah
>> Associate Software Engineer
>> Mobile :+94 (0) 768 856837
>> [email protected]
>>
>
>
>
> --
> ----------------------------------------------------------
>
> *Nuwan Chamara Pallewela*
>
>
> *Software Engineer*
>
> *WSO2, Inc. *http://wso2.com
> *lean . enterprise . middleware*
>
> Email   *[email protected] <[email protected]>*
> Mobile  *+94719079739 <%2B94719079739>@*
>
>
>


-- 
Shakila Sivagnanarajah
Associate Software Engineer
Mobile :+94 (0) 768 856837
[email protected]
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to