Repository navigation
Home
Damian Malczewski edited this page Sep 13, 2026
·
2 revisions
ModelMaker turns small schema files into immutable Java DTOs - a final class with no setters, a builder,
equals / hashCode / toString - plus optional Kotlin mutate { } extensions.
It exists because:
- Hand-written DTOs drift from the contract, and keeping them immutable and correct is tedious.
- Full code generators produce heavy, mutable or framework-coupled types. ModelMaker emits the plain POJOs you would have written by hand.
- One schema feeds several concerns - JSON binding (Jackson), runtime validation (
jakarta.validation), API docs (OpenAPI@Schema) - toggled per project or per schema instead of re-specified by hand.
The Gradle plugin is the intended entry point: drop schemas under src/main/model, build, and the
generated types are on the main source set.
- Getting Started - apply the plugin, write a first schema, build, see the output.
- Examples - the runnable sample builds shipped in the repository.
- Schema Format - every top-level and per-property key.
-
Property Types - what each
typerenders as,$ref, arrays, nested objects. - Property Naming - accepted key forms and how they map to Java field names.
- Generated Java Code - anatomy of a generated class, member by member.
-
Kotlin Extensions - the generated
mutate { }DSL and how to turn it on.
- Feature Configuration - the three-level precedence model and annotation placement.
- Jackson - annotations emitted, constructor visibility, Jackson 2 / 3.
-
Validation - schema keyword to
jakarta.validationannotation mapping. -
OpenAPI - what ends up in
@Schema, and what deliberately does not.
- Gradle Plugin - full DSL, tasks, output locations, caching behavior.
- Library Usage - driving the core generator without Gradle.
- Troubleshooting - error messages and what causes them.
- FAQ - short answers to recurring questions.
- Development - building the project itself, module layout, conventions.
plugins {
id("io.github.malczuuu.modelmaker") version "..."
}
modelmaker {
features {
jackson { enabled = true }
validation { enabled = true }
}
}src/main/model/
└── com.example.dto.Person.json ← you write this
build/generated/sources/modelmaker/java/main/
└── com/example/dto/Person.java ← ModelMaker writes this
Generated models support simple types only - the ones most likely to serialize and deserialize cleanly between a
Java object and JSON. An enum, for example, becomes a plain String field with a generated @Pattern over the
allowed values. See Property Types for the full list, and FAQ for the reasoning.
ModelMaker - Apache License 2.0 - Issues - Wiki index
Start here
Schemas
Output
Features
Integration
Reference