Class JsonSchemaValidation

java.lang.Object
org.citrusframework.validation.json.schema.JsonSchemaValidation
All Implemented Interfaces:
SchemaValidator<JsonMessageValidationContext>

public class JsonSchemaValidation extends Object implements SchemaValidator<JsonMessageValidationContext>
This class is responsible for the validation of json messages against json schemas / json schema repositories.
Since:
2.7.3
  • Constructor Details

    • JsonSchemaValidation

      public JsonSchemaValidation()
    • JsonSchemaValidation

      public JsonSchemaValidation(JsonSchemaFilter jsonSchemaFilter)
  • Method Details

    • validate

      public void validate(Message message, TestContext context, JsonMessageValidationContext validationContext)
      Specified by:
      validate in interface SchemaValidator<JsonMessageValidationContext>
    • constructErrorMessage

      protected String constructErrorMessage(GraciousProcessingReport report)
      Constructs the error message of a failed validation based on the processing report passed from ValidationMessage.
      Parameters:
      report - The report containing the error message
      Returns:
      A string representation of all messages contained in the report
    • validate

      public GraciousProcessingReport validate(Message message, List<JsonSchemaRepository> schemaRepositories, JsonMessageValidationContext validationContext, ReferenceResolver referenceResolver)
      Validates the given message against a list of JsonSchemaRepositories under consideration of the actual context
      Parameters:
      message - The message to be validated
      schemaRepositories - The schema repositories to be used for validation
      validationContext - The context of the validation to be used for the validation
      referenceResolver - holding bean references for lookup.
      Returns:
      A report holding the results of the validation
    • supportsMessageType

      public boolean supportsMessageType(String messageType, Message message)
      Checks whether the supplied message type is supported by the message.
      Specified by:
      supportsMessageType in interface SchemaValidator<JsonMessageValidationContext>
      Parameters:
      messageType - the message type to check
      message - the message
      Returns:
      true if the message or message type is supported by this validator