com.jetdrone.vertx.yoke.json.AnyValidator Maven / Gradle / Ivy
package com.jetdrone.vertx.yoke.json;
import java.util.List;
import java.util.Map;
public final class AnyValidator {
public static boolean isValid(Object instance, JsonSchemaResolver.Schema schema) {
// validate required
if (instance == null) {
if (Boolean.TRUE.equals(schema.get("required"))) {
return false;
}
}
// apply default value
if (instance == null) {
instance = schema.get("default");
}
if (instance != null) {
// validate enum
List