Skip to content
This repository was archived by the owner on Apr 2, 2025. It is now read-only.

Commit 8f6511c

Browse files
committed
fix: add args/kwargs support in RootRouter.add_product to configure ProductRouter
1 parent df2e78f commit 8f6511c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1313
- Endpoint `/orders/{order_id}/statuses` supporting `GET` for retrieving statuses. The entity returned by this conforms
1414
to the change proposed in [stapi-spec#239](https://github.com/stapi-spec/stapi-spec/pull/239).
1515
- RootBackend has new methods `get_order_statuses` and `set_order_status`
16+
- `*args`/`**kwargs` support in RootRouter's `add_product` allows to configure underlyinging ProductRouter
1617

1718
### Changed
1819

src/stapi_fastapi/routers/root_router.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,9 @@ async def get_order_statuses(
235235
case _:
236236
raise AssertionError("Expected code to be unreachable")
237237

238-
def add_product(self: Self, product: Product) -> None:
238+
def add_product(self: Self, product: Product, *args, **kwargs) -> None:
239239
# Give the include a prefix from the product router
240-
product_router = ProductRouter(product, self)
240+
product_router = ProductRouter(product, self, *args, **kwargs)
241241
self.include_router(product_router, prefix=f"/products/{product.id}")
242242
self.product_routers[product.id] = product_router
243243

0 commit comments

Comments
 (0)