Json Schema generator from a Java Pojo
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"
mvn spring-boot:run -Dspring-boot.run.arguments="<IMPLEMENTATION_NAME> <PACKAGE_TO_SCAN> <SCHEMA_VERSION>"
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 |