/json-schema-podo-generator

Plain Old Data Objects generator framework based on JSON Schema representation

Primary LanguageJavaMIT LicenseMIT

Plain Old Data Objects generator from JSON Schemas

Overview

Code generation tool that generates Plain Old Data Objects with Serialization/Deserialization capabilities. This is a framework that uses mustache templating, using this java library. Starting from a JSON Schema input file, it will generate models that can be further used for interacting with a JSON that matches the specified schema. Heavily inspired from OpenAPI generator.

It is build as a framework, and new languages can be added. This will be detailed separately.

Supported generators

  • C++ - PODOs with RapidJSON serialization/deserialization
  • Java - just PODOs with lombok, no JSON library included by default

Getting started

Basic usage

Run java -jar ./modules/cli-wrapper/target/podo-generator-cli-0.0.1-SNAPSHOT.jar generate -g cpp -i <schema/input/file.json> -o <output/directory>. This will generate the models using cpp generator.

Also see java -jar ./modules/cli-wrapper/target/podo-generator-cli-0.0.1-SNAPSHOT.jar help

Advanced features

Generator specific properties are supported. The available custom properties of a generator can be seen by running java -jar ./modules/cli-wrapper/target/podo-generator-cli-0.0.1-SNAPSHOT.jar config-help -g cpp

For instance, java -jar ./modules/cli-wrapper/target/podo-generator-cli-0.0.1-SNAPSHOT.jar generate -g cpp -i <schema/input/file.json> -o <output/directory> -genprops -ns=my_namespace,-l=mylib will generate the models in the my_namespace namespace, and build mylib module.

Samples

Samples can be found in samples directory.

Authors