Skip to content

Streaming Event type, type hint, should support union type #607

@skrawcz

Description

@skrawcz

Current behavior

When it's a union type it complains:

union = MyModel1 | MyModel2

@streaming_action.pydantic(
    reads=[...],
    writes=[...],
    state_input_type=..., 
    state_output_type=...
    stream_type=union, # type hint says this is invalid
)

because it is typed with :

stream_type: Union[Type["BaseModel"], Type[dict]],

Library & System Information

Latest burr

Expected behavior

It should be fine.

Additional context

The fix I think is to expand that stream type to handle a union of BaseModel types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions