Closed marcoaaguiar closed 3 years ago
Hi @marcoaaguiar thanks for reporting this.
In #65 I've changed it so that all prefixes are lowercase. Even if you specifyprefix="MyModel"
it would turn into "mymodel". That being said, this could cause problems if someone wanted an uppercase path prefix (for whatever reason). Alternatively, I can just fix the tortoise issue,
Thoughts?
Hi Adam, I believe that would fix the issue.
I started using this package this morning, and it's great to see that it is under development/maintenance! The only feature that seems to be missing is filtering, but it seems that soon it will be available (#61).
When #65 is merged, feel free to close this issue.
Awesome! Thanks for the feedback, filtering will be released soon 😃
When using TortoiseCRUDRouter, the CRUD routers generate a base prefix that has the same casing as the db_model.
For instance, for a router with prefix "/api", and an object CRUD router defined by
The generated CRUD route that appears in the
/doc
is/api/User
, which is quite odd for APIs.This issue seems to come from the interaction of these 2 lines https://github.com/awtkns/fastapi-crudrouter/blob/e1a4a2b6e363ad82c3a2b0058e7029824eae5771/fastapi_crudrouter/core/tortoise.py#L48 and https://github.com/awtkns/fastapi-crudrouter/blob/e1a4a2b6e363ad82c3a2b0058e7029824eae5771/fastapi_crudrouter/core/_base.py#L49
Since the
prefix
is defined in theTortoiseCRUDRouter
, it is never lowercasedThis might be intended. Anyway, this behavior can be circumvented by passing
prefix
to the TortoiseCRUDRouter.