Skip to content

Complete OpenAPI/Swagger documentation #138

Description

@karutoil

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

  • All 100+ REST endpoints have complete request/response schemas in the OpenAPI spec
  • Shared component schemas for all major models
  • Authentication requirements documented per endpoint
  • /docs UI shows complete, navigable API reference
  • OpenAPI spec validates against the 3.0.x spec (no schema errors)
  • Spec downloadable at /docs/json for external tooling consumption

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:backendBackend / API workdocumentationImprovements or additions to documentationenhancementNew feature or requestin-progressCurrently being worked on

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions