JSON Schema (Draft-03) conversion to XSD.
$ git clone https://github.com/donniegallardo/jsonschema2xsd.git
$ cd jsonschema2xsd/
$ npm install -g
$ jsonschema2xsd
Example command usage:
Command | Description |
---|---|
jsonschema2xsd -h |
Displays help |
jsonschema2xsd schema.xsd |
Converts schema file to xsd |
jsonschema2xsd -f schema.xsd |
Converts schema file to xsd |
jsonschema2xsd -u https://.../basicschema.json |
Converts schema to xsd |
`cat schema.json | jsonschema2xsd` |
{
"title": "Person",
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"description": "Age in years",
"type": "integer",
"minimum": 0
}
}
}
<?xml version="1.0"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Person">
<xs:complexType>
<xs:sequence>
<xs:element name="firstName" type="xs:string"/>
<xs:element name="lastName" type="xs:string"/>
<!--Age in years-->
<xs:element name="age">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
- Keywords for numbers
- divisibleBy draft-03
- Keywords for strings
- [formatMaximum / formatMinimum and formatExclusiveMaximum / formatExclusiveMinimum] (v5)
- Keywords for arrays
- Keywords for objects
- Keywords for all types
- https://tools.ietf.org/rfcdiff?url1=draft-zyp-json-schema-03.txt&url2=draft-zyp-json-schema-04.txt
- https://docs.oracle.com/cd/E12461_01/140/funtional_artifacts_guide/or-fasg-standards.htm
- http://www.informatik.uni-ulm.de/pm/fileadmin/pm/home/fruehwirth/drafts/Bsc-Nogatz.pdf
- https://github.com/highsource/jsonix-schema-compiler/wiki/JSON-Schema-for-XML-Schema
- https://spacetelescope.github.io/understanding-json-schema/
- https://www.w3.org/TR/xmlschema-0/#OccurrenceConstraints
- http://www.datypic.com/books/defxmlschema/examples.html
- https://devutilsonline.com/xsd-xml/generate-xml-from-xsd
- http://json-schema.org/
It's still a work in progress... Code has not been refactored, prettified or modularized as of this moment. Currently on prototyping phase. No automated test as of the moment.