-
Notifications
You must be signed in to change notification settings - Fork 8
Description
The DatetimeInterval Pydantic Model is rendered as an array<[string, string], any> in the generated SwaggerUI docs when using this type in stapi-fastapi
See its usage, pulled in via OrderPayload:
from stapi_pydantic import (
OpportunityProperties,
Order,
OrderPayload,
OrderStatusCode,
Queryables,
)
from app.repositories import STAPIRepository
from app.schemas.stapi import OrderParameters as BaseOrderParameters
async def create_order(
product_router: ProductRouter, payload: OrderPayload, request: Request
) -> ResultE[Order]:create_order is then used in a Product and added via router.add_product(umbra.product)
On the SwaggerUI docs:
Which alludes to:
"datetime": ["2025-01-01T00:00:00Z", "2025-12-31T23:59:59Z"]
When actually it should be:
"datetime": "2025-01-01T00:00:00Z/2025-12-31T23:59:59Z"
Looks like Swagger is picking up the tuple[AwareDatetime, AwareDatetime], first, which isn't actually the expected input.
My guess is the tests give some false hope here: https://github.com/stapi-spec/pystapi/blob/main/stapi-fastapi/tests/test_order.py#L49-L61
as they're using the model to pass to the endpoint, which will have the serialisation performed.
