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
_______________________________________________
Architecture mailing list
Architecture@wso2.org
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to