Skip to content

Commit

Permalink
upgrade to 1.5.5 and update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
stevehu committed Jan 15, 2025
1 parent 4b1b7b4 commit 4e8a2b8
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 39 deletions.
35 changes: 22 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ This project does not adhere to [Semantic Versioning](https://semver.org/) and m

### Changed

## 1.5.5 - 2025-01-14

### Added

### Changed

- Fix custom error message for union type (#1138) Thanks @justin-tay
- Update itu 1.10.2 -> 1.10.3 (#1143) Thanks @MelvinFrohike

## 1.5.4 - 2024-11-24

### Added
Expand Down Expand Up @@ -104,7 +113,7 @@ This project does not adhere to [Semantic Versioning](https://semver.org/) and m
- Deprecate config to disable unevaluatedItems and unevaluatedProperties evaluation as no longer needed (#1059) Thanks @justin-tay
- Add GraalJS regular expression and factory implementation (#1058) Thanks @justin-tay
- Allow customization of const message to include input value (#1057) Thanks @justin-tay
- Optimize logging by creating a debug flag (#1054) Thanks @justin-tay
- Optimize logging by creating a debug flag (#1054) Thanks @justin-tay
- Release delegate held by cached supplier (#1056) Thanks @justin-tay
- Remove incorrect logic for oneOf, anyOf and properties (#1053) Thanks @justin-tay
- Detect invalid escape for ecmascript (#1049) Thanks @justin-tay
Expand Down Expand Up @@ -232,7 +241,7 @@ With #915 and #922 implemented, it breaks the API. Users code might need to chan
### Changed

- fixes #906 Cannot load JSON schemas with URN value in id field. Thanks @martin-sladecek
- upgrade logback to 1.4.14
- upgrade logback to 1.4.14
- fixes #896 Refactor to remove ThreadLocal usage. Thanks @justin-tay
- upgrade slf4j to 2.0.9
- fixes #900 compile configuration is depricated. Thanks @saurvkmr
Expand All @@ -245,11 +254,11 @@ With #915 and #922 implemented, it breaks the API. Users code might need to chan
- fixes #886 Fix invalid class passed to getLogger. Thanks @brempusz
- upgrade jackson to 2.15.3
- fixes #883 docs clarify commons-lang3 exclusion only required for 1.0.81. Thanks @JonasGroeger
- fixes #866 Fix identation in example in walkers.md. Thanks @bpaquet
- fixes #866 Fix identation in example in walkers.md. Thanks @bpaquet

### Upgrade Guide

With #896 implemented, it breaks the API. Users code might need to change in order to move to this version.
With #896 implemented, it breaks the API. Users code might need to change in order to move to this version.


## 1.0.87 - 2023-09-08
Expand All @@ -272,7 +281,7 @@ With #896 implemented, it breaks the API. Users code might need to change in ord
### Changed

- fixes #827 Stops unevaluatedProperties and unevaluatedItems being applied recursively. Thanks @aznan2
- fixes #834 Always normalize uri keys of JsonSchemaFactory.jsonMetaSchemas on both read and write. Thanks @stacywsmith
- fixes #834 Always normalize uri keys of JsonSchemaFactory.jsonMetaSchemas on both read and write. Thanks @stacywsmith


## 1.0.85 - 2023-06-22
Expand Down Expand Up @@ -354,7 +363,7 @@ With #896 implemented, it breaks the API. Users code might need to change in ord

- fixes #731 Improves performance. Thanks @fdutton
- fixes #730 Removes need for network access when executing unit-tests. Thanks @fdutton
- fixes #728 Adds explicit Java module descriptor for JDK9+. Thanks @aalmiray
- fixes #728 Adds explicit Java module descriptor for JDK9+. Thanks @aalmiray
- fixes #725 custom uri fetcher doc. Thanks @michapojo
- update the contributors and sponsors
- fixes #720 Produces validation messages when oneOf has no valid schemas. Thanks @fdutton
Expand Down Expand Up @@ -412,7 +421,7 @@ With #896 implemented, it breaks the API. Users code might need to change in ord
### Changed

- update the README.md to indicate that 202012 version is only partially supported.
- fixes #668 handle references to yaml sub-schemas. Thanks @danfelicetta-RL
- fixes #668 handle references to yaml sub-schemas. Thanks @danfelicetta-RL
- fixes #664 Provide/unify schema path for applicator schemas. Thanks @htdan
- fixes #666 Clarify usage of Apache commons lang in README.md. Thanks @loadedice
- fixes #663 Use full schema path to look up type validators for anyOf operator. Thanks @pshevche
Expand Down Expand Up @@ -617,7 +626,7 @@ With #896 implemented, it breaks the API. Users code might need to change in ord

### Changed

- fixes #456 OneOf only validate the first sub schema. This was a defect introduced in 1.0.58 and everyone should upgrade to 1.0.62 if you are using 1.0.58 to 1.0.61.
- fixes #456 OneOf only validate the first sub schema. This was a defect introduced in 1.0.58 and everyone should upgrade to 1.0.62 if you are using 1.0.58 to 1.0.61.

## 1.0.61 - 2021-10-09

Expand Down Expand Up @@ -647,7 +656,7 @@ With #896 implemented, it breaks the API. Users code might need to change in ord
## 1.0.58 - 2021-08-23

### Added
-
-
- fixes #439 add i18n support for ValidationMessage. Thanks @leaves615
- fixes #438 Adding custom message support in the schema. Thanks @adilath18

Expand Down Expand Up @@ -732,7 +741,7 @@ With #896 implemented, it breaks the API. Users code might need to change in ord
- fixes #387 Resolve the test case errors for TypeFactoryTest
- fixes #385 Fixing concurrency and compilation issues. Thanks @prashanthjos
- fixes #383 Nested oneOf gives incorrect validation error. Thanks @JonasProgrammer
- fixes #379 Add lossless narrowing convertion. Thanks @hkupty
- fixes #379 Add lossless narrowing convertion. Thanks @hkupty
- fixes #378 Upgrade Jackson to 2.12.1 and Undertow to 2.2.4.Final

## 1.0.49 - 2021-02-17
Expand Down Expand Up @@ -930,7 +939,7 @@ With #896 implemented, it breaks the API. Users code might need to change in ord

### Changed

- Update description in pom.xml to match readme.md. Thanks @reftel
- Update description in pom.xml to match readme.md. Thanks @reftel
- fixes #232 update meta schema URI to https
- fixes #229 move the remotes to resource from draftv4
- fixes #228 support boolean schema in the dependencies validator
Expand Down Expand Up @@ -1307,15 +1316,15 @@ With #896 implemented, it breaks the API. Users code might need to change in ord

### Changed
- Fixes #50 Support custom meta schemas with custom keywords and formats. Thanks @kkalass
- Fixes #49 Use LinkedHashSets for ValidationMessages. Thanks @ehrmann
- Fixes #49 Use LinkedHashSets for ValidationMessages. Thanks @ehrmann
- Fixes #48 Remove unnecessary todo. Thanks @ehrmann
- Fixes #47 Change access modifiers in ValidationMessage. Thanks @ehrmann
- Fixes #45 Added test case for loading schemas from classpath. Thanks @kenwa


## 0.1.11 - 2017-10-18
### Added
- Fixes #43 Load reference schemas from classpath is supported. Thanks @kenwa
- Fixes #43 Load reference schemas from classpath is supported. Thanks @kenwa

### Changed

Expand Down
47 changes: 22 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The [Releases](https://github.com/networknt/json-schema-validator/releases) page

## Comparing against other implementations

The [JSON Schema Validation Comparison](https://github.com/creek-service/json-schema-validation-comparison) project from Creek has an informative [Comparison of JVM based Schema Validation Implementations](https://www.creekservice.org/json-schema-validation-comparison/) which compares both the functional and performance characteristics of a number of different Java implementations.
The [JSON Schema Validation Comparison](https://github.com/creek-service/json-schema-validation-comparison) project from Creek has an informative [Comparison of JVM based Schema Validation Implementations](https://www.creekservice.org/json-schema-validation-comparison/) which compares both the functional and performance characteristics of a number of different Java implementations.
* [Functional comparison](https://www.creekservice.org/json-schema-validation-comparison/functional#summary-results-table)
* [Performance comparison](https://www.creekservice.org/json-schema-validation-comparison/performance#json-schema-test-suite-benchmark)

Expand Down Expand Up @@ -94,19 +94,19 @@ This implementation is tested against the [JSON Schema Test Suite](https://githu

#### Jackson Parser

This library uses [Jackson](https://github.com/FasterXML/jackson) which is a Java JSON parser that is widely used in other projects. If you are already using the Jackson parser in your project, it is natural to choose this library over others for schema validation.
This library uses [Jackson](https://github.com/FasterXML/jackson) which is a Java JSON parser that is widely used in other projects. If you are already using the Jackson parser in your project, it is natural to choose this library over others for schema validation.

#### YAML Support

The library works with JSON and YAML on both schema definitions and input data.
The library works with JSON and YAML on both schema definitions and input data.

#### OpenAPI Support

The OpenAPI 3.0 specification is using JSON schema to validate the request/response, but there are some differences. With a configuration file, you can enable the library to work with OpenAPI 3.0 validation.
The OpenAPI 3.0 specification is using JSON schema to validate the request/response, but there are some differences. With a configuration file, you can enable the library to work with OpenAPI 3.0 validation.

#### Minimal Dependencies

Following the design principle of the Light Platform, this library has minimal dependencies to ensure there are no dependency conflicts when using it.
Following the design principle of the Light Platform, this library has minimal dependencies to ensure there are no dependency conflicts when using it.

##### Required Dependencies

Expand Down Expand Up @@ -204,7 +204,7 @@ The Ethlo Time dependency can be excluded if accurate validation of the `date-ti

#### Community

This library is very active with a lot of contributors. New features and bug fixes are handled quickly by the team members. Because it is an essential dependency of the [light-4j](https://github.com/networknt/light-4j) framework in the same GitHub organization, it will be evolved and maintained along with the framework.
This library is very active with a lot of contributors. New features and bug fixes are handled quickly by the team members. Because it is an essential dependency of the [light-4j](https://github.com/networknt/light-4j) framework in the same GitHub organization, it will be evolved and maintained along with the framework.

## Prerequisite

Expand All @@ -214,31 +214,31 @@ The library supports Java 8 and up. If you want to build from the source code, y

### Adding the dependency

This package is available on Maven central.
This package is available on Maven central.

#### Maven:
#### Maven:

```xml
<dependency>
<groupId>com.networknt</groupId>
<artifactId>json-schema-validator</artifactId>
<version>1.5.4</version>
<version>1.5.5</version>
</dependency>
```

#### Gradle:

```java
dependencies {
implementation(group: 'com.networknt', name: 'json-schema-validator', version: '1.5.4');
implementation(group: 'com.networknt', name: 'json-schema-validator', version: '1.5.5');
}
```

### Validating inputs against a schema

The following example demonstrates how inputs are validated against a schema. It comprises the following steps.

* Creating a schema factory with the default schema dialect and how the schemas can be retrieved.
* Creating a schema factory with the default schema dialect and how the schemas can be retrieved.
* Configuring mapping the `$id` to a retrieval URI using `schemaMappers`.
* Configuring how the schemas are loaded using the retrieval URI using `schemaLoaders`.
For instance a `Map<String, String> schemas` containing a mapping of retrieval URI to schema data as a `String` can by configured using `builder.schemaLoaders(schemaLoaders -> schemaLoaders.schemas(schemas))`. This also accepts a `Function<String, String> schemaRetrievalFunction`.
Expand All @@ -250,7 +250,7 @@ The following example demonstrates how inputs are validated against a schema. It
// This creates a schema factory that will use Draft 2020-12 as the default if $schema is not specified
// in the schema data. If $schema is specified in the schema data then that schema dialect will be used
// instead and this version is ignored.
JsonSchemaFactory jsonSchemaFactory = JsonSchemaFactory.getInstance(VersionFlag.V202012, builder ->
JsonSchemaFactory jsonSchemaFactory = JsonSchemaFactory.getInstance(VersionFlag.V202012, builder ->
// This creates a mapping from $id which starts with https://www.example.org/ to the retrieval URI classpath:schema/
builder.schemaMappers(schemaMappers -> schemaMappers.mapPrefix("https://www.example.org/", "classpath:schema/"))
);
Expand Down Expand Up @@ -312,29 +312,29 @@ Set<ValidationMessage> assertions = schema.validate(input, InputFormat.JSON, exe
// By default since Draft 2019-09 the format keyword only generates annotations and not assertions
executionContext.getExecutionConfig().setFormatAssertionsEnabled(true);
});
```
```
### Results and output formats

#### Results

The following types of results are generated by the library.

| Type | Description
| Type | Description
|-------------|-------------------
| Assertions | Validation errors generated by a keyword on a particular input data instance. This is generally described in a `ValidationMessage` or in a `OutputUnit`. Note that since Draft 2019-09 the `format` keyword no longer generates assertions by default and instead generates only annotations unless configured otherwise using a configuration option or by using a meta-schema that uses the appropriate vocabulary.
| Annotations | Additional information generated by a keyword for a particular input data instance. This is generally described in a `OutputUnit`. Annotation collection and reporting is turned off by default. Annotations required by keywords such as `unevaluatedProperties` or `unevaluatedItems` are always collected for evaluation purposes and cannot be disabled but will not be reported unless configured to do so.

The following information is used to describe both types of results.

| Type | Description
| Type | Description
|-------------------|-------------------
| Evaluation Path | This is the set of keys from the root through which evaluation passes to reach the schema for evaluating the instance. This includes `$ref` and `$dynamicRef`. eg. ```/properties/bar/$ref/properties/bar-prop```
| Schema Location | This is the canonical IRI of the schema plus the JSON pointer fragment to the schema that was used for evaluating the instance. eg. ```https://json-schema.org/schemas/example#/$defs/bar/properties/bar-prop```
| Instance Location | This is the JSON pointer fragment to the instance data that was being evaluated. eg. ```/bar/bar-prop```

Assertions contains the following additional information

| Type | Description
| Type | Description
|-------------------|-------------------
| Message | The validation error message.
| Code | The error code.
Expand All @@ -349,7 +349,7 @@ Assertions contains the following additional information

Annotations contains the following additional information

| Type | Description
| Type | Description
|-------------------|-------------------
| Value | The annotation value generated

Expand Down Expand Up @@ -411,7 +411,7 @@ This library implements the Flag, List and Hierarchical output formats defined i

The List and Hierarchical output formats are particularly helpful for understanding how the system arrived at a particular result.

| Output Format | Description
| Output Format | Description
|-------------------|-------------------
| Default | Generates the list of assertions.
| Boolean | Returns `true` if the validation is successful. Note that the fail fast option is turned on by default for this output format.
Expand All @@ -425,7 +425,7 @@ The following example shows how to generate the hierarchical output format with
JsonSchemaFactory factory = JsonSchemaFactory.getInstance(VersionFlag.V202012);
SchemaValidatorsConfig config = SchemaValidatorsConfig().builder().formatAssertionsEnabled(true).build();
JsonSchema schema = factory.getSchema(SchemaLocation.of("https://json-schema.org/schemas/example"), config);

OutputUnit outputUnit = schema.validate(inputData, InputFormat.JSON, OutputFormat.HIERARCHICAL, executionContext -> {
executionContext.getExecutionConfig().setAnnotationCollectionEnabled(true);
executionContext.getExecutionConfig().setAnnotationCollectionFilter(keyword -> true);
Expand Down Expand Up @@ -533,7 +533,7 @@ The following is sample output from the Hierarchical format.
| `readOnly` | Whether schema is read only. This affects the `readOnly` keyword. | `null`
| `regularExpressionFactory` | The factory to use to create regular expressions for instance `JoniRegularExpressionFactory` or `GraalJSRegularExpressionFactory`. This requires the dependency to be manually added to the project or a `ClassNotFoundException` will be thrown. | `JDKRegularExpressionFactory.getInstance()`
| `schemaIdValidator` | This is used to customize how the `$id` values are validated. Note that the default implementation allows non-empty fragments where no base IRI is specified and also allows non-absolute IRI `$id` values in the root schema. | `JsonSchemaIdValidator.DEFAULT`
| `strict` | This is set whether keywords are strict in their validation. What this does depends on the individual validators. |
| `strict` | This is set whether keywords are strict in their validation. What this does depends on the individual validators. |
| `typeLoose` | Whether types are interpreted in a loose manner. If set to true, a single value can be interpreted as a size 1 array. Strings may also be interpreted as number, integer or boolean. | `false`
| `writeOnly` | Whether schema is write only. This affects the `writeOnly` keyword. | `null`

Expand Down Expand Up @@ -594,13 +594,13 @@ The library assumes that the schemas being loaded are trusted. This security mod

## Projects

The [light-rest-4j](https://github.com/networknt/light-rest-4j), [light-graphql-4j](https://github.com/networknt/light-graphql-4j) and [light-hybrid-4j](https://github.com/networknt/light-hybrid-4j) use this library to validate the request and response based on the specifications. If you are using other frameworks like Spring Boot, you can use the [OpenApiValidator](https://github.com/mservicetech/openapi-schema-validation), a generic OpenAPI 3.0 validator based on the OpenAPI 3.0 specification.
The [light-rest-4j](https://github.com/networknt/light-rest-4j), [light-graphql-4j](https://github.com/networknt/light-graphql-4j) and [light-hybrid-4j](https://github.com/networknt/light-hybrid-4j) use this library to validate the request and response based on the specifications. If you are using other frameworks like Spring Boot, you can use the [OpenApiValidator](https://github.com/mservicetech/openapi-schema-validation), a generic OpenAPI 3.0 validator based on the OpenAPI 3.0 specification.

If you have a project using this library, please submit a PR to add your project below.

## Contributors

Thanks to the following people who have contributed to this project. If you are using this library, please consider to be a sponsor for one of the contributors.
Thanks to the following people who have contributed to this project. If you are using this library, please consider to be a sponsor for one of the contributors.

[@stevehu](https://github.com/sponsors/stevehu)

Expand Down Expand Up @@ -644,6 +644,3 @@ If you are a contributor, please join the [GitHub Sponsors](https://github.com/s


### Corporation Sponsors



Loading

0 comments on commit 4e8a2b8

Please sign in to comment.