Skip to content

Commit 9e86872

Browse files
authored
fix: πŸ“ Small error in the documentation
1 parent 88bf3fc commit 9e86872

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

β€Ždocumentation/fastapi-example.mdβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ The advantage of `python-cq` is that it can be easily integrated into FastAPI.
55
Here's an example of its integration:
66

77
```python
8-
import msgspec
98
from cq import CommandBus, command_handler, new_command_bus
109
from fastapi import FastAPI, status
1110
from injection import injectable, singleton
1211
from injection.integrations.fastapi import Inject
12+
from pydantic import BaseModel
1313

1414
# ----- Service Definition -----
1515

@@ -24,9 +24,9 @@ def override_command_bus_recipe() -> CommandBus:
2424

2525
# ----- Command Definition -----
2626

27-
class ExampleCommand(msgspec.Struct, frozen=True): ...
27+
class ExampleCommand(BaseModel): ...
2828

29-
class ExampleReturnType(msgspec.Struct, frozen=True): ...
29+
class ExampleReturnType: ...
3030

3131
@command_handler(ExampleCommand)
3232
class ExampleHandler:

β€Žpyproject.tomlβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ dev = [
1111
example = [
1212
"fastapi",
1313
"msgspec",
14+
"pydantic",
1415
]
1516
test = [
1617
"pytest",

β€Žuv.lockβ€Ž

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
Β (0)