-
Notifications
You must be signed in to change notification settings - Fork 0
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
DM-44230: Add Slack error reporting #5
Conversation
25f29ae
to
ee2204e
Compare
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.
Overall, looks great. Thank you for adding this! Just a few minor points about wording and maybe a more complex dependency problem.
The `POST /fastapi-bootcamp/error-demo` endpoint specifically raises these errors for demonstration.
It's not really needed here.
48f71ca
to
8bcee83
Compare
@rra Thanks for all the suggestions. I also ended up using that pagination dependency on the endpoint for getting a collection of observers, |
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.
This looks great. Thank you! I only noticed a couple of minor things that may have been intentional.
page : int, optional | ||
The page number, by default 1. | ||
limit : int, optional | ||
The number of items to return per page, by default 10. | ||
order : SortOrder, optional |
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.
Minor nit: I think the type information in the docstring can be dropped.
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.
Oops, I was going fast and Copilot auto-filled this 😓
src/fastapibootcamp/domain/models.py
Outdated
@@ -10,7 +10,9 @@ | |||
from astropy.coordinates import AltAz, Angle, SkyCoord | |||
from astropy.time import Time | |||
|
|||
__all__ = ["Observer", "TargetObservability"] | |||
from fastapibootcamp.dependencies.pagination import Pagination |
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.
Minor nit: Do you want to use a relative import here? I usually do and it looked like you were elsewhere, although I didn't know if there was a reason to avoid it here.
This lesson explores custom FastAPI dependencies. We cover the two styles. For a functional dependency, we're adding a pagination dependency that adds query strings parameters for a user to control pagination. For a class-based singleton dependency, we have a simple example that initializes a semi-random string to show how that value is persistent across requests.
This doesn't actually compatible with mypy/FastAPI yet.
This uses the same Pagination dependency we developed for the initial lessons.
Rather than breaking out the Pagination in the service and storage layer requests, we'll continue to pass it through. This slightly breaks the rules because now the same model is used both internally and for the API, but it is a pragmatic judgment call.
8bcee83
to
b638abb
Compare
The
POST /fastapi-bootcamp/error-demo
endpoint specifically raises these errors for demonstration.I also added a
GET /fastapi-bootcamp/dependency-demo
endpoint that explores writing custom dependencies. I'm not sure of the terminology, but I'm calling one type "functional dependencies" and the other "class-based" dependencies / "stateful" dependencies. Suggestions are welcome on this terminology!