fastapi-code-generator icon indicating copy to clipboard operation
fastapi-code-generator copied to clipboard

In routers.jinja2 template operation path is specified as "snake_case_path" instead of just "path"

Open codeseedr opened this issue 9 months ago • 0 comments

Please compare:

https://github.com/koxudaxi/fastapi-code-generator/blob/0.5.3/fastapi_code_generator/template/main.jinja2#L18

@app.{{operation.type}}('{{operation.path}}', response_model={{operation.response}}

with:

https://github.com/koxudaxi/fastapi-code-generator/blob/0.5.3/fastapi_code_generator/modular_template/routers.jinja2#L13

@router.{{operation.type}}('{{operation.snake_case_path}}', response_model={{operation.response}}

A param in path gets forcibly formatted in snake case while in the schema YAML it may be formatted differently, and if it happens to be, there is an obvious mismatch.

codeseedr avatar Apr 25 '25 18:04 codeseedr