Kangaroo

JSON Schema Validation Package for Java.

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

com.clivern
ArtifactId

ArtifactId

kangaroo
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

Kangaroo
JSON Schema Validation Package for Java.
Project URL

Project URL

https://github.com/clivern/kangaroo
Source Code Management

Source Code Management

https://github.com/clivern/kangaroo

Download kangaroo

How to add to project

<!-- https://jarcasting.com/artifacts/com.clivern/kangaroo/ -->
<dependency>
    <groupId>com.clivern</groupId>
    <artifactId>kangaroo</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.clivern/kangaroo/
implementation 'com.clivern:kangaroo:0.0.1'
// https://jarcasting.com/artifacts/com.clivern/kangaroo/
implementation ("com.clivern:kangaroo:0.0.1")
'com.clivern:kangaroo:jar:0.0.1'
<dependency org="com.clivern" name="kangaroo" rev="0.0.1">
  <artifact name="kangaroo" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.clivern', module='kangaroo', version='0.0.1')
)
libraryDependencies += "com.clivern" % "kangaroo" % "0.0.1"
[com.clivern/kangaroo "0.0.1"]

Dependencies

runtime (3)

Group / Artifact Type Version
com.google.guava : guava jar 27.1-jre
com.google.code.gson : gson jar 2.8.5
com.googlecode.json-simple : json-simple jar 1.1.1

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Kangaroo Logo

Kangaroo

JSON Schema Validation Package for Java.

Kangaroo is a Java implementation for the JSON Schema Standard (draft-03, draft-04, draft-06 and draft-07), that will help you validate all sorts of JSON documents, whether they are configuration files or a set of data sent to a RESTful API endpoint.

Documentation

Installation

To add a dependency using Maven, use the following:

<dependency>
    <groupId>com.clivern</groupId>
    <artifactId>kangaroo</artifactId>
    <version>0.0.1</version>
</dependency>

To add a dependency using Gradle, use the following:

dependencies {
    compile 'com.clivern:kangaroo:0.0.1'
}

To add a dependency using Scala SBT, use the following:

libraryDependencies += "com.clivern" % "kangaroo" % "0.0.1"

Usage

First import & initialize all required classes.

import com.clivern.kangaroo.util.FileReader;
import com.clivern.kangaroo.SchemaFactory;
import com.clivern.kangaroo.Validator;


FileReader fileReader = new FileReader();
SchemaFactory schemaFactory = new SchemaFactory();
Validator validator = new Validator();

Then validate the JSON string against the JSON Schema.

import com.clivern.kangaroo.SchemaDraft3;


// For SchemaDraft3
SchemaDraft3 schemaDraft3 = schemaFactory.unserialize(
    fileReader.readFileAsString("path/to/endpoint/schema03_definition.json"),
    SchemaDraft3.class
);

validator.validate(schemaDraft3, "{...JSON_DATA_HERE...}");  // returns Boolean (true || false)
validator.hasErrors();                                       // returns Boolean (true || false)
validator.getErrors();                                       // returns ArrayList<String>
import com.clivern.kangaroo.SchemaDraft4;


// For SchemaDraft4
SchemaDraft4 schemaDraft4 = schemaFactory.unserialize(
    fileReader.readFileAsString("path/to/endpoint/schema04_definition.json"),
    SchemaDraft4.class
);

validator.validate(schemaDraft4, "{...JSON_DATA_HERE...}");  // returns Boolean (true || false)
validator.hasErrors();                                       // returns Boolean (true || false)
validator.getErrors();                                       // returns ArrayList<String>
import com.clivern.kangaroo.SchemaDraft6;


// For SchemaDraft6
SchemaDraft6 schemaDraft6 = schemaFactory.unserialize(
    fileReader.readFileAsString("path/to/endpoint/schema06_definition.json"),
    SchemaDraft6.class
);

validator.validate(schemaDraft6, "{...JSON_DATA_HERE...}");  // returns Boolean (true || false)
validator.hasErrors();                                       // returns Boolean (true || false)
validator.getErrors();                                       // returns ArrayList<String>
import com.clivern.kangaroo.SchemaDraft7;


// For SchemaDraft7
SchemaDraft7 schemaDraft7 = schemaFactory.unserialize(
    fileReader.readFileAsString("path/to/endpoint/schema07_definition.json"),
    SchemaDraft7.class
);

validator.validate(schemaDraft7, "{...JSON_DATA_HERE...}");  // returns Boolean (true || false)
validator.hasErrors();                                       // returns Boolean (true || false)
validator.getErrors();                                       // returns ArrayList<String>

Examples

#

Versioning

For transparency into our release cycle and in striving to maintain backward compatibility, Kangaroo is maintained under the Semantic Versioning guidelines and release process is predictable and business-friendly.

See the Releases section of our GitHub project for changelogs for each release version of Kangaroo. It contains summaries of the most noteworthy changes made in each release.

Bug tracker

If you have any suggestions, bug reports, or annoyances please report them to our issue tracker at https://github.com/clivern/kangaroo/issues

Security Issues

If you discover a security vulnerability within Kangaroo, please send an email to [email protected]

Contributing

We are an open source, community-driven project so please feel free to join us. see the contributing guidelines for more details.

License

© 2019, Clivern. Released under Apache License, Version 2.0.

Kangaroo is authored and maintained by @Clivern.

Versions

Version
0.0.1