Class BaseJsonValidator

    • Field Detail

      • schemaPath

        protected String schemaPath
      • schemaNode

        protected com.fasterxml.jackson.databind.JsonNode schemaNode
      • suppressSubSchemaRetrieval

        protected final boolean suppressSubSchemaRetrieval
      • failFast

        protected final boolean failFast
    • Method Detail

      • getSchemaPath

        public String getSchemaPath()
      • getSchemaNode

        public com.fasterxml.jackson.databind.JsonNode getSchemaNode()
      • getParentSchema

        public JsonSchema getParentSchema()
      • validate

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

        protected static boolean equals​(double n1,
                                        double n2)
      • greaterThan

        protected static boolean greaterThan​(double n1,
                                             double n2)
      • lessThan

        protected static boolean lessThan​(double n1,
                                          double n2)
      • parseErrorCode

        protected void parseErrorCode​(String errorCodeKey)
      • debug

        protected static void debug​(org.slf4j.Logger logger,
                                    com.fasterxml.jackson.databind.JsonNode node,
                                    com.fasterxml.jackson.databind.JsonNode rootNode,
                                    String at)
      • updateValidatorType

        protected void updateValidatorType​(ValidatorTypeCode validatorTypeCode)
      • getNodeFieldType

        protected String getNodeFieldType()
      • walk

        public Set<ValidationMessage> walk​(com.fasterxml.jackson.databind.JsonNode node,
                                           com.fasterxml.jackson.databind.JsonNode rootNode,
                                           String at,
                                           boolean shouldValidateSchema)
        This is default implementation of walk method. Its job is to call the validate method if shouldValidateSchema is enabled.
        Specified by:
        walk in interface JsonSchemaWalker
        Specified by:
        walk in interface JsonValidator
        Parameters:
        node - JsonNode
        rootNode - JsonNode
        at - String
        shouldValidateSchema - boolean
        Returns:
        a set of validation messages if shouldValidateSchema is true.
      • isPartOfOneOfMultipleType

        protected boolean isPartOfOneOfMultipleType()
      • getPathType

        protected PathType getPathType()
      • atRoot

        protected String atRoot()
        Get the root path.
        Returns:
        The path.
      • atPath

        protected String atPath​(String currentPath,
                                String token)
        Create the path for a given child token.
        Parameters:
        currentPath - The current path.
        token - The child token.
        Returns:
        The complete path.
      • atPath

        protected String atPath​(String currentPath,
                                int index)
        Create the path for a given child indexed item.
        Parameters:
        currentPath - The current path.
        index - The child index.
        Returns:
        The complete path.
      • registerAndMergeDiscriminator

        protected static void registerAndMergeDiscriminator​(ValidationContext.DiscriminatorContext currentDiscriminatorContext,
                                                            com.fasterxml.jackson.databind.node.ObjectNode discriminator,
                                                            JsonSchema schema,
                                                            String at)
        Rolls up all nested and compatible discriminators to the root discriminator of the type. Detects attempts to redefine the propertyName or mappings.
        Parameters:
        currentDiscriminatorContext - the currently active ValidationContext.DiscriminatorContext
        discriminator - the discriminator to use for the check
        schema - the value of the discriminator/propertyName field
        at - the logging prefix