Skip to content

VEMO Yard Interface

  • Purpose: expose yard state so depot operators and downstream systems can read and update parking space occupancy and vehicle context.
  • Scope: aligns to docs/yard-state-openapi.yaml with GET/PATCH endpoints under /yard-state/{depotId} for listing spaces, applying bulk updates, and fetching/updating a single space.
  • Transport: FastAPI validates payloads, maps domain errors to Error responses, and delegates to the yard state handler to keep HTTP thin.
  • Auth: authentication and authorization are handled by upstream infrastructure (gateway or mesh); the service expects authenticated traffic.

How it works

  • Clients call the Yard State endpoints to read or mutate space state for a depot.
  • The router injects a YardStateHandler implementation that owns data access (in-memory for tests; persistent handler can be wired in production).
  • The handler performs depot/space lookups, merges updates, and raises domain errors that the router translates into 404s for missing depots or spaces.
  • Payloads conform to the OpenAPI schema; observed_at carries timestamps for state freshness.

Request flow

sequenceDiagram
    participant Client
    participant API as Yard State API
    participant Handler as YardStateHandler
    Client->>API: HTTP GET or PATCH /yard-state/{depotId}[/{spaceId}]
    API->>Handler: list_spaces | apply_bulk_updates | get_space | update_space
    Handler-->>API: Space or [Space]
    API-->>Client: 200 response or domain 404 error

References

  • OpenAPI contract: docs/yard-state-openapi.yaml
  • Architecture overview: architecture.md