some more documentation in the API and in the API code

This commit is contained in:
Laura Klünder 2023-11-19 00:12:10 +01:00
parent f96e916184
commit 0f43274e33
8 changed files with 126 additions and 24 deletions

View file

@ -77,7 +77,11 @@ class LocationSchema(AccessRestrictionSchema, TitledSchema, LocationSlugSchema,
# todo: add_search
class LabelSettingsSchema(TitledSchema, Schema):
class LabelSettingsSchema(TitledSchema, DjangoModelSchema):
"""
Settings preset for how and when to display a label. Reusable between objects.
The title describes the title of this preset, not the displayed label.
"""
min_zoom: float = APIField(
title="min zoom",
)

View file

@ -1,6 +1,6 @@
from typing import Optional
from ninja import Schema
from ninja import Schema, Swagger
from pydantic import Field as APIField
from pydantic import PositiveFloat, PositiveInt
@ -9,6 +9,11 @@ from c3nav.mapdata.schemas.model_base import SpecificLocationSchema
class LevelSchema(SpecificLocationSchema):
"""
A physical level of the map, containing building, spaces, doors
A level is a specific location, and can therefor be routed to and from, as well as belong to location groups.
"""
short_label: NonEmptyStr = APIField(
title="short label (for level selector)",
description="unique among levels",

View file

@ -3,4 +3,10 @@ from pydantic import Field as APIField
class BoundsSchema(Schema):
bounds: tuple[tuple[float, float], tuple[float, float]] = APIField(..., example=((-10, -20), (20, 30)))
"""
Describing a bounding box
"""
bounds: tuple[tuple[float, float], tuple[float, float]] = APIField(
description="(x, y) to (x, y)",
example=((-10, -20), (20, 30)),
)