JJSchema

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/

Лицензия

Лицензия

Группа

Группа

com.github.reinert
Идентификатор

Идентификатор

jjschema
Последняя версия

Последняя версия

1.16
Дата

Дата

Тип

Тип

jar
Описание

Описание

JJSchema
Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/
Ссылка на сайт

Ссылка на сайт

http://github.com/reinert/JJSchema/
Система контроля версий

Система контроля версий

https://github.com/reinert/JJSchema

Скачать jjschema

Как подключить последнюю версию

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

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
com.fasterxml.jackson.core : jackson-annotations jar 2.8.10
com.fasterxml.jackson.core : jackson-core jar 2.8.10
com.fasterxml.jackson.core : jackson-databind jar 2.8.10
javax.ws.rs : javax.ws.rs-api Необязательный jar 2.0.1

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

JJSchema

A Java JSON Schema and Hyper-Schema generator. Currently, it is based on v4 draft. Supports Java 8 Date and Time API.

Latest Release

<dependency>
  <groupId>com.github.reinert</groupId>
  <artifactId>jjschema</artifactId>
  <version>1.16</version>
</dependency>

Simple HOW TO

Suppose the following Class:

@Attributes(title="Product", description="A product from Acme's catalog")
static class Product {
	@Attributes(required=true, description="The unique identifier for a product")
	private long id;
	@Attributes(required=true, description="Name of the product")
	private String name;
	@Attributes(required=true, minimum=0, exclusiveMinimum=true)
	private BigDecimal price;
	@Attributes(minItems=1,uniqueItems=true)
	private List<String> tags;
	
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}	
	public void setName(String name) {
		this.name = name;
	}
	public BigDecimal getPrice() {
		return price;
	}
	public void setPrice(BigDecimal price) {
		this.price = price;
	}
	public List<String> getTags() {
		return tags;
	}
	public void setTags(List<String> tags) {
		this.tags = tags;
	}
}

Type the following code:

JsonSchemaFactory schemaFactory = new JsonSchemaV4Factory();
schemaFactory.setAutoPutDollarSchema(true);
JsonNode productSchema = schemaFactory.createSchema(Product.class);
System.out.println(productSchema);

The output:

{
  "type" : "object",
  "description" : "A product from Acme's catalog",
  "title" : "Product",
  "properties" : {
    "id" : {
      "type" : "integer",
      "description" : "The unique identifier for a product"
    },
    "name" : {
      "type" : "string",
      "description" : "Name of the product"
    },
    "price" : {
      "type" : "number",
      "minimum" : 0,
      "exclusiveMinimum" : true
    },
    "tags" : {
      "type" : "array",
      "items" : {
        "type" : "string"
      },
      "uniqueItems" : true,
      "minItems" : 1
    }
  },
  "required" : [ "id", "name", "price" ],
  "$schema" : "http://json-schema.org/draft-04/schema#"
}

Thanks to

IntelliJ

Версии библиотеки

Версия
1.16
1.15
1.14
1.13
1.12
1.11
1.10
1.8
1.7
1.6
1.5
1.4
1.3
1.2
1.1
1.0
0.6
0.5.9
0.3
0.1