in graphql-dgs-example-shared/src/main/java/com/netflix/graphql/dgs/example/shared/datafetcher/RatingMutation.java [28:40]
public Rating addRating(@InputArgument("input") RatingInput ratingInput, DgsDataFetchingEnvironment dfe) {
if(!dfe.isArgumentSet("input", "title")) {
throw new IllegalArgumentException("Title must be explicitly provided");
}
if(ratingInput.getStars() < 0) {
throw new IllegalArgumentException("Stars must be 1-5");
}
System.out.println("Rated " + ratingInput.getTitle() + " with " + ratingInput.getStars() + " stars") ;
return new Rating(ratingInput.getStars());
}