Skip to content

Tech debt: Consolidate parameter class constructors #8118

@leandrodamascena

Description

@leandrodamascena

Why is this needed?

Path, Query, Header, Cookie all inherit from Param but each one copies the entire __init__ with 25+ parameters. The __init__ can live only in Param. Subclasses just set in_ and override specific behavior (e.g. Header has convert_underscores).

Same story for Body/Form/File.

Steps:

  1. Move the full __init__ to Param base class
  2. Subclasses override only what differs (default value, alias behavior)
  3. Keep class names and import paths identical
  4. Verify Pydantic FieldInfo compatibility

Which area does this relate to?

Event Handler - REST API

Suggestion

No response

Acknowledgment

Metadata

Metadata

Labels

pending-releaseFix or implementation already in dev waiting to be releasedtech-debtTechnical Debt tasks

Projects

Status

Coming soon

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions