Add stubs for API resources and implement root stubs for existing subclasses.
Review Request #14257 — Created Dec. 4, 2024 and submitted
This change adds a new
@api_stub
decorator that we can use to define
stubs within resource implementations. These stubs provide type hints
and documentation for any methods which will be dynamically generated.We have only a subset of subclasses for resources. For the ones we do
currently have, this adds stubs to the root resource for the methods
that are automatically generated from URI-templates. With this, if one's
editor is so configured, a developer can write
api_root.get_review_request(
and the editor will auto-complete the
review_request_id
parameter and indicate that the resulting value is a
ReviewRequestItemResource
.
- Ran unit tests.
- Verified that stub methods were correctly replaced, and that doing
things likehelp(api_root.get_review_request)
showed the correct
documentation and annotations.
Summary | ID |
---|---|
a0fae2d0e384e6ac5209aaebc2380a504cdde153 |
Description | From | Last Updated | ||
---|---|---|---|---|
Where are the function definitions for is_api_stub() and replace_api_stub()? |
![]() |
|||
I think there's an extra space before the ending apostrophe? |
![]() |
|||
Missing Returns. |
|
|||
This and the other new methods and globls are missing Version Added. |
|
|||
There are no open issues |
- Commits:
-
Summary ID ef110b6cafd99df95b5a1e76c378ab2f7debad28 ba14a7a69e50537935904a89b0b564dea9cb337b - Diff:
-
Revision 2 (+1692 -14)
Checks run (2 succeeded)
- Commits:
-
Summary ID ba14a7a69e50537935904a89b0b564dea9cb337b 16674105b3a07d6849337ee283113bbbedb61be6 - Diff:
-
Revision 3 (+1728 -14)
Checks run (1 timed out)
- Commits:
-
Summary ID 16674105b3a07d6849337ee283113bbbedb61be6 a0fae2d0e384e6ac5209aaebc2380a504cdde153 - Diff:
-
Revision 4 (+1728 -14)