/json-schema-generator

Json Schema generator from a Java Pojo

Primary LanguageJava

json-schema-generator

Json Schema generator from a Java Pojo

How to start?

Add your POJO to the following package com.co.jsonschemagenerator.models or to a package of your preference.

Annotate your class with the following annotation @GenerateJsonSchema.

Run the command line runner application replacing your package in the following command.

mvn spring-boot:run -Dspring-boot.run.arguments="JsonSchemaGenerator com.co.jsonschemagenerator.models DRAFT_2020_12"

Command line runner arguments

mvn spring-boot:run -Dspring-boot.run.arguments="<IMPLEMENTATION_NAME> <PACKAGE_TO_SCAN> <SCHEMA_VERSION>"
<style type="text/css"> .tg {border-collapse:collapse;border-spacing:0;} .tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px; overflow:hidden;padding:10px 5px;word-break:normal;} .tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px; font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;} .tg .tg-0pky{border-color:inherit;text-align:left;vertical-align:top} </style>
argument default description
IMPLEMENTATION_NAME Required. This application relies on Victools Java JSON Schema Generator and Confluent Schema Registry so you can scpecify which implementation do you want to use through the following argument JsonSchemaGenerator for Victools Java JSON Schema Generator and KafkaJsonSchemaGenerator for Confluent Schema Registry.
PACKAGE_TO_SCAN com.co.jsonschemagenerator.models Optional. Package to scan.
SCHEMA_VERSION DRAFT_7 Optional. Required if using JsonSchemaGenerator