Is this correct JSONSchema/Json for the XSD?

吃可爱长大的小学妹 提交于 2019-12-08 07:04:54

问题


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:


     "SimpleObjectAttributeGroup": {          
            {
              "id":{
                     "type":"sometype"
properties of id go here 
                    }
            },
          ....and more properties 
         }
This seems to be the correct JOSNSchema.


来源:https://stackoverflow.com/questions/7950702/is-this-correct-jsonschema-json-for-the-xsd

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!