ThyTran1402 commented on code in PR #813:
URL: https://github.com/apache/burr/pull/813#discussion_r3568067595
##########
burr/core/action.py:
##########
@@ -1507,15 +1507,15 @@ def pydantic(
writes: List[str],
state_input_type: Type["BaseModel"],
state_output_type: Type["BaseModel"],
- stream_type: Union[Type["BaseModel"], Type[dict]],
+ stream_type: Union[Type["BaseModel"], Type[dict], object],
Review Comment:
Yes. A `typing.Union[...]` value has no precise static type that mypy
evaluates the expression as object, so any narrower hint would produce false
positives for the exact use case this PR enables and we support 3.9, where pipe
syntax isn't available. This is the same pattern FastAPI uses for
`response_model:` `Any`. The real constraint is enforced at decoration time by
`_is_valid_stream_type,` and the rejection behavior is now pinned by
negative-path tests (per your other comment). I've named the type of alias and
documented the tradeoff at the definition site, so it reads as deliberate.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]