Class JsonSchemaValidationService


  • @Service
    public class JsonSchemaValidationService
    extends Object
    This class provides a validation service using JSON Schemas.
    Author:
    roger
    • Constructor Detail

      • JsonSchemaValidationService

        public JsonSchemaValidationService​(org.springframework.core.io.ResourceLoader resourceLoader)
        Default constructor of this class.
        Parameters:
        resourceLoader - Spring Resource Loader
    • Method Detail

      • exists

        public boolean exists​(String key)
        This method verifies if the JSON Schema is available.
        Parameters:
        key - the JSON Schema name
        Returns:
        true if the JSON Schema exists, or false if not
      • validate

        public void validate​(TOTVSMessage<?> message,
                             String key)
        Validates a TOTVSMessage against a JSON Schema
        Parameters:
        message - the TOTVSMessage to be validated
        key - the JSON Schema name
      • validate

        public void validate​(String json,
                             String key)
        Validates a JSON against a JSON Schema
        Parameters:
        json - the JSON string to be validate
        key - the JSON Schema name