def validate_experiment()

in scripts/validate.py [0:0]


def validate_experiment(item):
    for branch in item.get("branches"):
        message_type, branch_message = get_branch_message(branch)
        if branch_message is None:
            print("\tSkip branch {} because it's empty".format(branch.get("slug")))
            continue

        schema = load_schema(message_type)
        try:
            branch_message_list = (
                branch_message if isinstance(branch_message, list) else [branch_message]
            )
            for message in branch_message_list:
                jsonschema.validate(instance=message, schema=schema)
            print(
                "\tValidate {} with schema {}".format(branch.get("slug"), message_type)
            )
        except ValidationError as err:
            match = best_match([err])
            print("\tValidation error: {}".format(match.message))
            sys.exit(1)

        # Validate the targeting JEXL if any
        validate_item_targeting(branch_message, True)

        # Validate all the message actions
        validate_all_actions(branch_message, True)

        # Validate the message_id naming
        validate_experiment_message_id(item["slug"], branch)