I'm using drf-spectacular to document the API endpoints of a Django / DRF project, mainly with the @extend_schema decorator and it works nicely for the Swagger UI.
What I would like to do is to "alter the behaviour" of some of the API endpoints so that when they are called from Swagger UI, we end up with a faked response of some sort (instead of regularly processing the request through the code).
So I'm trying things with the GET_MOCK_REQUEST setting, but I can't get anywhere :
- its function seems to be called once per detected endpoint during api schema generation called through URL
my-project/api-schema/(but I can't see any changes in the yaml schema file, is this revealing ?). - when playing with the supposed "altered endpoints" in Swagger UI, this function is not called.
I'm probably missing something here, I might have misunderstood what GET_MOCK_REQUEST is meant for...
Some help would be appreciated.