mirror of
https://github.com/samuelcolvin/FastUI.git
synced 2023-12-01 22:22:11 +03:00
17 lines
336 B
Python
17 lines
336 B
Python
from typing import Annotated, Literal
|
|
from pydantic import Field, BaseModel
|
|
|
|
|
|
class PageEvent(BaseModel):
|
|
type: Literal['page'] = 'page'
|
|
name: str
|
|
|
|
|
|
class GoToEvent(BaseModel):
|
|
type: Literal['go-to'] = 'go-to'
|
|
# can be a path or a URL
|
|
url: str
|
|
|
|
|
|
Event = Annotated[PageEvent | GoToEvent, Field(discriminator='type')]
|