Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space FUNCTDEV and version SVC2025.3

...

  1. Add a Responder at the beginning of the suite to serve as the entry point for all incoming requests.
  2. Chain a validation tool (such as a JSON Validator or a GraphQL Query Validator) to the Pre-correlation Incoming Request output of the responder.
  3. Chain a Text Data Bank to the validation tool. When you're done, you should have a setup similar to the one below.
  4. Configure the Text Data Bank to extract the validation result into a variable. In the example below, it is being extracted into a variable called validation_error.
  5. Configure the Responder Correlation of the Message Responder to reference the extracted validation result using one of the methods described below.
    • Method 1 - XPath Custom Scripting (preferred):
      To use XPath to evaluate the validation results, add an XPath like the following under Responder Correlation > Request Body > XPath:
      string-length("${validation_error}") > 0
      Image Removed
      Method 2 - Custom Scripting:
      To use a script to evaluate the validation results, add a script like the following under Responder Correlation > Custom (Groovy):
      Code Block
      def correlateOnValidationError(context) {
      	value = context.getValue("Generated Data Source", "validation_error")
      	return value != null && value.length() > 0
      }

    • Method 2 - XPath:
      To use XPath to evaluate the validation results, add an XPath like the following under Responder Correlation > Request Body > XPath:
      string-length("${validation_error}") > 0
      Image Added
  6. Configure the responder payload of the Message Responder to return a custom error message when a request fails validation like the following:
    Code Block
    {
    	"status": 400,
    	"error" : "${validation_error}"
    }