Skip to content

Latest commit

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Java SARIF

Contains POJOs generated from the Static Analysis Results Interchange Format (SARIF) JSON schema.

It uses Jackson for serialising/deserialing from JSON.

Usage

Add as a dependency

<dependency>
<groupId>com.contrastsecurity</groupId>
<artifactId>java-sarif</artifactId>
<version>2.0</version>
</dependency>

Developing with Java SARIF

All classes reside in the com.contrastsecurity.sarif package. The JSON schema used to generate them is located in src/main/resources/schema.

Building Objects

Building is provided with method chaining, e.g. for Message

importcom.contrastsecurity.sarif.Message;
// ...Messagemessage = newMessage()
.withText("SQL Injection")
.withMarkdown("# SQL Injection");

Public Getters & Setters are provided.

Jackson

Classes are decorated with @JsonInclude(JsonInclude.Include.NON_DEFAULT) and @JsonPropertyOrder which dictates the order from the JSON schema.

importcom.fasterxml.jackson.annotation.JsonInclude;
importcom.fasterxml.jackson.annotation.JsonProperty;
// ...@JsonInclude(JsonInclude.Include.NON_DEFAULT)
@JsonPropertyOrder({
"text",
"markdown",
"id",
"arguments",
"properties"
})
publicclassMessage {
// ...
}



This library uses jsonschema2pojo for generation.

About

POJOs generated from the Static Analysis Results Interchange Format (SARIF) JSON schema.

Resources

Stars

28 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages