Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/dev/decisions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
4. Focus on maximum type safety:
- No need for `# type: ignore`
- No need for `typing.cast`
5. No adding new features while tasks can be solved by default implementation.
5. No adding new features while tasks can be solved by current implementation.
9 changes: 6 additions & 3 deletions docs/integrations/fastapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ async def websocket_endpoint(
) -> None:
request_container = session_container.build_child_container(scope=modern_di.Scope.REQUEST)
# REQUEST scope is entered here
# You can resolve dependencies here
pass
try:
# You can resolve dependencies here
finally:
await request_container.close_async()

await websocket.accept()
await websocket.send_text("test")
Expand All @@ -109,7 +111,8 @@ async def websocket_endpoint(

## Framework Context Objects

Framework-specific context objects like `fastapi.Request` and `fastapi.WebSocket` are automatically made available by the integration. You can reference these context providers in your factories either implicitly through type annotations or explicitly by importing them.
Framework-specific context objects like `fastapi.Request` and `fastapi.WebSocket` are automatically made available by the integration.
You can reference these context providers in your factories either implicitly through type annotations or explicitly by importing them.

The following context providers are available for import:
- `fastapi_request_provider` - Provides the current `fastapi.Request` object
Expand Down
3 changes: 2 additions & 1 deletion docs/integrations/faststream.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ async def read_root(

## Framework Context Objects

Framework-specific context objects like `faststream.StreamMessage` are automatically made available by the integration. You can reference these context providers in your factories either implicitly through type annotations or explicitly by importing them.
Framework-specific context objects like `faststream.StreamMessage` are automatically made available by the integration.
You can reference these context providers in your factories either implicitly through type annotations or explicitly by importing them.

The following context provider is available for import:
- `faststream_message_provider` - Provides the current `faststream.StreamMessage` object
Expand Down
9 changes: 6 additions & 3 deletions docs/integrations/litestar.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,18 @@ async def websocket_handler(
) -> None:
request_container = di_container.build_child_container(scope=Scope.REQUEST)
# REQUEST scope is entered here
# You can resolve dependencies here
pass
try:
# You can resolve dependencies here
finally:
await request_container.close_async()

app.register(websocket_handler)
```

## Framework Context Objects

Framework-specific context objects like `litestar.Request` and `litestar.WebSocket` are automatically made available by the integration. You can reference these context providers in your factories either implicitly through type annotations or explicitly by importing them.
Framework-specific context objects like `litestar.Request` and `litestar.WebSocket` are automatically made available by the integration.
You can reference these context providers in your factories either implicitly through type annotations or explicitly by importing them.

The following context providers are available for import:
- `litestar_request_provider` - Provides the current `litestar.Request` object
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ nav:
- Migration:
- To 1.x: migration/to-1.x.md
- To 2.x: migration/to-2.x.md
- From that-depends: migration/from-that-depends.md
- Development:
- Contributing: dev/contributing.md
- Decisions: dev/decisions.md
Expand Down