Comments (6)
Yeah. I think we should do this for all injected things.
E.g.
async def handler(
param: Query[str],
request_body: Body[list[str]],
header: Header[int],
):
...
IMO this belongs to the DI redesign and is something I'd definitely want to address as part of that.
from litestar.
I've guessing this should also apply to other reserved parameters such as state
and query
?
from litestar.
Agree - it would be great to be more flexible in this respect!
from litestar.
Just want to highlight how nice it would be to split Parameter
into more specific types, ie. Body
, Query
, Header
, Cookie
, Path
(?). Current mechanism of having to thing: Annotated[int, Parameter(header="thing")]
vs thing: Annotated[int, Header()])
feels a bit bloated.
Also discussed in #3223 (comment) & #3223 (comment). FYI.
from litestar.
@tuukkamustonen That's already in the current proposal, see #3053 (comment)
from litestar.
Yeah, just wanted to highlight how nice it would be to have those types. The topic of the ticket is "allow ... parameter to have an arbitrary name" (and not add Query
, Body
, etc convenience wrappers for shorter field name syntax...) after all.
But yeah, good that you have it scoped like that 👍🏻
from litestar.
Related Issues (20)
- Docs: Add common recipes/FAQ section HOT 1
- Bug: Litestar instance or factory not found HOT 1
- Enhancement: allow finer tuning `LoggingConfig` for exception logging HOT 1
- Bug: SQLAlchemy models with default=func.now() error with Unexpected default type HOT 5
- Bug: [OpenAPI] Upload file is not possible when defined as Optional HOT 2
- Bug: Using plugin results in DTO given to dto parameter not being used for return HOT 2
- CI: Fix devcontainer config HOT 1
- DTO backend does not transferring mappings with nested models HOT 10
- Bug: SerializationException when running modeling-and-features demo from docs HOT 3
- Bug: Can't convert sqlalchemy model to pydantic model which is inherited from BaseModel HOT 1
- Enhancement: Add Pydantic's error dictionary to ValidationException's extra dict
- Enhancement: make `SessionMiddleware` return custom types HOT 3
- Bug: OpenAPI docs fail to generate with certain validators and pydantic v1 HOT 4
- Bug: Multi-body response incompatible with LoggingMiddleware HOT 3
- Bug: test failures
- Bug: `return_dto` is silently ignored if return data type does not match DTO definition HOT 1
- Bug: Test error
- Enhancement: add `default_json_serializer` to `__all__` in `litestar.logging.config`
- Docs: Migrating to Litestar from Django HOT 1
- Decoupled, transactional communication of domain events and commands
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from litestar.