Skip to content

Feature: serve Swagger UI at /docs and raw spec at /spec.json #14

@roebi

Description

@roebi

Feature: serve Swagger UI at /docs and raw spec at /spec.json

Problem

Litestar's built-in /schema/swagger was disabled (it crashed with 500 on dynamically generated handlers). This left apiup without any API documentation UI.

Solution

Serve two additional built-in routes on every apiup instance:

Route Response
GET /spec.json Raw OpenAPI spec file (JSON)
GET /docs Swagger UI (CDN, points at /spec.json)

Swagger UI is loaded from cdn.jsdelivr.net/npm/swagger-ui-dist — no extra dependencies.

Banner update

⚡ apiup 0.5.0 — My API v1.0.0
   Listen: http://127.0.0.1:8080
   Docs  : http://127.0.0.1:8080/docs
   Spec  : http://127.0.0.1:8080/spec.json
   Routes: 7

Tested

  • GET /docs → 200 Swagger UI HTML ✓
  • GET /spec.json → 200 raw OpenAPI JSON ✓
  • All 7 mock routes still respond correctly ✓
  • DELETE with 204 still returns no body ✓

Labels

enhancement

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions