START

START node is obligatory for every scenario!
This node defines input variables for the scenario. Variables can be defined manually in a settings panel or imported in a JSON or CSV format. It is also possible to define validators for specified input variables, which ensures that proper values are submitted.
Example of input variables in CSV format:
true;var3;DOUBLE;;
true;var4;aa#bb#cc;;Columns of this CSV contain, respectively, an information whether the variable is required, variable name, type, description and tags.
Available types: STRING, DOUBLE, INTEGER, DICTIONARY, MAP, VECTOR, BOOLEAN

Parameters of the node:
Variables (adding / removing))
Variable type, name, description (shown as a field description in a form)
Possible values of dictionaries
required / non-required
Validators
Define validator per variable; multiple validators available
If the validation fails, the engine returns an error (HTTP 400)
We can define a custom error description providing it as a Groovy/Python/R script result
Any returned value other than logical true is treated as failure of the validation
Variable definition import from JSON file
Example of validation code (verification of variable length):
if ((object as String).length()!=32) {
result=’Error. Incorrect string length.’
}
else {
result=true
}
return resultComplex variable validation
In case we need validate complex types (MAP, VECTOR) there is validation API based on JSON Schema (https://json-schema.org/) or Swagger / OpenAPI.
In case of successful validation, we return the boolean value true, otherwise we return a text containing an error message. The message will be returned in the API response.
JSON Schema validator example
import com.algolytics.sce.core.scenario.validator.JsonSchemaValidator
def schemaStr = '''
<JSON Schema for the variable>
'''
errors = JsonSchemaValidator.validate(object, schemaStr)
if (errors.size() > 0) {
return errors.toString()
} else {
return true
}Swagger validator example
import com.algolytics.sce.core.scenario.validator.*
import org.openapi4j.core.validation.ValidationSeverity
def schemaStr = '''
<Swagger for the variable>
'''
validationData = OpenApi3Validator.validateForJson(object, schemaStr, 'AlgolyticsRequestZonk')
if (validationData.isValid()) {
return true
} else {
return validationData.results().items(ValidationSeverity.ERROR).toString()
}Last updated