An open API service indexing awesome lists of open source software.

https://github.com/jsonschema2dataclass/js2d-gradle

Extended Jsonschema2Pojo gradle plugin
https://github.com/jsonschema2dataclass/js2d-gradle

generator gradle-plugin java json json-schema jsonschema2pojo model-generator models pojo pojo-builder

Last synced: 20 days ago
JSON representation

Extended Jsonschema2Pojo gradle plugin

Awesome Lists containing this project

README

          

:toc:
:toc-placement: preamble
:toclevels: 1
:showtitle:

:plugin_major: 6

= Json Schema to Data Class Gradle plugin

image:https://img.shields.io/github/v/release/jsonschema2dataclass/js2d-gradle[GitHub release (latest by date)]

// Need some preamble to get TOC:
{empty}

== Introduction

This plugin is aiming to take raw JSON or YAML raw files or schemas and convert definitions to Java POJOs
(Plain Old Java Object).

At the moment of writing documentation, it uses
https://github.com/joelittlejohn/jsonschema2pojo[jsonschema2pojo] 1.2.2 library to generate classes.

The `org.jsonschema2dataclass` plugin feature highlight:

* Full support and testing for wide version range of versions of Java, Gradle and AGP
including task caching, proper hooking and other features.
+
Currently, it's Java 1.8 to 19, Gradle 6.0 to 7.6 and AGP 3, 4 and 7.
Additionally, plugin has beta support for Gradle 8.0 and AGP 8.

* Possibility natively write Gradle scripts in Groovy and Kotlin DSLs.
* Support for projects written in Kotlin and Groovy and which are using Lombok.
* Possibility to run multiple executions within a single project.
+
This is important for some use cases to generate different sets of models within a single project.
* Some parameters are more human-writable and using native features provided by Gradle.
+
--
.Few examples
** `propertyWordDelimiters` is array of chars in `jsonschema2pojo`, which is not easy to write and support.
** `org.jsonschema2dataclass` uses Gradle-provided structures for all configuration parameters.
--
* Plugin is not tied to the library interface and could provide more maintainable configuration presentation
and wider feature range when needed.

Please note, that JSON schema constrains can be quite poorly translated to JSR305 and in most cases
can't replace Json Schema Validation.
I suggest to use a Json Schema Validation library when possible like one
https://github.com/networknt/json-schema-validator[by NetworkNT].

== Usage and migration information for {plugin_major}.x

Usage and migration documentation is located in separate documents.

* xref:docs/usage/basic_{plugin_major}.adoc[Basic usage for {plugin_major}.x]
* xref:docs/usage/parameters_{plugin_major}.adoc[Parameters for {plugin_major}.x]
* xref:docs/migration/migration_{plugin_major}.adoc[Migration guide for {plugin_major}.x]

== Usage and migration information for all versions

Usage and migration documentation is located in separate documents.

* xref:docs/usage/index.adoc[Usage documentation for all versions]
* xref:docs/migration/migration.adoc[Migration guides for all versions]