Repository navigation
Examples
The repository ships standalone Gradle builds under examples/, each applying the plugin from mavenLocal(). They
are not part of the root build - they are consumers, exercising the published plugin the way a real project
would.
./gradlew publishToMavenLocal # publish the plugin and core to ~/.m2
examples/buildAll build # run `build` in every exampleexamples/buildAll <tasks> forwards its arguments to each example's own wrapper, so examples/buildAll clean build
or examples/buildAll generateModelJava work too. A single example can be built on its own:
cd examples/example-validation
./gradlew build-
example-jackson- thejacksonfeature against Jackson 3 (tools.jackson), plus Kotlinmutate. Includes a round-trip test. -
example-validation- thevalidationfeature andjakarta.validationconstraints, with a Hibernate Validator test. -
example-openapi-jackson+validation+openApion one type: OpenAPI@Schemaalongside the other two. -
example-mutator- Kotlinmutate { }extensions, including one for a nested type.
Seven schemas covering the shape of the format: a simple two-field type, a nested object, a nested list of objects,
one of every scalar type, and enum-as-pattern. The test deserializes JSON into the generated DTOs and serializes
back, so the @JsonCreator constructor and @JsonProperty names are actually exercised.
@NotNull, @Pattern, @Email, @Min / @Max and @Size on one type; @Valid cascading into a nested object;
and a list where the elements carry their own constraints while minItems / maxItems size the list. The test runs
a real Validator and asserts on the violations.
A Customer with description and example on its properties, requiredMode on the required ones, and the facets
left to jakarta.validation - the arrangement described on OpenAPI.
The Kotlin plugin applied, kotlin { enabled = true }, and the generated <Name>Extensions.kt checked in next to
the Java. Kit holds a $ref to Widget, showing that each type gets its own extension.
Each example uses the default src.enabled = true, so the generated code is checked into the repository under
src/main/model/java (and src/main/model/kotlin). Read it side by side with the schema in src/main/model - it is
the fastest way to see what a keyword does:
examples/example-openapi/src/main/model/
├── com.example.dto.Customer.json ← schema
└── java/com/example/dto/Customer.java ← what it generates
The examples also show the surrounding build conventions worth copying - a Java 25 toolchain compiling
options.release = 17, -parameters, and Spotless with the generated directory excluded:
spotless {
java {
target("src/**/*.java")
targetExclude("build/**", "src/main/model/java/**")
}
}ModelMaker - Apache License 2.0 - Issues - Wiki index
Start here
Schemas
Output
Features
Integration
Reference