Skip to content

Commit

Permalink
#22: add documentation for the validation method
Browse files Browse the repository at this point in the history
  • Loading branch information
gowthamnvv committed Oct 21, 2021
1 parent a6e0809 commit c40ac7d
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ public static String getUsername(String userInfo) {
}
}

/***
* Checks if a field "id" exists in the object created from the Json. This will be used to validate the incoming json in POST API calls.
* If present, it should reject the API call because new ids are created by MongoDB, and user shouldn't update the document through a
* POST call.
* @param id
*/
public static void throwExceptionIfIdPresent(String id){
if(id != null){
throw new IncoreHTTPException(Response.Status.BAD_REQUEST, "Ids are auto-generated by the system. " +
Expand Down

0 comments on commit c40ac7d

Please sign in to comment.