jsonschema - How to handle @Ref from XSD in JSON Schema -


given following basic example of text element references para element , para element references para element.

i'm wondering if i'm correctly representing in json schema?

<xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema">    <xs:element name="text">     <xs:complextype>       <xs:sequence>         <xs:element ref="para"/>       </xs:sequence>     </xs:complextype>   </xs:element>   <xs:element name="para">     <xs:complextype mixed="true">       <xs:choice minoccurs="0" maxoccurs="unbounded">         <xs:element ref="para"/>       </xs:choice>       <xs:attribute name="id" type="xs:id"/>     </xs:complextype>   </xs:element> </xs:schema> 

i think has done style { "$ref": "#/definitions/diskdevice" }, http://json-schema.org/example2.html.

is correct?

{  "id": "http://some.site.somewhere/entry-schema#",  "$schema": "http://json-schema.org/draft-04/schema#",  "title": "text",  "type": "object",  "properties": {    "$ref": "#/definitions/para"  },  "definitions": {"para": {   "required": true,   "type": "object",   "properties": {    "id": {     "type": "string",     "required": true    },    "$ref": "#/definitions/para"    }   }  } } 

thanks

that form of referencing correct. not only way organise things, way recommend.

you have bug in schema, though - have "$ref" directly inside "properties". presumably not defining property called "$ref" in data, meant inside property declaration?


Comments

Popular posts from this blog

design - Custom Styling Qt Quick Controls -

Unable to remove the www from url on https using .htaccess -