Coverage for apis_core/generic/schema.py: 43%

7 statements  

« prev     ^ index     » next       coverage.py v7.6.10, created at 2025-02-19 16:54 +0000

1from drf_spectacular.openapi import AutoSchema 

2 

3 

4class GenericAutoSchema(AutoSchema): 

5 """ 

6 Add an option to the default drf_spectacular schema that 

7 allows to set the tags of a route via the model. 

8 """ 

9 

10 def get_tags(self) -> list[str]: 

11 model = getattr(self.view, "model", None) 

12 if hasattr(model, "get_openapi_tags"): 

13 return model.get_openapi_tags() 

14 return super().get_tags()