json-schema-plugin Maven Mojo

Creates JSON Schema files in Mavens output directory for classes.

License

License

Categories

Categories

Maven Build Tools JSON Data
GroupId

GroupId

de.isc-software.maven
ArtifactId

ArtifactId

json-schema-maven-plugin
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

json-schema-plugin Maven Mojo
Creates JSON Schema files in Mavens output directory for classes.
Project URL

Project URL

https://github.com/bernd-clemenz/json-schema-maven-plugin
Project Organization

Project Organization

ISC Clemenz & Weinbrecht GmbH
Source Code Management

Source Code Management

https://github.com/bernd-clemenz/json-schema-maven-plugin

Download json-schema-maven-plugin

How to add to project

<plugin>
    <groupId>de.isc-software.maven</groupId>
    <artifactId>json-schema-maven-plugin</artifactId>
    <version>1.0.0</version>
</plugin>

Dependencies

compile (8)

Group / Artifact Type Version
com.fasterxml.jackson.core : jackson-core jar 2.10.0
com.fasterxml.jackson.core : jackson-databind jar 2.10.0
com.fasterxml.jackson.core : jackson-annotations jar 2.10.0
com.fasterxml.jackson.datatype : jackson-datatype-jdk8 jar 2.10.0
com.fasterxml.jackson.datatype : jackson-datatype-jsr310 jar 2.10.0
com.fasterxml.jackson.module : jackson-module-jsonSchema jar 2.10.0.pr3
org.apache.commons : commons-lang3 jar 3.9
org.reflections : reflections jar 0.9.11

provided (5)

Group / Artifact Type Version
org.apache.maven : maven-plugin-api jar 3.5.3
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.6.0
org.apache.maven : maven-model jar 3.6.2
org.apache.maven : maven-core jar 3.6.2
org.apache.maven : maven-artifact jar 3.6.2

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.apache.maven.plugin-testing : maven-plugin-testing-harness jar 3.3.0

Project Modules

There are no modules declared in this project.

JSON Schema file generator

This Maven plugin generates JSON-Schema files from POJOs using Jackson.

Prerequisites

  • Java 8 or higher
  • Maven 3.6.2 or higher
  • Jackson in dependencies
  • Model classes annotated with @HyperSchema

Usage

<plugins>
  <!-- your other plugins -->
  <plugin>
    <groupId>de.isc-software.maven</groupId>
    <artifactId>json-schema-maven-plugin</artifactId>
    <version>1.0.0</version>
    <configuration>
      <packagesToScan>
        <item>your.domain</item>
        <item>your.other.domain</item>
      </packagesToScan>
      <baseClassName>your.domain.base.Thing</baseClassName>
      <outputDirectory>META-INF/json-schema</outputDirectory>
    </configuration>
    <executions>
      <execution>
        <id>build-json-schema</id>
        <phase>process-classes</phase>
        <goals>
          <goal>json-schema</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
</plugins>

Goals and phase

  • json-schema is the only goal.
  • process-classes is the mandatory lifecycle phase for this plugin.

Configuration

Name Description
packagesToScan A list of packages, where your model classes exist
baseClassName Fully qualified name of the base class of your model classes
outputDirectory Output directory name, relative to Mavens output path

History

Created for use in some RESTFull API projects, where it proofed helpful.

Notes

For release in Maven repository create signatures:

gpg -ab json-schema-maven-plugin-VERSION.jar
gpg -ab json-schema-maven-plugin-VERSION-javadoc.jar
gpg -ab json-schema-maven-plugin-VERSION-sources.jar

Versions

Version
1.0.0