in src/main/java/software/amazon/event/kafkaconnector/offloading/S3EventBridgeEventDetailValueOffloading.java [109:128]
private static JsonPath compileRestrictedJsonPath(String value) {
JsonPath jsonPath;
try {
jsonPath = JsonPath.compile(value);
} catch (Exception e) {
throw new IllegalArgumentException(format("Invalid JSON Path '%s'.", value));
}
if (!jsonPath.getPath().startsWith("$['detail']['value']")) {
throw new IllegalArgumentException(
format("JSON Path must start with '%s' but is '%s'.", JSON_PATH_PREFIX, value));
}
if (!jsonPath.isDefinite()) {
throw new IllegalArgumentException(
format("JSON Path must be definite but '%s' is not.", value));
}
// rewrite $.detail -> $,
// because PutEventsRequestEntry#detail is the sub document of $.detail
return JsonPath.compile("$" + jsonPath.getPath().substring("$['detail']".length()));
}