Hi All,

We are in a process of implementing the $subject and please find the
implementation details.

*Input*:

<h:person xmlns:h="http://www.w3.org/TR/html4/";>
<firstName>sample</firstName>
<phone primary="false">0112655655<ext>01</ext></phone>
<phone primary="false">0112655655<ext>01</ext></phone>
</h:person>

After loading the above payload, the generated schema will be as follows

{
  "$schema" : "http://json-schema.org/draft-04/schema#";,
  *"nullable" : "false"*,
  "id" : "http://wso2jsonschema.org";,
  "title" : "h:person",
  "type" : "object",
  "properties" : {
    "firstName" : {
      *"nullable" : "false",*
      "id" : "http://wso2jsonschema.org/firstName";,
      "type" : "string"
    },
    *"nullable" : "false"*,
    "phone" : {
      "id" : "http://wso2jsonschema.org/phone";,
      "type" : "array",
      "items" : [ {
        "attributes" : {
          "primary" : {
           * "nullable" : "false"*,
            "id" : "http://wso2jsonschema.org/phone/0/primary";,
            "type" : "boolean"
          }
        },
        "id" : "http://wso2jsonschema.org/phone/0";,
        "type" : "object",
        "value" : {
          "type" : "number"
        },
        "properties" : {
          "ext" : {
           * "nullable" : "false",*
            "id" : "http://wso2jsonschema.org/phone/0/ext";,
            "type" : "number"
          }
        }
      } ]
    }
  },
  "namespaces" : [ {
    "prefix" : "h",
    "url" : "http://www.w3.org/TR/html4/";
  } ]
}

Then, user can right click on the node and click on 'Enable Nullable' and
make the object or array or element, etc nullable.


​The schema will be as follows

{
  "$schema" : "http://json-schema.org/draft-04/schema#";,
 * "nullable" : "true",*
  "id" : "http://wso2jsonschema.org";,
  "title" : "h:person",
  "type" : "object",
  "properties" : {
    "firstName" : {
      "nullable" : "false",
      "id" : "http://wso2jsonschema.org/firstName";,
      "type" : "string"
    },
    "nullable" : "false",
    "phone" : {
      "id" : "http://wso2jsonschema.org/phone";,
      "type" : "array",
      "items" : [ {
        "attributes" : {
          "primary" : {
            "nullable" : "false",
            "id" : "http://wso2jsonschema.org/phone/0/primary";,
            "type" : "boolean"
          }
        },
        "id" : "http://wso2jsonschema.org/phone/0";,
        "type" : "object",
        "value" : {
          "type" : "number"
        },
        "properties" : {
          "ext" : {
            "nullable" : "false",
            "id" : "http://wso2jsonschema.org/phone/0/ext";,
            "type" : "number"
          }
        }
      } ]
    }
  },
  "namespaces" : [ {
    "prefix" : "h",
    "url" : "http://www.w3.org/TR/html4/";
  } ]
}

If a user wants to disable it then, user can right click on the node and
click on 'Disable Nullable'


​
After enabling, we thought of changing the icon of the tree node so that
user can easily identify whether a particular node is a nullable or not.

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

Mobile  : +94 716439774
Blog     :http://christinetechtips.blogspot.com/
Twitter  : https://twitter.com/hanichristine
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to