working samples

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2023-11-29 10:32:31 -08:00
parent 9f8069decb
commit ed36086040
37 changed files with 962 additions and 856 deletions

View File

@ -1,13 +1,14 @@
from typing import Union
from typing import Literal, Union
from pydantic import BaseModel, RootModel
from pydantic import BaseModel, Field, RootModel
from typing_extensions import Annotated
class default_scene(BaseModel):
"""Visit the default scene."""
type: str = "default_scene"
type: Literal["default_scene"] = "default_scene"
class scene_by_index(BaseModel):
@ -15,7 +16,7 @@ class scene_by_index(BaseModel):
index: int
type: str = "scene_by_index"
type: Literal["scene_by_index"] = "scene_by_index"
class scene_by_name(BaseModel):
@ -23,7 +24,7 @@ class scene_by_name(BaseModel):
name: str
type: str = "scene_by_name"
type: Literal["scene_by_name"] = "scene_by_name"
class mesh_by_index(BaseModel):
@ -31,7 +32,7 @@ class mesh_by_index(BaseModel):
index: int
type: str = "mesh_by_index"
type: Literal["mesh_by_index"] = "mesh_by_index"
class mesh_by_name(BaseModel):
@ -39,15 +40,18 @@ class mesh_by_name(BaseModel):
name: str
type: str = "mesh_by_name"
type: Literal["mesh_by_name"] = "mesh_by_name"
Selection = RootModel[
Union[
default_scene,
scene_by_index,
scene_by_name,
mesh_by_index,
mesh_by_name,
Annotated[
Union[
default_scene,
scene_by_index,
scene_by_name,
mesh_by_index,
mesh_by_name,
],
Field(discriminator="type"),
]
]