I'm trying to validate my Javalin POST requests with a specific JSON field name. The field name must match the expected field name, and I'm not sure how I can do this.
The JSON field name I am expecting is "someIds", but the Jackson mapping and validation works even if the JSON field name is anything else (e.g. "notSomeIds").
How can I enforce that if the name doesn't match the validation stops?
if (ctx.body().isBlank() && !ctx.bodyValidator(ApiRequest.class).isValid()) {
throw new BadRequestResponse("Invalid JSON body in request");
}