Skip to content

Commit

Permalink
feat(generic): add a get_openapi_tags class method
Browse files Browse the repository at this point in the history
This method is used by the GenericAutoSchema to retreive tags for the
OpenAPI schema
  • Loading branch information
b1rger committed Dec 18, 2024
1 parent 6512c7b commit 3a8efa0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apis_core/generic/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.forms import model_to_dict
from django.urls import reverse

from apis_core.generic.helpers import permission_fullname
from apis_core.generic.helpers import mro_paths, permission_fullname
from apis_core.generic.signals import (
post_duplicate,
post_merge_with,
Expand Down Expand Up @@ -39,6 +39,10 @@ def get_importview_url(cls):
ct = ContentType.objects.get_for_model(cls)
return reverse("apis_core:generic:import", args=[ct])

@classmethod
def get_openapi_tags(cls):
return [item[-1] for item in mro_paths(cls)]

def get_edit_url(self):
ct = ContentType.objects.get_for_model(self)
return reverse("apis_core:generic:update", args=[ct, self.id])
Expand Down

0 comments on commit 3a8efa0

Please sign in to comment.