Documentation
¶
Overview ¶
Package things is an offline stand-in for a FastAPI-style REST API: an OpenAPI 3.1 document (Spec) and an in-memory server that answers it. The OpenAPI generator is designed and tested against the pair.
The server does what the spec says, and two things it doesn't, the way real servers drift from their specs:
- Undocumented filters: `name__icontains` and `description__icontains` on /things, `name__icontains` on /owners.
- Refused sorts: ThingOrder lists `status` and `-status`; asking for either answers 400 {"detail": "..."}.
Every route but the spec itself needs `Authorization: Bearer <Token>`.
Index ¶
Constants ¶
const Token = "fixture-token"
Token is the bearer token the server accepts.
Variables ¶
var EventEvery = time.Second
EventEvery is how often /events sends a frame.
var RefusedOrders = []string{"status", "-status"}
RefusedOrders are the ThingOrder values the server answers with a 400.
var Spec []byte
Spec is the OpenAPI document, as YAML.
var Statuses = []string{"active", "pending", "failed", "archived"}
Statuses are ThingStatus's values, in the spec's order.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the stub. Each New starts from the same seed, so tests can rely on ids and counts; writes change only that Server.