Repository: johnzon Updated Branches: refs/heads/master d6bb9526b -> 1aea0bbf4
ensure TypeValidation don't fail with something else than a string on type Project: http://git-wip-us.apache.org/repos/asf/johnzon/repo Commit: http://git-wip-us.apache.org/repos/asf/johnzon/commit/1aea0bbf Tree: http://git-wip-us.apache.org/repos/asf/johnzon/tree/1aea0bbf Diff: http://git-wip-us.apache.org/repos/asf/johnzon/diff/1aea0bbf Branch: refs/heads/master Commit: 1aea0bbf4a01de4b131ff21f743d9e744c937e1f Parents: d6bb952 Author: Romain Manni-Bucau <[email protected]> Authored: Mon Oct 8 17:32:42 2018 +0200 Committer: Romain Manni-Bucau <[email protected]> Committed: Mon Oct 8 17:32:42 2018 +0200 ---------------------------------------------------------------------- .../apache/johnzon/jsonschema/spi/builtin/TypeValidation.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/johnzon/blob/1aea0bbf/johnzon-jsonschema/src/main/java/org/apache/johnzon/jsonschema/spi/builtin/TypeValidation.java ---------------------------------------------------------------------- diff --git a/johnzon-jsonschema/src/main/java/org/apache/johnzon/jsonschema/spi/builtin/TypeValidation.java b/johnzon-jsonschema/src/main/java/org/apache/johnzon/jsonschema/spi/builtin/TypeValidation.java index f44573f..182c6a1 100644 --- a/johnzon-jsonschema/src/main/java/org/apache/johnzon/jsonschema/spi/builtin/TypeValidation.java +++ b/johnzon-jsonschema/src/main/java/org/apache/johnzon/jsonschema/spi/builtin/TypeValidation.java @@ -36,8 +36,8 @@ import org.apache.johnzon.jsonschema.spi.ValidationExtension; public class TypeValidation implements ValidationExtension { @Override public Optional<Function<JsonValue, Stream<ValidationResult.ValidationError>>> create(final ValidationContext model) { - final JsonString value = model.getSchema().getJsonString("type"); - if (value == null) { + final JsonValue value = model.getSchema().get("type"); + if (!JsonString.class.isInstance(value)) { // todo: other types? return Optional.empty(); } switch (JsonString.class.cast(value).getString()) {
