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",
.......
2. Remove the space in "urn:sObjects, xsi:type=urn1:Contact" field name.
Lets change it to "urn:sObjects,xsi:type=urn1:Contact"
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.
Thanks.
Viraj.
On Thu, Apr 28, 2016 at 3:07 PM, Sohani Weerasinghe <[email protected]> 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
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture