Skip to content

Commit 4a234f0

Browse files
committed
fixed generated operationId starting with number #173
1 parent f12eaeb commit 4a234f0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ninja_extra/controllers/base.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,10 @@ def __str__(self) -> str: # pragma: no cover
450450
def _add_operation_from_route_function(self, route_function: RouteFunction) -> None:
451451
# converts route functions to Operation model
452452
if route_function.route.route_params.operation_id is None:
453-
route_function.route.route_params.operation_id = f"{str(uuid.uuid4())[:8]}_controller_{route_function.route.view_func.__name__}"
453+
controller_name = (
454+
str(self.controller_class.__name__).lower().replace("controller", "")
455+
)
456+
route_function.route.route_params.operation_id = f"{controller_name}_{route_function.route.view_func.__name__}_{str(uuid.uuid4())[:8]}"
454457

455458
if (
456459
self.auth

0 commit comments

Comments
 (0)