Summary
fastify-swagger and fastify-swagger-ui are already registered in the backend (/docs endpoint), but route schemas are incomplete. Many endpoints lack proper request/response schemas, making the auto-generated OpenAPI spec incomplete.
Current State
@fastify/swagger configured in src/index.ts with basic OpenAPI 3.0 metadata
@fastify/swagger-ui serves interactive docs at /docs
- Input validation uses Zod schemas (
src/lib/validation.ts) but these aren't consistently wired into Fastify route schema definitions
- Some routes define
schema in their route options, many don't
- The spec currently shows endpoints but with generic/empty response models
Requirements
- Add complete
schema objects to all route definitions (100+ endpoints across auth, servers, nodes, templates, backups, alerts, roles, admin, etc.)
- Define shared schema components:
User, Server, Node, Backup, Error, Pagination, etc.
- Map Zod schemas to JSON Schema (already using
zod-to-json-schema as a dependency)
- Include authentication requirements per endpoint (session, API key, public)
- Document WebSocket protocol message types (not REST, but reference from OpenAPI
x-websocket extension)
- Document SSE endpoints with appropriate streaming response schemas
Acceptance Criteria
Summary
fastify-swaggerandfastify-swagger-uiare already registered in the backend (/docsendpoint), but route schemas are incomplete. Many endpoints lack proper request/response schemas, making the auto-generated OpenAPI spec incomplete.Current State
@fastify/swaggerconfigured insrc/index.tswith basic OpenAPI 3.0 metadata@fastify/swagger-uiserves interactive docs at/docssrc/lib/validation.ts) but these aren't consistently wired into Fastify route schema definitionsschemain their route options, many don'tRequirements
schemaobjects to all route definitions (100+ endpoints across auth, servers, nodes, templates, backups, alerts, roles, admin, etc.)User,Server,Node,Backup,Error,Pagination, etc.zod-to-json-schemaas a dependency)x-websocketextension)Acceptance Criteria
/docsUI shows complete, navigable API reference/docs/jsonfor external tooling consumption