Skip to content
This repository was archived by the owner on Mar 30, 2020. It is now read-only.

Commit 551a1ba

Browse files
release 1.0.0
1 parent e4c436a commit 551a1ba

File tree

3 files changed

+56
-4
lines changed

3 files changed

+56
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
9+
## v1.0.0 – 2019-05-22
810
### Added
911
- Indicate a field/method to be nullable if `@Null` is present
1012
- Indicate a field/method to be not nullable if `@NotNull`, `@NotEmpty` or `@NotBlank` is present
@@ -16,3 +18,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1618
- Indicate a number's "exclusiveMinimum" according to `@DecimalMin` or `@Positive`
1719
- Indicate a number's "maximum" (inclusive) according to `@Max`, `@DecimalMax` or `@NegativeOrZero`
1820
- Indicate a number's "exclusiveMaximum" according to `@DecimalMax` or `@Negative`
21+
22+
[Unreleased]: https://github.com/victools/jsonschema-module-javax-validation/compare/v1.0.0...HEAD
23+
[1.0.0]: https://github.com/victools/jsonschema-module-javax-validation/releases/tag/v1.0.0

README.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,49 @@
1-
# jsonschema-module-javax-validation
2-
Module for the `jsonschema-generator` – deriving JSON Schema attributes from `javax.validation` annotations
1+
# Java JSON Schema Generator – Module javax.validation
2+
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.victools/jsonschema-module-javax-validation/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.victools/jsonschema-module-javax-validation)
3+
4+
Module for the `jsonschema-generator` – deriving JSON Schema attributes from `javax.validation` annotations.
5+
6+
## Usage
7+
### Dependency (Maven)
8+
9+
```xml
10+
<dependency>
11+
<groupId>com.github.victools</groupId>
12+
<artifactId>jsonschema-module-javax-validation</artifactId>
13+
<version>1.0.0</version>
14+
</dependency>
15+
```
16+
17+
### Code
18+
#### Passing into SchemaGeneratorConfigBuilder.with(Module)
19+
```java
20+
import com.github.victools.jsonschema.generator.SchemaGeneratorConfigBuilder;
21+
import com.github.victools.jsonschema.module.javax.validation.JavaxValidationModule;
22+
```
23+
```java
24+
JavaxValidationModule module = new JavaxValidationModule();
25+
SchemaGeneratorConfigBuilder configBuilder = new SchemaGeneratorConfigBuilder(objectMapper)
26+
.with(module);
27+
```
28+
29+
#### Complete Example
30+
```java
31+
import com.fasterxml.jackson.databind.JsonNode;
32+
import com.fasterxml.jackson.databind.ObjectMapper;
33+
import com.github.victools.jsonschema.generator.OptionPreset;
34+
import com.github.victools.jsonschema.generator.SchemaGenerator;
35+
import com.github.victools.jsonschema.generator.SchemaGeneratorConfig;
36+
import com.github.victools.jsonschema.generator.SchemaGeneratorConfigBuilder;
37+
import com.github.victools.jsonschema.module.javax.validation.JavaxValidationModule;
38+
```
39+
```java
40+
ObjectMapper objectMapper = new ObjectMapper();
41+
JavaxValidationModule module = new JavaxValidationModule();
42+
SchemaGeneratorConfigBuilder configBuilder = new SchemaGeneratorConfigBuilder(objectMapper, OptionPreset.PLAIN_JSON)
43+
.with(module);
44+
SchemaGeneratorConfig config = configBuilder.build();
45+
SchemaGenerator generator = new SchemaGenerator(config);
46+
JsonNode jsonSchema = generator.generateSchema(YourClass.class);
47+
48+
System.out.println(jsonSchema.toString());
49+
```

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<groupId>com.github.victools</groupId>
1010
<artifactId>jsonschema-module-javax-validation</artifactId>
11-
<version>1.0.0-SNAPSHOT</version>
11+
<version>1.0.0</version>
1212
<packaging>jar</packaging>
1313

1414
<licenses>
@@ -27,7 +27,7 @@
2727
<connection>scm:git:ssh://github.com/victools/jsonschema-module-javax-validation.git</connection>
2828
<developerConnection>scm:git:ssh://git@github.com/victools/jsonschema-module-javax-validation.git</developerConnection>
2929
<url>https://github.com/victools/jsonschema-module-javax-validation</url>
30-
<tag>HEAD</tag>
30+
<tag>v1.0.0</tag>
3131
</scm>
3232

3333
<organization>

0 commit comments

Comments
 (0)