This is an automated email from the ASF dual-hosted git repository. rmannibucau pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/johnzon.git
The following commit(s) were added to refs/heads/master by this push: new 2206cac style fixes 2206cac is described below commit 2206cac7f6eb170a9cf0ebe078f861abb0d8deb5 Author: Romain Manni-Bucau <rmannibu...@gmail.com> AuthorDate: Thu Dec 3 12:33:43 2020 +0100 style fixes --- .../jsonschema/spi/builtin/IntegerValidation.java | 36 ++++++++++++++++------ .../jsonschema/JsonSchemaValidatorTest.java | 2 +- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/johnzon-jsonschema/src/main/java/org/apache/johnzon/jsonschema/spi/builtin/IntegerValidation.java b/johnzon-jsonschema/src/main/java/org/apache/johnzon/jsonschema/spi/builtin/IntegerValidation.java index dc12db5..8108457 100644 --- a/johnzon-jsonschema/src/main/java/org/apache/johnzon/jsonschema/spi/builtin/IntegerValidation.java +++ b/johnzon-jsonschema/src/main/java/org/apache/johnzon/jsonschema/spi/builtin/IntegerValidation.java @@ -1,28 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.apache.johnzon.jsonschema.spi.builtin; import java.util.Optional; import java.util.function.Function; import java.util.stream.Stream; -import javax.json.JsonNumber; import javax.json.JsonString; import javax.json.JsonValue; import javax.json.JsonValue.ValueType; -import org.apache.johnzon.jsonschema.ValidationResult; import org.apache.johnzon.jsonschema.ValidationResult.ValidationError; import org.apache.johnzon.jsonschema.spi.ValidationContext; import org.apache.johnzon.jsonschema.spi.ValidationExtension; public class IntegerValidation implements ValidationExtension { - @Override - public Optional<Function<JsonValue, Stream<ValidationError>>> create(ValidationContext model) { - final JsonValue type = model.getSchema().get("type"); - if (type.getValueType().equals(ValueType.STRING) && "integer".equals(JsonString.class.cast(type).getString())) { - return Optional.of(new MultipleOfValidation.Impl(model.toPointer(), model.getValueProvider(), 1)); - } - return Optional.empty(); - } + @Override + public Optional<Function<JsonValue, Stream<ValidationError>>> create(ValidationContext model) { + final JsonValue type = model.getSchema().get("type"); + if (type.getValueType().equals(ValueType.STRING) && "integer".equals(JsonString.class.cast(type).getString())) { + return Optional.of(new MultipleOfValidation.Impl(model.toPointer(), model.getValueProvider(), 1)); + } + return Optional.empty(); + } } diff --git a/johnzon-jsonschema/src/test/java/org/apache/johnzon/jsonschema/JsonSchemaValidatorTest.java b/johnzon-jsonschema/src/test/java/org/apache/johnzon/jsonschema/JsonSchemaValidatorTest.java index c9aa42f..cefd77b 100644 --- a/johnzon-jsonschema/src/test/java/org/apache/johnzon/jsonschema/JsonSchemaValidatorTest.java +++ b/johnzon-jsonschema/src/test/java/org/apache/johnzon/jsonschema/JsonSchemaValidatorTest.java @@ -360,7 +360,7 @@ public class JsonSchemaValidatorTest { @Test public void integerType() { - final JsonSchemaValidator validator = factory.newInstance(jsonFactory.createObjectBuilder() + final JsonSchemaValidator validator = factory.newInstance(jsonFactory.createObjectBuilder() .add("type", "object") .add("properties", jsonFactory.createObjectBuilder() .add("age", jsonFactory.createObjectBuilder()