-
Notifications
You must be signed in to change notification settings - Fork 608
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
move managers #1328
move managers #1328
Conversation
src/evidently/ui/api/projects.py
Outdated
project: Annotated[Project, Dependency()], | ||
# snapshot_id: Annotated[SnapshotID, Parameter(title="id of snapshot")], | ||
): | ||
snapshot_id = request.path_params["snapshot_id"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should have access to snapshot_id from request parameters as in route_handler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path parameters are not passed to dependencies of route_handler, I tried to do this initially
snapshot_id: Annotated[SnapshotID, Parameter(title="id of snapshot")], | ||
project_manager: Annotated[ProjectManager, Dependency(skip_validation=True)], | ||
log_event: Callable, | ||
user_id: UserID, | ||
) -> None: | ||
await project_manager.delete_snapshot(user_id, project_id, snapshot_id) | ||
await project_manager.delete_snapshot(user_id, project.id, snapshot_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are retrieving whole project from dependency to only use project_id (that available from request itself).
This would create unnecessary calls (in comparison to original version).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also validates if project exists and that you have access to it. Thats why I did it like this, before we didn't have those checks
# Conflicts: # src/evidently/ui/base.py
# Conflicts: # src/evidently/ui/base.py
No description provided.