Hi Viraj,

Thanks for the input. Please find the comments inline

Sohani Weerasinghe
Software Engineer
WSO2, Inc: http://wso2.com

Mobile  : +94 716439774
Blog     :http://christinetechtips.blogspot.com/
Twitter  : https://twitter.com/sohanichristine

On Sat, Apr 30, 2016 at 1:51 PM, Viraj Rajaguru <vi...@wso2.com> wrote:

> Hi Sohani,
>
> Few suggestions,
>
> 1. Lets change value of "type" from "array" to "object" in "urn:sObjects,
> xsi:type=urn1:Contact" and "urn:sObjects, xsi:type=urn1:Account" as we are
> not considering this as an array of "urn:sObjects" but two different
> elements.
>
> Eg:
>
> "urn:sObjects, xsi:type=urn1:Contact":{
>        "id":"
> http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects";,
>         "type":"object",
>         .......
>
+1 Let's do like that. But if this is inside an array, then this should be
serialized inside the properties block of the items block


>
> 2. Remove the space in "urn:sObjects, xsi:type=urn1:Contact" field name.
> Lets change it to "urn:sObjects,xsi:type=urn1:Contact"
>

A space has been added to clearly identify the name and the element
identifier, but let's remove it and I also think it's better

>
> 3. Change "id" value from "id":"
> http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects"; to "id":"
> http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects,xsi:type=urn1:Contact";
> and "id":"
> http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects,xsi:type=urn1:Account";
> accordingly as now "urn:sObjects,xsi:type=urn1:Contact" and
> "urn:sObjects,xsi:type=urn1:Account" are the unique identifiers not the
> "urn:sObjects"
>
> 4. In the graphical representation users are not suppose to map value of
> xsi:type attribute to another. It's kind of a metadata. So that I think
> it's better hide xsi:type attribute from input/output tree.
>

I have added this to the tree view as an attribute since as I remember we
discussed that there can be use cases. @nuwan can you please confirm?  If
we don't have such use cases we can simply remove this when generating the
schema so that it will not represent in the tree

>
> Thanks.
> Viraj.
>
>
>
> On Thu, Apr 28, 2016 at 3:07 PM, Sohani Weerasinghe <soh...@wso2.com>
> wrote:
>
>> Hi All,
>>
>> We are in a process of supporting the xsi:type in JSON Schema and please
>> find the below implementation details.
>>
>> *Input*:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <soapenv:Envelope xmlns:soapenv="
>> http://schemas.xmlsoap.org/soap/envelope/"; xmlns:urn="urn:
>> enterprise.soap.sforce.com" xmlns:urn1="urn:
>> sobject.enterprise.soap.sforce.com" xmlns:xsi="
>> http://www.w3.org/2001/XMLSchema-instance";>
>>    <soapenv:Header>
>>       <urn:SessionHeader>
>>          <urn:sessionId>QwWsHJyTPW.1pd0_jXlNKOSU</urn:sessionId>
>>       </urn:SessionHeader>
>>    </soapenv:Header>
>>    <soapenv:Body>
>>       <urn:create>
>>        *  <urn:sObjects xsi:type="urn1:Contact">*
>> *            <!--Zero or more repetitions:-->*
>> *            <!--You may enter ANY elements at this point-->*
>> *            <AccountId>001D000000HRzKD</AccountId>*
>> *            <FirstName>Jane</FirstName>*
>> *            <LastName>Doe</LastName>*
>> *         </urn:sObjects>*
>>         * <urn:sObjects xsi:type="urn1:Account">*
>> *            <Name>Acme Rockets, Inc.</Name>*
>> *         </urn:sObjects>*
>>       </urn:create>
>>    </soapenv:Body>
>> </soapenv:Envelope>
>>
>>
>> *Generated JSON schema via the Data Mapper editor :*
>>
>> {
>>    "$schema":"http://json-schema.org/draft-04/schema#";,
>>    "id":"http://wso2jsonschema.org";,
>>    "title":"soapenv:Envelope",
>>    "type":"object",
>>   * "elementIdentifiers":[  *
>> *      {  *
>> *         "type":"xsi:type"*
>> *      }*
>> *   ],*
>>    "properties":{
>>       "soapenv:Body":{
>>          "id":"http://wso2jsonschema.org/soapenv:Body";,
>>          "type":"object",
>>          "properties":{
>>             "urn:create":{
>>                "id":"http://wso2jsonschema.org/soapenv:Body/urn:create";,
>>                "type":"object",
>>                "properties":{
>>                  * "urn:sObjects, xsi:type=urn1:Contact":{  *
>> *
>>  "id":"http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects
>> <http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects>",*
>> *                     "type":"array",*
>> *                     "items":[  *
>> *                        {  *
>> *                           "attributes":{  *
>> *                              "xsi:type":{  *
>> *
>>  
>> "id":"http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects/0/xsi:type
>> <http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects/0/xsi:type>",*
>> *                                 "type":"string"*
>> *                              }*
>> *                           },*
>> *
>>  "id":"http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects/0
>> <http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects/0>",*
>> *                           "type":"object",*
>> *                           "value":{  *
>> *                              "type":"string"*
>> *                           },*
>> *                           "properties":{  *
>> *                              "AccountId":{  *
>> *
>>  
>> "id":"http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects/0/AccountId
>> <http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects/0/AccountId>",*
>> *                                 "type":"string"*
>> *                              },*
>> *                              "FirstName":{  *
>> *
>>  
>> "id":"http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects/0/FirstName
>> <http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects/0/FirstName>",*
>> *                                 "type":"string"*
>> *                              },*
>> *                              "LastName":{  *
>> *
>>  
>> "id":"http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects/0/LastName
>> <http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects/0/LastName>",*
>> *                                 "type":"string"*
>> *                              }*
>> *                           }*
>> *                        }*
>> *                     ]*
>> *                  },*
>>                  * "urn:sObjects, xsi:type=urn1:Account":{  *
>> *
>>  "id":"http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects
>> <http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects>",*
>> *                     "type":"array",*
>> *                     "items":[  *
>> *                        {  *
>> *                           "attributes":{  *
>> *                              "xsi:type":{  *
>> *
>>  
>> "id":"http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects/0/xsi:type
>> <http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects/0/xsi:type>",*
>> *                                 "type":"string"*
>> *                              }*
>> *                           },*
>> *
>>  "id":"http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects/0
>> <http://wso2jsonschema.org/soapenv:Body/urn:create/urn:sObjects/0>",*
>> *                           "type":"object",*
>> *                           "value":{  *
>> *                              "type":"string"*
>> *                           }*
>> *                        }*
>> *                     ]*
>> *                  }*
>> *               }*
>> *            }*
>> *         }*
>>       },
>>       "soapenv:Header":{
>>          "id":"http://wso2jsonschema.org/soapenv:Header";,
>>          "type":"object",
>>          "properties":{
>>             "urn:SessionHeader":{
>>                "id":"
>> http://wso2jsonschema.org/soapenv:Header/urn:SessionHeader";,
>>                "type":"object",
>>                "properties":{
>>                   "urn:sessionId":{
>>                      "id":"
>> http://wso2jsonschema.org/soapenv:Header/urn:SessionHeader/urn:sessionId
>> ",
>>                      "type":"string"
>>                   }
>>                }
>>             }
>>          }
>>       }
>>    },
>>    "namespaces":[
>>       {
>>          "prefix":"soapenv",
>>          "url":"http://schemas.xmlsoap.org/soap/envelope/";
>>       },
>>       {
>>          "prefix":"urn",
>>          "url":"urn:enterprise.soap.sforce.com"
>>       },
>>       {
>>          "prefix":"xsi",
>>          "url":"http://www.w3.org/2001/XMLSchema-instance";
>>       },
>>       {
>>          "prefix":"urn1",
>>          "url":"urn:sobject.enterprise.soap.sforce.com"
>>       }
>>    ]
>> }
>>
>> *Created tree:*
>>
>> Please find more details on the implementation at [1]
>>
>> [1] Issues with JSON Schema in representing data types and in
>> representing an array which contains non identical elements
>>
>> Thanks,
>> Sohani
>> *​*
>>
>>
>> Sohani Weerasinghe
>> Software Engineer
>> WSO2, Inc: http://wso2.com
>>
>> Mobile  : +94 716439774
>> Blog     :http://christinetechtips.blogspot.com/
>> Twitter  : https://twitter.com/sohanichristine
>>
>
>
>
> --
> Viraj Rajaguru
> Senior Software Engineer
> WSO2 Inc. : http://wso2.com
>
> Mobile: +94 77 3683068
>
>
>
>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to