From 0b817c1dfa968ff2ca55a5b323a4479bcba49223 Mon Sep 17 00:00:00 2001 From: Sebastian Toepfer <61313468+sebastian-toepfer@users.noreply.github.com> Date: Sat, 2 Dec 2023 13:33:53 +0100 Subject: [PATCH] Create README.md --- README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..7b7ae9a1 --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +# json-schema +json schema for json-api + +## maven dependency + +```xml + + + ${project.groupId} + json-schema-api + 0.1.0-SNAPSHOT + + + + ${project.groupId} + json-schema-core + 0.1.0-SNAPSHOT + +``` + +## create a jsonschema instance +```java +final JsonSchema schema = JsonSchemas.load("{}"); +``` + +## validate a json instance againts a schema +```java +if (schema.validator().isValid("{}")) { + processJson("{}"); +} else { + throws new IllegalArgumentException("Json is not valid"); +} +``` + +## extend with own keywords (define a vocabulary) + +Provide a service of type `io.github.sebastiantoepfer.jsonschema.vocabulary.spi.LazyVocabularies` +Provide a implemention of type `io.github.sebastiantoepfer.jsonschema.Vocabulary` + +To use your new Vocabulary put it into the classpath define it in the schema: +``` +{ + $vocabulary: { + "": true //or false if is not required -> means validtion works also if it is not in classpath + } +} +```