This is a Scala implementation of a JSON Schema validator based upon the great io.circe Library.
Note: the validator is in early state and API may not be stable.
- Implementing JSON Schema 2020-12, 2019-09
- All tests of the JSON Schema Test Suite passing
- You can bring your own Downloader (using Tagless Final Pattern)
- Support for Scala 2.12, 2.13 and 3
dynamicRef
anddynamicAnchor
are very rough implemented- Unknown Keywords are ignored and won't be serialized again.
- Only JSON Schema 2020-12, 2019-09 and one Circe-Version supported so far.
- The API will only be stable in patch versions
Regex Patterns are directly given to java.util.regex.Pattern.compile
. This could be not secure and could lead to ReDoS Attacks. Do not trust JSON schemas from an untrusted source.
Only use this library for trusted JSON-Schemas
This is BETA-Software. Use at your own risk.
Please have a look in the examples
folder for some Examples.
There are some main Types
Json
the JSON Representation of the Circe-Library.Schema
represents a single JSON-Schema and can be parsed fromJson
.Validator
a single validator validating some JSONValidationResult
the result of a validation, contains possible violations.DocumentValidator
a validator for a full set of JSON-Schema-Documents. This is what you want to use for ValidatingSingleDocumentValidator
representing a single document withinDocumentValidator
Loader
the main entry point to load and parse JSON-Schemas, which provide a DocumentValidator for you.Downloader
during resolving, it is possible, that additional URLs need to be downloaded. The downloader is responsible for that and you can bring your own. There exists a dummy implementation which doesn't download anythingDownloader.emptySimple
and an implementation which is using Java-URL-FacilitiesDownloader.JavaUrlDownloader
The library is released under terms of Apache License 2.0
3rdparty
contans 3rd-Party references
JSON-Schema-Test-Suite
, licensed under terms of MIT-Licenseschema
contains the JSON Schemas of JSON Schema, released unter terms of BSD-License.