Skip to content

[Refactor/Chore] Add console namespace helpers for schema decorators #43835

Open

Description

@copiumnicus

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for refactors or chores; if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Description

The console controllers spell out two decorators by hand: @console_ns.expect(console_ns.models[Payload.__name__]) at 279 sites and @console_ns.doc(params=query_params_from_model(Query)) at 126 sites. Proposal: give console_ns a small Namespace subclass with expect_model(Payload) and doc_query(Query) helpers that do the same lookup and call at import time.

Motivation

Each decorator becomes one short call, and the 49 controller files that import query_params_from_model only for these decorators no longer need it. Behavior stays the same: an unregistered model still raises KeyError, and the generated OpenAPI specs do not change.

Additional Context

No response

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    review: mediumghfind author score; see https://ghfind.com

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions