Skip to content

Commit

Permalink
preparing release 0.16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
erosb committed Aug 25, 2024
1 parent 5039923 commit ce17ee4
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ Add the following dependency to the `<dependencies>` section of your project:
<dependency>
<groupId>com.github.erosb</groupId>
<artifactId>json-sKema</artifactId>
<version>0.15.0</version>
<version>0.16.0</version>
</dependency>
```

### Gradle

```groovy
dependencies {
implementation("com.github.erosb:json-sKema:0.15.0")
implementation("com.github.erosb:json-sKema:0.16.0")
}
```

Expand Down Expand Up @@ -189,6 +189,38 @@ var readContextFailure = readContextValidator.validate(instance);
System.out.println(readContextFailure);
```

### SchemaBuilder for dynamic (programmatic) schema construction

The library allows dynamic schema construction via its `SchemaBuilder` class. This is useful in cases when, instead of working with
static schemas or externally fed JSON Schemas, the application needs to create a schema instance at run-time, dynamically. This can
be done with a fluent API, demonstrated below:

[Complete source](TODO)

```java
import static com.github.erosb.jsonsKema.SchemaBuilder.*;
//...
typeObject()
.property("myString", typeString()
.minLength(2)
.maxLength(50)
.pattern("^[a-zA-Z ]*$")
).property("myInteger", typeInteger()
.minimum(10)
.maximum(20)
.multipleOf(4)
).property("myObject", typeObject()
.additionalProperties(falseSchema())
.patternProperties(Map.of(
"^[A-Z]{2}$", allOf(
typeArray().items(typeNumber())
.prefixItems(List.of(typeBoolean(), typeBoolean())),
typeArray().minContains(3, constSchema(new JsonNumber(1.5)))
)
))
)
```

## Compatibility notes

The library implements the JSON Schema draft 2020-12 core and validation specifications, with the following notes:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.github.erosb</groupId>
<artifactId>json-sKema</artifactId>
<version>0.0.0-develop</version>
<version>0.16.0</version>

<name>json-sKema</name>
<description>JSON Schema Parser and Validator</description>
Expand Down

0 comments on commit ce17ee4

Please sign in to comment.