From b868a47ec699fca90fb838ed2825e6cf7d5ec1be Mon Sep 17 00:00:00 2001 From: Abhimanyu Saharan Date: Mon, 10 Apr 2023 21:33:16 +0530 Subject: [PATCH] wip --- netbox/core/api/schema.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/netbox/core/api/schema.py b/netbox/core/api/schema.py index 203d98922..f3a5d6a70 100644 --- a/netbox/core/api/schema.py +++ b/netbox/core/api/schema.py @@ -231,7 +231,13 @@ class NetBoxAutoSchema(AutoSchema): # If a docstring is provided, use it. if self.view.__doc__: - return self.view.__doc__ + return get_doc(self.view.__class__) + + # When the action method is decorated with @action, use the docstring + # of the method. + action_or_method = getattr(self.view, getattr(self.view, 'action', self.method.lower()), None) + if action_or_method and action_or_method.__doc__: + return get_doc(action_or_method) # Else, generate a description from the class name. description = self.view.__class__.__name__