Skip to content

Feature request: alias generator for Query, Path or Header #7039

@tonnico

Description

@tonnico

Use case

In a BaseModel you can setup an alias_generator.

It would be release nice to have something configurable for e.g. Query

Solution/User Experience

Think about this:

@app.get("/")
def list_something(max_results: Annotated[int, Query(alias="maxResults")]) -> Response[str]:
    ...

could become something like this:

class CamelCaseQuery(Query):
    field_config = {"alias_generator": alias_generators.to_camel}

@app.get("/")
def list_something(max_results: Annotated[int, CamelCaseQuery()]) -> Response[str]:
    ...

Alternative solutions

Acknowledgment

Metadata

Metadata

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions