Skip to content

JSON Schema Generation

Jaime Agudo edited this page Oct 30, 2015 · 10 revisions

JSON Schema generation

Warning: JSON Schema generation is an experimental feature. Please use with caution and file issues if you encounter any problems.

Jsonix Schema Compiler supports the generation of the JSON Schema alongside with Jsonix mappings.
The generated JSON Schema naturally matches the generated Jsonix mappings. It can be used to validate JavaScript objects after you unmarshall them from XML or before you marshall the as XML.

Generates Jsonix mappings and JSON Schema for XML Schemas.

Notice you have to install npm install jsonix-schema-compiler as the JAR in Jsonix lib is not the actual as Jsonix was not released for quite a while already.

Example:

java -jar node_modules/jsonix-schema-compiler/lib/jsonix-schema-compiler-full.jar 
    -generateJsonSchema
    -p PO
    schemas/purchaseorder.xsd

Generates:

  • PO.js - Jsonix mappings
  • PO.jsonschema - JSON Schema

Here's a example of the generated JSON Schema.

JSON Schema generation is explained in the following pages:

Clone this wiki locally