slimmer and more correct routing item schema
This commit is contained in:
parent
4536390eba
commit
c25b12c1c0
1 changed files with 15 additions and 4 deletions
|
@ -127,6 +127,18 @@ class ShortWayTypeSchema(DjangoModelSchema):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class ShortSpaceSchema(DjangoModelSchema):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class RouteLevelSchema(DjangoModelSchema):
|
||||||
|
on_top_of: Union[
|
||||||
|
Annotated[PositiveInt, APIField(title="level ID", description="level this level is on top of", example=1)],
|
||||||
|
Annotated[None, APIField(title="null", description="this is a main level, not on top of any other")]
|
||||||
|
] = APIField(
|
||||||
|
title="on top of level ID",
|
||||||
|
description="if set, this is not a main level, but it's on top of this other level"
|
||||||
|
)
|
||||||
|
|
||||||
class RouteItemSchema(BaseSchema):
|
class RouteItemSchema(BaseSchema):
|
||||||
id: PositiveInt
|
id: PositiveInt
|
||||||
coordinates: Coordinates3D
|
coordinates: Coordinates3D
|
||||||
|
@ -136,14 +148,14 @@ class RouteItemSchema(BaseSchema):
|
||||||
] = APIField(None, title="waytype")
|
] = APIField(None, title="waytype")
|
||||||
space: Union[
|
space: Union[
|
||||||
Annotated[
|
Annotated[
|
||||||
SlimSpaceLocationSchema,
|
ShortSpaceSchema,
|
||||||
APIField(title="space", descripiton="new space that is being entered")
|
APIField(title="space", descripiton="new space that is being entered")
|
||||||
],
|
],
|
||||||
Annotated[None, APIField(title="null", description="staying in the same space")],
|
Annotated[None, APIField(title="null", description="staying in the same space")],
|
||||||
] = APIField(None, description="new space being entered")
|
] = APIField(None, description="new space being entered")
|
||||||
level: Union[
|
level: Union[
|
||||||
Annotated[
|
Annotated[
|
||||||
SlimLevelLocationSchema,
|
RouteLevelSchema,
|
||||||
APIField(title="level", descripiton="new level that is being entered")
|
APIField(title="level", descripiton="new level that is being entered")
|
||||||
],
|
],
|
||||||
Annotated[None, APIField(title="null", description="staying in the same level")],
|
Annotated[None, APIField(title="null", description="staying in the same level")],
|
||||||
|
@ -151,7 +163,7 @@ class RouteItemSchema(BaseSchema):
|
||||||
descriptions: list[tuple[
|
descriptions: list[tuple[
|
||||||
Annotated[NonEmptyStr, APIField(
|
Annotated[NonEmptyStr, APIField(
|
||||||
title="icon name",
|
title="icon name",
|
||||||
description="any material design icon name"
|
description="any material design icon name or svg icon file name"
|
||||||
)],
|
)],
|
||||||
Annotated[NonEmptyStr, APIField(
|
Annotated[NonEmptyStr, APIField(
|
||||||
title="instruction",
|
title="instruction",
|
||||||
|
@ -159,7 +171,6 @@ class RouteItemSchema(BaseSchema):
|
||||||
)]
|
)]
|
||||||
]]
|
]]
|
||||||
|
|
||||||
|
|
||||||
class RouteSchema(BaseSchema):
|
class RouteSchema(BaseSchema):
|
||||||
origin: SlimLocationSchema # todo: is this fine? works? no issues?
|
origin: SlimLocationSchema # todo: is this fine? works? no issues?
|
||||||
destination: SlimLocationSchema # todo: is this fine? works? no issues?
|
destination: SlimLocationSchema # todo: is this fine? works? no issues?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue