All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- The problem messages are translated into Simplified Chinese by @letui.
- All the branching problems are now preserved even when they have only one branch of problems (Issue #37 reported by @adityamandhare).
- Problem printers built with
ProblemPrinterBuilder
now skip intermediate problems if and only if they have only one branch of problems. - Revised the problem message emitted by
contains
keyword.
- A bug which was causing
AssertionError
whenenum
keyword is used inpropertyNames
keyword. (Issue #38 reported by @DMittenMalwareBytes)
printProblems(PrintStream)
andprintProblems(PrintWriter)
methods toJsonValidatingException
class.print()
method toProblem
interface.
- [CLI] Now uses Joy as a JSON-P implementation.
JsonValidatingException.getMessage()
now correctly returns a message describing all problems including problems on any branch. (Issue #23 reported by @gustabart)- A bug which was causing schema readers to report too many problems when they are created with
withStrictKeywords()
enabled. (Issue #25)
- Added
JsonSchemaReaderFactoryBuilder.withMetaschema()
which can be used to explicitly specify metaschema against which JSON schemas will be validated while being read. (Issue #19 proposed by @dszier)
- The single parameter of
Keyword.getValueAsJson()
was removed. JsonSchemaBuilder.withDependencies()
now accepts aMap<String, ?>
typed parameter instead ofMap<String, Object>
.JsonSchemaReaderFactoryBuilder.withStrictWithFormats()
was renamed towithStrictFormats()
.JsonSchemaReaderFactoryBuilder.withStrictWithKeywords()
was renamed towithStrictKeywords()
.- [CLI] Revised console messages.
- Now every JSON schema and schema keyword retains its original JSON representation correctly, including custom keywords.
Keyword
interface which represents a keyword contained in a JSON schema.ObjectJsonSchema
interface which is a JSON schema represented by a JSON object. This type can be viewed as an immutable map ofKeyword
instances.JsonSchema.asObjectJsonSchema()
, which can cast an instance ofJsonSchema
toObjectJsonSchema
.JsonSchema.getJsonValueType()
, which returns the value type of JSON value returned bytoJson()
.JsonSchema.getKeywordValue(String)
andJsonSchema.getKeywordValue(String, JsonValue)
, both return the value of the specified schema keyword as aJsonValue
.JsonParser
created byJsonParserFactory.createParser(JsonArray)
orJsonParserFactory.createParser(JsonObject)
now can validate the value even when using this library with the JSON-P Reference Implementation. (Issue #14 reported by @atomictag)JsonValidationService.getJsonProvider()
which returns the underlyingJsonProvider
instance used by the service.
- The Maven coordinates of the dependency which provides the JSON Processing API was now migrated to
jakarta.json:jakarta.json-api
. When using this library with the Reference Implementation, the Maven coordinates of the implementation now should beorg.glassfish:jakarta.json
with its classifier asmodule
. - The constant
JsonSchema.EMPTY
now has a type ofObjectJsonSchema
.
- A bug which was causing unrecognized keywords to disappear from the effective schema. Note that ill-formed keywords reserved in the JSON Schema specification are not retained even in this release. This restriction should be fixed in the future release. (Issue #16 reported by @atomictag)
- A bug which was causing
JsonParser.getString()
to throwNullPointerException
instead ofIllegalStateException
when the method was called before the initial invocation ofnext()
. - A bug which was causing the order of values given by
type
keyword to be changed while reading schemas.
- Full support of JSON Schema specification Draft-06 and Draft-04.
SpecVersion
enum type to define the supported versions of JSON Schema specification.JsonSchemaReaderFactoryBuilder.withDefaultSpecVersion()
to specify the default version of JSON Schema specification.- Automatic detection of the JSON Schema specification version based on the
$schema
keyword values. This feature is enabled by default and can be disabled withJsonSchemaReaderFactoryBuilder.withSpecVersionDetection()
. JsonSchemaReaderFactoryBuilder.withSchemaValidation()
to enable or disable the validation of schemas against the metaschemas. By default this option is enabled as before.ValidationConfig
interface to build configuration properties, which can be passed toJsonParserFactory
orJsonReaderFactory
type.
type
parameters inJsonSchema.createEvaluator()
andJsonSchema.createNegatedEvaluator()
now receiveInstanceType.NUMBER
instead ofInstanceType.INTEGER
for integer type.FormatAttribute.valueType()
now must returnInstanceType.NUMBER
instead ofInstanceType.INTEGER
for integer type.
JsonValidatorFactoryBuilder
type introduced in the previous release. This type is superseded by newValidationConfig
.
- A bug of
oneOf
which was causing the validation to produce false result in case that two or more subschemas are evaluated eventually as valid by different parser events. (Issue #13)
- New
JsonValidatorFactoryBuilder
interface for building configured instances ofJsonParserFactory
orJsonReaderFactory
. - Support of
default
keyword in the validations. The missing properties and/or items in the source instances are filled with the default values provided by the keyword. BothJsonParser
andJsonReader
support this feature.JsonParser
produces additional events caused by the default values andJsonReader
expands objects and arrays with the additional values. This feature is disabled by default and can be enabled explicitly bywithDefaultValues()
inJsonValidatorFactoryBuilder
.
- The bug which was causing
getArrayStream()
,getObjectStream()
, andgetValueStream()
inJsonParser
to throw wronglyUnsupportedOperationException
in the case that they should throwIllegalStateException
. (Issue #10)
getPointer()
method inProblem
interface which provides the location of the problem in the JSON instance as a JSON pointer. (Proposed originally by @mshaposhnik and the implementation is supported by @erdi)ProblemPrinterBuilder
interface to build configured problem printers, such as printers with problem locations omitted.JsonValidationService.createProblemPrinterBuilder()
to create instances ofProblemPrinterBuilder
.
- New problem printer outputs the messages including JSON pointers in addition to line and column numbers by default.
- The evaluation of
uniqueItems
keyword is now deferred until the end of the array. - The evaluation of false boolean schema for
properties
,patternProperties
, andadditionalProperties
keywords is now deferred until the value of the property.
- Fix broken Javadoc links to the JDK.
JsonSchemaReaderFactoryBuilder.withCustomFormatAttributes()
method for deactivating custom format attributes.- [CLI] Options to resolve remote schema references. (Issue #4 proposed by @kerrykimbrough)
- [CLI] Revised completely with new syntax.
JsonSchema.containsKeyword()
which tests whether a schema contains the specified keyword or not.JsonSchema.defaultValue()
which returns the value of thedefault
keyword.JsonSchema.hasAbsoluteId()
which tests whether a schema has an$id
whose value is an absolute URI.JsonSchema.getInPlaceSubschemas()
which returns the subschemas which will be applied to the same instance location as the owning schema.- Detection of infinite recursive looping while reading schemas.
JsonSchema.subschemas()
andsubschemaAt()
were renamed togetSubschemas()
andgetSubschemaAt()
, respectively.
- A bug which was causing
JsonSchemaReader
to throw aClassCastException
when the schema has both$id
and$ref
keywords. (Issue #2 reported by @avstp) - A bug which was causing the evaluation result of
if
/then
/else
keywords to be ignored when the instance is a JSON object or a JSON array.
comment()
,title()
anddescription()
methods toJsonSchema
interface to obtain the keyword value respectively.JsonSchemaReaderFactory
andJsonSchemaReaderFactoryBuilder
as API interfaces.JsonSchemaReaderFactoryBuilder.withStrictWithKeywords()
. With this option enabled, the schema reader reports a problem when it encounters an unrecognized schema keyword.JsonSchemaReaderFactoryBuilder.withStrictWithFormats()
. With this option enabled, the schema reader reports a problem when it encounters an unrecognized format attribute.- [CLI]
-strict
option which forces the schema validator to report a problem when it finds an unrecognized keyword or format attribute. This is useful for detecting misspelled keywords and format attributes.
- Move
withSchemaResolver()
method inJsonSchemaReader
toJsonSchemaReaderFactoryBuilder
interface. BranchProblem
interface was merged withProblem
interface and removed.
- A bug which was causing JSON schemas to be valid even if they are unclosed JSON objects.
- Support of
contentEncoding
andcontentMediaType
keywords.
- Rename
schemaId()
toschema()
inJsonSchema
. - Correct
withItem()
towithItems()
inJsonSchemaBuilder
.
- A bug which was causing
definitions
/dependencies
/patternProperties
/properties
to disappear from the read schema when they are empty.
- A problem in Java 9/10.
- First release to the Maven Central Repository.