Java model classes generated from the Open Cybersecurity Schema Framework (OCSF) JSON Schema, along with fluent builder support for all generated types.
This project generates Java POJOs from the OCSF JSON Schema definitions and publishes them as two separate Maven artifacts:
| Module | Artifact | Description |
|---|---|---|
models |
io.ocsf.schema.models:models |
Jackson-annotated POJOs for every OCSF event class and object |
builders |
io.ocsf.schema.models:builders |
Fluent builder classes for every model type (via Sundrio) |
- Java 11+
- Gradle (use
./gradlew)
# Build all modules
./gradlew build
# Build only the models module
./gradlew :models:build
# Build only the builders module
./gradlew :builders:buildBoth modules are configured with the maven-publish plugin and publish a standard Maven artifact from the Java component.
To use locally run:
./gradlew publishToMavenLocalAdd the models and builders artifact for fluent builder support:
// build.gradle.kts
dependencies {
implementation("io.ocsf.schema.models:models:1.8.0-SNAPSHOT")
implementation("io.ocsf.schema.models:builders:1.8.0-SNAPSHOT")
}import io.ocsf.schema.models.builders.AuthenticationBuilder;
Authentication event = new AuthenticationBuilder()
.withUser(user)
.withSeverityId(2)
.withTime(System.currentTimeMillis())
.build();The schemas bundled in models/src/main/resources/schema/ are fetched from the live OCSF API. To update them to the latest version, run:
./.github/scripts/update-schema.shThis script requires curl, jq, and yq.