-
-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add feature to customize the item_id parameter name #174
base: master
Are you sure you want to change the base?
Add feature to customize the item_id parameter name #174
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Someone is attempting to deploy a commit to a Personal Account owned by @awtkns on Vercel. @awtkns first needs to authorize it. |
Hi @nikstuckenbrock, thanks for this! Sorry about the slow feedback loop, it has been a busy couple months. Great work here! 🚀 A couple notes, by default name of the My one concern is that the |
Hi @awtkns, I tried my best but couldn't find a way to overwrite this in the router. There is an option using OpenAPI Extensions but this leads to two parameters in the specification ( def _get_one(self, *args: Any, **kwargs: Any) -> CALLABLE:
def route(**kwargs) -> SCHEMA:
for model in self.models:
if model.id == item_id: # type: ignore
return model
raise NOT_FOUND
return route This leads to a parameter A different approach could be to modify the specification by replacing the id values as mentioned here. But this would require that the CRUDRouter has access to the app = FastAPI("...")
CRUDRouter(app) Initialising the CRUDRouter this way there would be access to the app and the parameters could be overwritten. Hoping for feedback. Let me know what you think. Thanks in advance! |
As mentioned in #163 a feature request to customize the
item_id
parameter name in the OpenAPI specification was requested. I implemented it and added some extra tests and documentation for it.I would be very thankful if you would add the
HACKTOBERFEST-ACCEPTED
to this pull request.Hope this helps. Thanks in advance.