Proper debugging of REST Resource due to cache I'm creating some REST routes for my custom resources and I'm having some trouble with the debugging aspect of development.

Every time I change the resource's code, should I need to XDebug it, I need to clear Drupal's cache (drush cr) for the debug to work.

I have successfully disabled the ResourceResponse cache mechanism, so that when the data has changed in Drupal, it is reflected on the response. 

Although, I think that maybe due to the annotation mechanism, it's caching the function of my REST Resource, and, subsequently, when I change it, those changes don't propagate and Xdebug doesn't pick them up.

I also noticed that git signals that the resource plugin file has changed every time I clear the cache, which I think might be related.

Does anyone have some pointers they can share to overcome this?
As per @4k4 's suggestion, I'll try to put into and answer what he helped me figure out (though some details are still a bit murky).

When developing in a local environment, we can override the settings.php file with a settings.local.php file. In this local file, we can setup several settings regarding disabling Drupal's cache functionality.

At the time of writing, the instructions in this link were pretty straightforward and sufficient, but I would like to point out a few aspects that I felt weren't very explicit:


In my specific case, while developing custom REST Resources, both the response and the function of my resource were being cached. This is something I want to work like this in production. Although, for development, caching the function of my REST Resource meant that everytime I changed it, I had to clear the cache to allow for XDebug to see the changes in my Resource file. I overcame this by following the instructions in the Find cache bins section of the above link. Regarding my use case, I think the relevant cache bins should be the discovery and rest.
I think (though not sure), that having these bins not cached results in having to clear the cache if you add new discoverable code to your installation, ie, modules, REST resources, maybe themes. As these operations aren't as frequent in my case as the debugging procedure, it's a tradeoff I'm willing to make, but YMMV.
If you are using gitto version your code base, be sure to .gitignore the sites/default/settings.local.php file, otherwise it might end up in your production server, making it substantially slower.
I also tried following the procedure using Drupal Console as the link above suggested, but apparently since version 1.0.0-rc12 the drupal site:mode dev command isn't supported because it proved unstable. Maybe that will change soon.