Add type hints and keyword-only arguments for djblets.webapi.responses.
Review Request #12724 — Created Nov. 14, 2022 and submitted — Latest diff uploaded
WebAPIResponseFormError) are core to our API code. These convert
internal structured API response data to payloads for the client.
Although this code rarely needs to change, much of this code is very
old, in need of some love, and in need of unit testing.
To assist in some in-progress work on the API and code using the API,
this change adds type hints to this code, and changes constructors to
require keyword-only arguments (with deprecated compatibility with
In the process, the documentation for these classes have been fleshed
This did uncover some flaws in
methods would crash if
None, or when passing
the constructor. Both have been fixed.
Some unit tests have been added for construction, but many tests are
All unit tests pass.
No issues reported by mypy or pyright.