In Detail:
Create a file in same directory where setting.py is. Let's say file name is excluded_path.py
1- Add to excluded_path.py:
Here's the schema is path we don't want to show in output of docs.
def custom_preprocessing_hook(endpoints):
filtered = []
for (path, path_regex, method, callback) in endpoints:
if "schema" not in path:
filtered.append((path, path_regex, method, callback))
return filtered
2- settings.py
SPECTACULAR_SETTINGS = {
'PREPROCESSING_HOOKS': ["djapi.excluded_path.custom_preprocessing_hook"]
}