Skip to content

feat(web)!: remove output processors, encode Page as JSON by its type - #347

Open
mofr wants to merge 2 commits into
feat/interceptorsfrom
feat/output-processors
Open

mofr wants to merge 2 commits into
feat/interceptorsfrom
feat/output-processors

Conversation

@mofr

@mofr mofr commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #346.

What

  • An API method returns data, encoded as JSON, or a winter.web.Response. Output processors and their registry are gone: register_output_processor_resolver, IOutputProcessor, IOutputProcessorResolver, register_output_processor, winter.django.output_template.
  • A template is rendered by the API method: Response(HTTPStatus.OK, render_to_string('report.html', context).encode(), {'content-type': 'text/html'}).
  • Page is encoded by a JSON encoder registered for its type (winter/web/pagination/page_encoder.py). The fields a subclass adds still go to meta.
  • meta.previous and meta.next are dropped, together with winter.web.pagination.utils; the OpenAPI schema of Page loses them too.
  • winter.json.register_encoder is exported, so the encoder of one's own type is written the same way as Winter's encoder of Page.

Why

Page was Winter's only API output processor, and it needed the request only to build the previous and next links. Without the links, a Page is plain data, and everything Winter ships for the response body is built from public pieces. To be confirmed on the consumer: nobody, including clients of its public API, reads the links.

🤖 Generated with Claude Code

An API method returns data, encoded as JSON, or a winter.web.Response. The
output processors and their registry are gone: register_output_processor_resolver,
IOutputProcessor, IOutputProcessorResolver, register_output_processor and
winter.django.output_template. A template is rendered by the API method into a
Response.

Page was the only API processor of Winter, and it needed the request only for
the previous and next links of its meta. Those links are dropped, so Page is
encoded by a JSON encoder registered for its type, which anyone can write for
their own types: winter.json.register_encoder is exported for that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mofr
mofr requested a review from andrey-berenda October 26, 2026 19:46
…handler

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant