New Functionalities
Now, Context
provides access to inner dict keys too:
# headers is a `dict`
async def handler(
user_id: int = Context("message.headers.user_id", cast=True),
): ...
Added Header
object as a shortcut to Context("message.headers.")
inner fields (NATS example):
# the same with the previous example
async def handler(
user_id: int = Header(),
u_id: int = Header("user_id"), # with custom name
): ...
Added Path
object to get access to NATS wildcard subject or RabbitMQ topic routing key (a shortcut to access Context("message.path.")
as well):
@nats_broker.subscriber("logs.{level}")
async def handler(
level: str = Path(),
)
Also, the original message Context
annotation was copied from faststream.[broker].annotations.[Broker]Message
to faststream.[broker].[Broker]Message
to provide you with faster access to the most commonly used object (NATS example).
What's Changed
- Remove faststream_gen docs and remove code to generate fastream_gen docs by @kumaranvpl in #824
- Update docs article to use cookiecutter template by @kumaranvpl in #828
- Split real broker tests to independant runs by @Lancetnik in #825
- Remove unused docs/docs_src/kafka examples and its tests by @kumaranvpl in #829
- Run docs deployment only for specific file changes by @kumaranvpl in #830
- Fix formatting in deploy docs workflow by @kumaranvpl in #833
- Path operations by @Lancetnik in #823
- Mypy error fixed for uvloop by @davorrunje in #839
Full Changelog: 0.2.3...0.2.4