You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Release v0.3.2: compose multiple FastPayloads in one Response
FastJSONRenderer now handles dict responses whose values mix FastPayload
markers with arbitrary Python. Each FastPayload encodes via pydantic-core
(Rust), each plain value via DRF's stock JSONEncoder. Walks data in
insertion order so output key order matches input. Keys are escaped
via json.dumps so quotes and backslashes in user-supplied keys still
produce valid JSON.
Unblocks bundle-style endpoints (e.g. a single worksheet response
returning header + transactions + balances + summary, four separate
FastSerializer schemas) without manual byte splicing, slot-level
access to FastPayload internals, or model_dump mode juggling that
loses the Rust render path entirely.
Pagination envelopes flow through the same composed path; the dedicated
_render_paginated helper is gone, behavior is unchanged, regression
test added.
Indented output (indent= in renderer_context, or non-compact JSON
setting) falls back to materializing every FastPayload and routing
through super().render() since pydantic-core's dump_json is compact-only
and join bytes wouldn't have indentation structure. Debug-mode only;
hot paths stay on the fast path.
Known limit: only top-level dict values are inspected. A FastPayload
nested inside a list or sub-dict still falls through to stock and
raises. Lift the inner payload up a level, or encode manually.
0 commit comments