Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/foxcapades/java-json-schema-builder


https://github.com/foxcapades/java-json-schema-builder

Last synced: 5 days ago
JSON representation

Awesome Lists containing this project

README

        

= JSON Schema Builder
:source-highlighter: pygments
Elizabeth Harper

image:https://img.shields.io/badge/JDK-11-orange.svg[]
image:https://img.shields.io/travis/Foxcapades/java-json-schema-builder/master.svg[link="https://travis-ci.org/Foxcapades/java-json-schema-builder"]
image:https://img.shields.io/maven-central/v/io.vulpine.lib/json-schema-builder.svg[link="https://search.maven.org/search?q=g:io.vulpine.lib%20AND%20a:json-schema-builder"]
image:https://codecov.io/gh/Foxcapades/java-json-schema-builder/branch/master/graph/badge.svg[link="https://codecov.io/gh/Foxcapades/java-json-schema-builder"]
image:https://img.shields.io/github/license/Foxcapades/java-json-schema-builder.svg[]

https://github.com/FasterXML/jackson[Jackson] based builder for constructing
JSON Schema in Java.

== Drafts

=== v4

[source, java]
----
var writer = new ObjectMapper().writerWithDefaultPrettyPrinter();
var schema = Schema.draft4();
System.out.println(writer.writeValueAsString(
schema.asObject()
.requiredProperty("test")
.asArray()
.items()
.asString()
.defaultValue("some value")
.close()
.close()
.optionalProperty("other", schema.id("test"))
.render()));
----

[source, json]
----
{
"$schema" : "http://json-schema.org/draft-04/schema",
"type" : "object",
"required" : [ "test" ],
"properties" : {
"test" : {
"type" : "array",
"items" : {
"type" : "string",
"default" : "some value"
}
},
"other" : {
"id" : "test"
}
}
}
----

== TODO

=== v4

[cols=3]
|===
h| Status h| Feature h| Notes
| [red]#*TODO*# | `"dependencies"` | Target 2.3
| [green]#*Done*# | `"not"` | In 2.0
| [green]#*Done*# | `"minProperties"` | In 1.2
| [green]#*Done*# | `"maxProperties"` | In 1.2
| [green]#*Done*# | `"uniqueItems"` | In 1.2
| [green]#*Done*# | `"definitions"` | In 1.2
| [green]#*Done*# | Multi-type nodes | In 1.3
| [green]#*Done*# | `"format"` | In 1.1
| [green]#*Done*# | `"enum"` | In 1.1
| [green]#*Done*# | `"oneOf"` | In 1.1, Complete in 1.3
| [green]#*Done*# | `"anyOf"` | In 1.1, Complete in 1.3
| [green]#*Done*# | `"allOf"` | In 1.1, Complete in 1.3
|===

=== v7

* [ ] support