Add typing and missing documentation to review request fields.
Review Request #14300 — Created Jan. 24, 2025 and updated
The review request fields codebase is pretty crucial to Review Board,
and one of the primary extension interfaces that companies tend to
use and specialize.In an effort to modernize fields and help reason about them in other
code that needs to interact with them, this change adds typing
throughout the fields codebases.Fields are now generics, storing the type of data that can be
represented when loading and saving values.All rendering functions now have return types of
SafeString
.The base functions rendering or serializing change description state
work withAny
as the type. This is because, while we have a
somewhat-standard format most fields use to record state in
ChangeDescription.fields_changed
, this is entirely at the whim of the
implementation. As such, it's up to the field class to narrow the type
as needed and perform any checks and parsing required.
All unit tests passed.
Tested all the field types on a review request, and a wide variety of
change description renderings.
Summary | ID |
---|---|
03186ee8fef188fc54d74ee130fb1a55ac448dfb |
Description | From | Last Updated |
---|---|---|
Could say the User type here instead of object. And now that we've switched to importing from reviewboard.accounts.models.User, is that … |
![]() |
|
Group instead of object. |
![]() |
|
User instead of object. |
![]() |
|
You missed a super() here. |
|
|
Forgot to add the type here. |
![]() |
|
And here. |
![]() |
|
Missing types on some of the attributes here. |
![]() |