JSON Schema Registry

Auto-detected JSON schema classes and provide a registry for easy lookup

License

License

Categories

Categories

JSON Data
GroupId

GroupId

org.kasource
ArtifactId

ArtifactId

json-schema-registry
Last Version

Last Version

0.1
Release Date

Release Date

Type

Type

jar
Description

Description

JSON Schema Registry
Auto-detected JSON schema classes and provide a registry for easy lookup
Project Organization

Project Organization

Ka Source
Source Code Management

Source Code Management

https://github.com/wigforss/json-schema-registry.git

Download json-schema-registry

How to add to project

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

Dependencies

compile (7)

Group / Artifact Type Version
com.github.fge : json-schema-validator jar 2.2.6
org.springframework : spring-context jar 5.0.4.RELEASE
javax.validation : validation-api jar 2.0.1.Final
org.slf4j : slf4j-api jar 1.7.25
org.unitils : unitils-inject jar 3.4.6
com.google.code.findbugs : annotations jar 3.0.1u2
org.kasource : qa-rules jar 0.4

test (9)

Group / Artifact Type Version
org.kasource.commons : ka-commons-collection jar 0.1
org.kasource.commons : ka-commons-reflection jar 2.1
org.mockito : mockito-all jar 1.10.19
org.hamcrest : hamcrest-all jar 1.3
junit : junit jar 4.12
commons-io : commons-io jar 2.6
org.hibernate : hibernate-validator jar 5.3.4.Final
org.apache.tomcat : tomcat-el-api jar 8.5.14
org.apache.tomcat : tomcat-jasper-el jar 8.5.14

Project Modules

There are no modules declared in this project.

json-schema-registry

License
codecov

Auto discovery of java classes annotated with @JsonSchema, which are placed into a JsonSchemaRegistry.

Validation of JSON is also included using the bean validation annotation @ValidJson.

Example

Java Backing bean of the actual data that should comply to a JSON schema

@JsonSchema(name = "person", version = "1.0", location = "/person-schema-v1.json")
    private static class Person {
        private String firstName;

        private String lastName;
    }

Or location from url

@JsonSchema(name = "person", version = "1.0", location = "http://mysite/schemas/person-schema-v1.json")
    private static class Person {
        private String firstName;

        private String lastName;
    }

The JSON schema itself which resides on the classpath at the location specified in the location attribute of the @JsonSchema annotation.

{
  "title": "Person",
  "type": "object",
  "properties": {
    "firstName": {
      "type": "string"
    },
    "lastName": {
      "type": "string"
    },
    "age": {
      "description": "Age in years",
      "type": "integer",
      "minimum": 0
    }
  },
  "required": ["firstName", "lastName"]
}

And to get the Registry

public JsonSchemaRegistry createRegistry(ObjectMapper objectMapper, String packageToScan) {
    return new JsonSchemaScanner(objectMapper).scan(packageToScan);
}

Versions

Version
0.1