@@ -85,6 +85,11 @@ def _clean_path(cls, path: str) -> str:
8585 working_path = path .split ("?" )
8686 return working_path [0 ]
8787
88+ @classmethod
89+ def _change_name (cls , name_prefix : str ) -> str :
90+ unique = str (uuid .uuid4 ())[:6 ]
91+ return f"{ name_prefix } _{ unique } "
92+
8893 @classmethod
8994 def _path_resolver (cls , path : str ) -> t .Callable :
9095 """
@@ -169,7 +174,7 @@ def create(
169174 custom_handler : t .Optional [t .Callable [..., t .Any ]] = None ,
170175 description : t .Optional [str ] = None ,
171176 operation_id : t .Optional [str ] = None ,
172- summary : t .Optional [str ] = None ,
177+ summary : t .Optional [str ] = "Create new item" ,
173178 tags : t .Optional [t .List [str ]] = None ,
174179 deprecated : t .Optional [bool ] = None ,
175180 by_alias : bool = False ,
@@ -218,6 +223,7 @@ def create_item(
218223 assert instance , "`service.create` or `custom_handler` must return a value"
219224 return instance
220225
226+ create_item .__name__ = cls ._change_name ("create_item" )
221227 return create_item # type:ignore[no-any-return]
222228
223229 @classmethod
@@ -233,7 +239,7 @@ def update(
233239 object_getter : t .Optional [t .Callable [..., DjangoModel ]] = None ,
234240 custom_handler : t .Optional [t .Callable [..., t .Any ]] = None ,
235241 operation_id : t .Optional [str ] = None ,
236- summary : t .Optional [str ] = None ,
242+ summary : t .Optional [str ] = "Update an item" ,
237243 tags : t .Optional [t .List [str ]] = None ,
238244 deprecated : t .Optional [bool ] = None ,
239245 by_alias : bool = False ,
@@ -293,6 +299,7 @@ def update_item(
293299 assert instance , "`service.update` or `custom_handler` must return a value"
294300 return instance
295301
302+ update_item .__name__ = cls ._change_name ("update_item" )
296303 return update_item # type:ignore[no-any-return]
297304
298305 @classmethod
@@ -308,7 +315,7 @@ def patch(
308315 object_getter : t .Optional [t .Callable [..., DjangoModel ]] = None ,
309316 custom_handler : t .Optional [t .Callable [..., t .Any ]] = None ,
310317 operation_id : t .Optional [str ] = None ,
311- summary : t .Optional [str ] = None ,
318+ summary : t .Optional [str ] = "Patch Item Update" ,
312319 tags : t .Optional [t .List [str ]] = None ,
313320 deprecated : t .Optional [bool ] = None ,
314321 by_alias : bool = False ,
@@ -366,6 +373,7 @@ def patch_item(
366373 assert instance , "`service.patch()` or `custom_handler` must return a value"
367374 return instance
368375
376+ patch_item .__name__ = cls ._change_name ("patch_item" )
369377 return patch_item # type:ignore[no-any-return]
370378
371379 @classmethod
@@ -379,7 +387,7 @@ def find_one(
379387 description : t .Optional [str ] = None ,
380388 object_getter : t .Optional [t .Callable [..., DjangoModel ]] = None ,
381389 operation_id : t .Optional [str ] = None ,
382- summary : t .Optional [str ] = None ,
390+ summary : t .Optional [str ] = "Find a specific item" ,
383391 tags : t .Optional [t .List [str ]] = None ,
384392 deprecated : t .Optional [bool ] = None ,
385393 by_alias : bool = False ,
@@ -427,6 +435,7 @@ def get_item(self: "ModelControllerBase", **kwargs: t.Any) -> t.Any:
427435 self .check_object_permissions (obj )
428436 return obj
429437
438+ get_item .__name__ = cls ._change_name ("get_item" )
430439 return get_item # type:ignore[no-any-return]
431440
432441 @classmethod
@@ -438,7 +447,7 @@ def list(
438447 url_name : t .Optional [str ] = None ,
439448 description : t .Optional [str ] = None ,
440449 operation_id : t .Optional [str ] = None ,
441- summary : t .Optional [str ] = None ,
450+ summary : t .Optional [str ] = "List of Items" ,
442451 tags : t .Optional [t .List [str ]] = None ,
443452 deprecated : t .Optional [bool ] = None ,
444453 by_alias : bool = False ,
@@ -513,6 +522,7 @@ def list_items(self: "ModelControllerBase", **kwargs: t.Any) -> t.Any:
513522 openapi_extra = openapi_extra ,
514523 )(list_items )
515524
525+ list_items .__name__ = cls ._change_name ("list_items" )
516526 return list_items # type:ignore[no-any-return]
517527
518528 @classmethod
@@ -550,7 +560,7 @@ def delete(
550560 response = {status_code : str },
551561 description = description ,
552562 operation_id = operation_id ,
553- summary = summary ,
563+ summary = "Delete An Item" ,
554564 tags = tags ,
555565 deprecated = deprecated ,
556566 by_alias = by_alias ,
@@ -577,4 +587,5 @@ def delete_item(self: "ModelControllerBase", **kwargs: t.Any) -> t.Any:
577587 ) if custom_handler else self .service .delete (instance = obj , ** kwargs )
578588 return self .create_response (message = "" , status_code = status_code )
579589
590+ delete_item .__name__ = cls ._change_name ("delete_item" )
580591 return delete_item # type:ignore[no-any-return]
0 commit comments