Class declaration error when using ResourceBase
It looks like the problem was not with the REST API routes, but with the module name vs. namespace: in trying to pay attention to the details of the REST API extension, I missed that my module name was different from the namespace. In the above example, the module name is


  my_module


while the namespace is


  Drupal\my_module_rest_api\Plugin\rest\resource