Add typing for serializable JSON values.
Review Request #13253 — Created Sept. 3, 2023 and submitted
Djblets 3.3 gained standard types for standard JSON values, which is
great when deserializing. However, when preparing data to be serialized
to JSON, we often need to work with datetimes, lazy strings, UUIDs, and
objects that can be serialized to JSON.
To address this, we now have a new "serializable" set of JSON types,
which support all the values that
classes) support. This includes,
Decimalvalues, along with
functions containing a
DjbletsJSONEncoderhas been updated to include the typing support as
well, primarily for consistency and to help test the types. It also
drops explicit support for
Promise(lazy strings), since Django's
encoder supports that internally these days.
Also of note, this does not contain typing used by the WebAPI resource
support. These types only work with this encoder and not the resource
Unit tests pass in Djblets and Review Board.
Made use of these new types in some in-progress code.