in server/src/main/java/com/epam/aidial/core/server/service/PublicationService.java [539:559]
private void validateRules(Publication publication) {
if (publication.getRules() != null) {
for (Rule rule : publication.getRules()) {
Rule.Function function = rule.getFunction();
if (function == null) {
throw new IllegalArgumentException("Rule does not have function");
}
if (rule.getSource() == null) {
throw new IllegalArgumentException("Rule does not have source");
}
// function TRUE or FALSE do not require targets
if (function != Rule.Function.TRUE && function != Rule.Function.FALSE) {
if (rule.getTargets() == null || rule.getTargets().isEmpty()) {
throw new IllegalArgumentException("Rule %s does not have targets".formatted(function));
}
}
}
}
}