Patch method sample code REST API
It's actually quite simple. You only have to do like this:

public function patch() {
  // Write your code in here.
}


The patch function uses the canonical link just like get.

 * uri_paths = {
 *   "canonical" = "/path-to-endpoint", // Used for GET, PATCH and DELETE.
 *   "create" = "/path-to-endpoint/post" // Used for POST.
 * }


To get the request object, I think that you can use $request as first argument like this:

use Symfony\Component\HttpFoundation\Request;

public function patch(Request $request) {
  // Write your code in here.
}