Skip to content
highsource edited this page Dec 24, 2014 · 5 revisions

NPM usage

The Jsonix package on NPM includes the schema compiler (under lib/jsonix-schema-compiler-full.jar). So you can invoke the schema compiler via [[command line|Command-Line Usage] as follows:

java -jar node_modules/jsonix/lib/jsonix-schema-compiler-full.jar schema.xsd

Typical usage is as follows:

  • Make your package depend on jsonix.
  • Invoke the Jsonix Schema Compiler in the scripts/preinstall

Example

{
	"name": "mypackage",
	...
	"dependencies": {
		...
		"jsonix": "~<VERSION>"
		...
	},
	...
	"scripts": {
		...
		"preinstall" : "java -jar node_modules/jsonix/lib/jsonix-schema-compiler-full.jar schema.xsd"
		...
	}
	...
}
Clone this wiki locally