in src/main/java/com/amazonaws/mskdatagen/validators/ValidateAttrShape.java [23:46]
public void validate(Context context) {
List<Config> attrConfig = context.getRetainedConfig()
.filter(t -> ConfigType.ATTR_CONFIG.getConfigGroup().equals(t.getKind()))
.map(RetainedConfig::getOriginalConfigs)
.flatMap(Collection::stream)
.collect(Collectors.toList());
for (Config config : attrConfig) {
getGen(context, config.getTopic(), config.getNs())
.ifPresent(gen -> {
if (gen.get(Collections.emptyList()) != null && Kind.ATTRIBUTE_PRIMITIVE != config.getKind()) {
String message = "Complex attribute configuration is supplied for topic %s, but its generated %s is a primitive type. Stopping because these configurations are incompatible. Either change its %s to a complex type or change this configuration to a primitive type.";
String originalConfig = config.getOriginalKey() + " = " + config.getValue();
throw new ValidateException(originalConfig, String.format(message, config.getTopic(), config.getNs(), config.getNs()));
}
});
if (Kind.ATTRIBUTE_COMPLEX != config.getKind()) {
String message = "Primitive attribute configuration is supplied for topic %s, but its generated %s is a complex type. Stopping because these configurations are incompatible. Either change its %s to a primitive type or change this configuration to a complex type.";
String originalConfig = config.getOriginalKey() + " = " + config.getValue();
throw new ValidateException(originalConfig, String.format(message, config.getTopic(), config.getNs(), config.getNs()));
}
}
}