Skip to content

feat!: decorators name what they declare, json_encoder and url_regexp - #352

Open
mofr wants to merge 2 commits into
feat/openapifrom
feat/decorator-names
Open

mofr wants to merge 2 commits into
feat/openapifrom
feat/decorator-names

Conversation

@mofr

@mofr mofr commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #351.

What

  • @winter.json.register_encoder is @winter.json.json_encoder, the counterpart of the existing @winter.json.json_decoder. The name encoder would have shadowed the module winter/json/encoder.py.
  • @winter.web.register_url_regexp is @winter.web.url_regexp.
  • Both get a docstring; both apply to subclasses of the type, since the lookup walks the MRO.
  • The error for a second encoder of a type says "T" already has a JSON encoder instead of pointing to an unregister function that does not exist.

Why

Decorators in Winter name what a thing is (@route_get, @problem, @global_exception, @json_decoder, @type_inspector since #351); register_… named the mechanism, a global registry, for what is metadata about a type.

🤖 Generated with Claude Code

@winter.json.register_encoder is @winter.json.json_encoder, like
@winter.json.json_decoder, and @winter.web.register_url_regexp is
@winter.web.url_regexp. The error for a second encoder of a type no longer
refers to an unregister function that does not exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mofr
mofr requested a review from andrey-berenda October 27, 2026 16:16
…ository

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