Class TypeValidator

    • Constructor Detail

      • TypeValidator

        public TypeValidator​(String schemaPath,
                             com.fasterxml.jackson.databind.JsonNode schemaNode,
                             JsonSchema parentSchema,
                             ValidationContext validationContext)
    • Method Detail

      • getSchemaType

        public JsonType getSchemaType()
      • equalsToSchemaType

        public boolean equalsToSchemaType​(com.fasterxml.jackson.databind.JsonNode node)
      • validate

        public Set<ValidationMessage> validate​(com.fasterxml.jackson.databind.JsonNode node,
                                               com.fasterxml.jackson.databind.JsonNode rootNode,
                                               String at)
        Description copied from interface: JsonValidator
        Validate the given JsonNode, the given node is the child node of the root node at given data path.
        Specified by:
        validate in interface JsonValidator
        Parameters:
        node - JsonNode
        rootNode - JsonNode
        at - String
        Returns:
        A list of ValidationMessage if there is any validation error, or an empty list if there is no error.
      • isInteger

        public static boolean isInteger​(String str)
      • isBoolean

        public static boolean isBoolean​(String s)
      • isNumeric

        public static boolean isNumeric​(String str)
      • isNumber

        public static boolean isNumber​(com.fasterxml.jackson.databind.JsonNode node,
                                       SchemaValidatorsConfig config)
        Check if the type of the JsonNode's value is number based on the status of typeLoose flag.
        Parameters:
        node - the JsonNode to check
        config - the SchemaValidatorsConfig to depend on
        Returns:
        boolean to indicate if it is a number