eadwinCode/django-ninja-extra

Generated operationId can start with number breaking many openapi generators

Closed this issue · 1 comments

When not providing an operationId a random UUID is generated and cut off.

def _add_operation_from_route_function(self, route_function: RouteFunction) -> None:
# converts route functions to Operation model
if route_function.route.route_params.operation_id is None:
route_function.route.route_params.operation_id = f"{str(uuid.uuid4())[:8]}_controller_{route_function.route.view_func.__name__}"

This UUID can beginn with a number which is not an valid type name in, for instance typescript type or a valid method name in PHP.

It would be ideal to guarantee that the randomly generated string starts with a letter.

@Loeffeldude will fix this shortly