I'm using drf_spectacular to be able to use swagger and it's working fine. I define the required parameters for my API views (whether in the path or in the header) like this:
@extend_schema(
OpenApiParameter(
name='accept-language',
type=str,
location=OpenApiParameter.HEADER,
description="fa or en. The default value is en"
),
)
but I don't want to add these lines of code to all of my API views. Is there an easy way to do this? (Something like defining these lines of code in SPECTACULAR_SETTINGS)
I already found an APPEND_COMPONENTS option in drf_spectacular's documentation but I'm not familiar with it.