Is this correct JSONSchema/Json for the XSD?

2019-06-05 06:16发布

The objective is to convert an XSD schema to JSON Schema. I am first trying to XSD to JSON and then see if i can fix the JSON to become JSON Schema.All this procedure is because right now i don't know a direct way of converting XSD to JSON Schema. Consider the following fragment for now. i have the following fragment of XSD

<attributeGroup name="SimpleObjectAttributeGroup">
    <attribute ref="s:id"/>
    <attribute ref="s:metadata"/>
    <attribute ref="s:linkMetadata"/>
  </attributeGroup>

The corresponding JSON i get is

 "attributeGroup": {
      "name": "SimpleObjectAttributeGroup",
      "attribute": [
        {
          "ref": "s:id"
        },
        {
          "ref": "s:metadata"
        },
        {
          "ref": "s:linkMetadata"
        }
      ]
    }

So my question is

  1. is this right ?
  2. Should i override the attribue ref as $ref instead of @ref (but that would make de serialization tough )
  3. Is this conforming to the JSONSchema specification.

The specification can be found at http://json-schema.org/

i used c# and Json.net to achieve this.

1条回答
beautiful°
2楼-- · 2019-06-05 06:38
     "SimpleObjectAttributeGroup": {          
            {
              "id":{
                     "type":"sometype"
properties of id go here 
                    }
            },
          ....and more properties 
         }
This seems to be the correct JOSNSchema.
查看更多
登录 后发表回答