We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following XML Schema should generate the JSON Schema below.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="root"> <xsd:complexType> <xsd:sequence minOccurs="1"> <xsd:element ref="digit"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="digit" type="AAA" abstract="true"/> <xsd:simpleType name="AAA"> <xsd:restriction base="xsd:integer"> <xsd:minInclusive value="1"/> <xsd:maxInclusive value="9"/> </xsd:restriction> </xsd:simpleType> <xsd:element name="odd" substitutionGroup="digit"> <xsd:simpleType> <xsd:restriction base="AAA"> <xsd:enumeration value="1"/> <xsd:enumeration value="3"/> <xsd:enumeration value="5"/> <xsd:enumeration value="7"/> <xsd:enumeration value="9"/> </xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:element name="even" substitutionGroup="digit"> <xsd:simpleType> <xsd:restriction base="AAA"> <xsd:enumeration value="2"/> <xsd:enumeration value="4"/> <xsd:enumeration value="6"/> <xsd:enumeration value="8"/> </xsd:restriction> </xsd:simpleType> </xsd:element> </xsd:schema>
{ "$schema": "http://json-schema.org/draft-04/schema#", "id": "element-substitution-abstract.json#", "version": "0.0.1", "type": "object", "definitions": {"AAA": { "maximum": 9, "exclusiveMaximum": false, "xsdType": "integer", "xsdMapping": "restrictive", "minimum": 1, "exclusiveMinimum": false, "type": "integer" }}, "oneOf": [ { "properties": {"odd": { "maximum": 9, "enum": [ 1, 3, 5, 7, 9 ], "exclusiveMaximum": false, "xsdType": "integer", "xsdMapping": "restrictive", "xsdEnum": [ { "value": 1, "description": "" }, { "value": 3, "description": "" }, { "value": 5, "description": "" }, { "value": 7, "description": "" }, { "value": 9, "description": "" } ], "minimum": 1, "exclusiveMinimum": false, "type": "integer" }}, "additionalProperties": false, "type": "object", "required": ["odd"] }, { "properties": {"even": { "maximum": 9, "enum": [ 2, 4, 6, 8 ], "exclusiveMaximum": false, "xsdType": "integer", "xsdMapping": "restrictive", "xsdEnum": [ { "value": 2, "description": "" }, { "value": 4, "description": "" }, { "value": 6, "description": "" }, { "value": 8, "description": "" } ], "minimum": 1, "exclusiveMinimum": false, "type": "integer" }}, "additionalProperties": false, "type": "object", "required": ["even"] } ], "additionalProperties": false }
{"odd": 5}
{"even": 4}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The following XML Schema should generate the JSON Schema below.
XML Schema
JSON Schema
Valid JSON Documents
Case 1
Case 2
The text was updated successfully, but these errors were encountered: