对于XSD,这是正确的JSONSchema/Json吗? [英] Is this correct JSONSchema/Json for the XSD?
本文介绍了对于XSD,这是正确的JSONSchema/Json吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
目标是将XSD模式转换为JSON模式. 我首先尝试将XSD转换为JSON,然后查看是否可以将JSON修复为JSON Schema.所有此过程是因为现在我不知道将XSD转换为JSON Schema的直接方法. 现在考虑以下片段. 我有以下XSD片段
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>
我得到的对应JSON是
The corresponding JSON i get is
"attributeGroup": {
"name": "SimpleObjectAttributeGroup",
"attribute": [
{
"ref": "s:id"
},
{
"ref": "s:metadata"
},
{
"ref": "s:linkMetadata"
}
]
}
所以我的问题是
- 这是对的吗?
- 我应该将属性ref替换为$ ref而不是@ref(但是 会使反序列化变得很困难)
- 这是否符合JSONSchema规范.
- is this right ?
- Should i override the attribue ref as $ref instead of @ref (but that would make de serialization tough )
- Is this conforming to the JSONSchema specification.
我使用c#和Json.net来实现这一目标.
i used c# and Json.net to achieve this.
推荐答案
"SimpleObjectAttributeGroup": {
{
"id":{
"type":"sometype"
properties of id go here
}
},
....and more properties
}
This seems to be the correct JOSNSchema.
这篇关于对于XSD,这是正确的JSONSchema/Json吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文