Helper for JSON Schema 2 Pojo

Custom annotators to be used along with jsonschema2pojo plugin on Maven. With this custom annotator, you can add lombok and JPA support to generated codes.

Лицензия

Лицензия

Категории

Категории

GNU Compiler for Java Компиляция и сборка
Группа

Группа

io.github.paulushcgcj
Идентификатор

Идентификатор

helper-js2pojo
Последняя версия

Последняя версия

1.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

Helper for JSON Schema 2 Pojo
Custom annotators to be used along with jsonschema2pojo plugin on Maven. With this custom annotator, you can add lombok and JPA support to generated codes.
Ссылка на сайт

Ссылка на сайт

https://paulushcgcj.github.io/
Организация-разработчик

Организация-разработчик

Paulo Gomes da Cruz Junior
Система контроля версий

Система контроля версий

https://github.com/paulushcgcj/helperjs2pojo.git

Скачать helper-js2pojo

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/io.github.paulushcgcj/helper-js2pojo/ -->
<dependency>
    <groupId>io.github.paulushcgcj</groupId>
    <artifactId>helper-js2pojo</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.paulushcgcj/helper-js2pojo/
implementation 'io.github.paulushcgcj:helper-js2pojo:1.0.1'
// https://jarcasting.com/artifacts/io.github.paulushcgcj/helper-js2pojo/
implementation ("io.github.paulushcgcj:helper-js2pojo:1.0.1")
'io.github.paulushcgcj:helper-js2pojo:jar:1.0.1'
<dependency org="io.github.paulushcgcj" name="helper-js2pojo" rev="1.0.1">
  <artifact name="helper-js2pojo" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.paulushcgcj', module='helper-js2pojo', version='1.0.1')
)
libraryDependencies += "io.github.paulushcgcj" % "helper-js2pojo" % "1.0.1"
[io.github.paulushcgcj/helper-js2pojo "1.0.1"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
org.jsonschema2pojo : jsonschema2pojo-core jar 0.5.1
org.hibernate : hibernate-core jar 5.3.5.Final
org.projectlombok : lombok jar 1.18.2

Модули Проекта

Данный проект не имеет модулей.

HelperJS 2 Pojo

pipeline status coverage report Sonar Coverage Quality Gate Status

Maven Central Bintray GitHub release

This package is intended to be used as custom Annotator to JsonSchema2Pojo.

With this custom annotator, you can add lombok and JPA support to generated codes.

For released versions go directly to maven central

How to use it

In your pom.xml file, add the following inside your build plugins entry, replacing where needed:

<plugin>
    <groupId>org.jsonschema2pojo</groupId>
    <artifactId>jsonschema2pojo-maven-plugin</artifactId>
    <version>0.5.1</version>
    <dependencies>
        <dependency>
            <groupId>io.github.paulushcgcj</groupId>
            <artifactId>helper-js2pojo</artifactId>
            <version>X.Y.Z</version>
        </dependency>
    </dependencies>
    <configuration>
        <removeOldOutput>true</removeOldOutput>
        <useCommonsLang3>true</useCommonsLang3>
        <includeConstructors>false</includeConstructors>
        <includeAccessors>false</includeAccessors>
        <includeAdditionalProperties>false</includeAdditionalProperties>
        <includeJsr303Annotations>true</includeJsr303Annotations>
        <sourceDirectory>${basedir}/src/main/resources/your_folder_here</sourceDirectory>
        <targetPackage>your.package.folder.structure.here</targetPackage>
        <outputDirectory>${basedir}/target/generated-sources/your_folder_here</outputDirectory>
        <propertyWordDelimiters>-</propertyWordDelimiters>
        <customAnnotator>full.path.to.annotator</customAnnotator>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Annotators

You can choose the annotator that best suits your needs. Below you will find all annotators found on this package:

Lombok

The io.github.paulushcgcj.js2pojo.LombokAnnotator annotator will add Lombok dependencies to your generated file, removing that bunch of boilerplate code, replacing it with Lombok annotations. With this you will end up with a much more cleaner code.

JPA

If you need to add some of the JPA annotations, like @Entity and @Id, all you have to do is add the custom annotator io.github.paulushcgcj.js2pojo.HibernateAnnotator. Also you will need to add to your schema an entry marking it with entity as true.

Ex:

{
  "$id": "https://example.com/person.schema.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Person",
  "type": "object",
  "properties": {
    "entity": true,
    "firstName": {
      "type": "string",
      "description": "The person's first name."
    },
    "lastName": {
      "type": "string",
      "description": "The person's last name."
    },
    "age": {
      "description": "Age in years which must be equal to or greater than zero.",
      "type": "integer",
      "minimum": 0
    }
  }
}

Lobok + JPA

If you want just a single annotator that gives you both worlds, you can use the io.github.paulushcgcj.js2pojo.HibernateLombokAnnotator and have both things in the same annotator.

Версии библиотеки

Версия
1.0.1