Add stubs for API resources and implement root stubs for existing subclasses.
Review Request #14257 — Created Dec. 4, 2024 and updated — Latest diff uploaded
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.