'Show request duration in drf-spectacular (Swagger)

I have a Django/DRF project with drf-spectacular (Swagger) integration and wondering how can I add a request duration as shown on the image below. Is there any way to achive elapsed time section? Thanks in advance.

enter image description here



Solution 1:[1]

That is a Swagger-UI feature independent of drf-spectacular. To pass it through simply set the setting like so:


SPECTACULAR_SETTINGS = {
    "SWAGGER_UI_SETTINGS": {
        "displayRequestDuration": True,
        # other swagger settings
    },
    # other spectcular settings
}

other swagger settings can be found here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Insa