ModelController generated method names mangle OpenApiClient generation
Without django-ninja-extra, using just django-ninja, OpenApiClient generation yields a client with methods such as
api_instance.my_api_create_project
After introducing django-ninja-extra and using it to create a new set of API endpoints via
@api_controller("/projects")
class ProjectController(ModelControllerBase):
model_config = ModelConfig(
model=Project,
schema_config=ModelSchemaConfig(),
allowed_routes=['create', 'find_one', 'update', 'delete', 'list'],
create_schema=ProjectIn,
retrieve_schema=ProjectOut,
update_schema=ProjectUpdateIn,
)
OpenApiClient generation warns with
[main] WARN o.o.c.l.AbstractPythonCodegen - 3ad0a930ControllerCreateItem5ad349 (starting with a number) cannot be used as method name. Renamed to call_3ad0a930_controller_create_item5ad349
and the generated method becomes
api_instance.call_3ad0a930_controller_create_item5ad349
Schemas shown on the OpenApi autogenerated documentation also include strangely named schemas, which may be related:
Is there something else I should be doing to allow django-ninja-extra to generate better method names?
@peteratdemtec The method names are generated with uuid to avoid been overridden by extra endpoints that might be defined in the ModelController.
Can you please provide more context to the warning you are having so I can know how best to fix it?
I believe this resolved with the recent update