v1.0.2 Stable Release

Swagger UI
for Serverpod

Automatically generate OpenAPI 3.0 specs from your Serverpod endpoints and serve interactive API documentation with a single line of code.

Quick Start

Up and running in 3 steps.

1

Add the dependency

pubspec.yaml
dependencies:
  serverpod: ">=3.4.2 <4.0.0"
  serverpod_swagger: ^1.0.0
2

Register the route & generate

server.dart
import 'dart:io';
import 'package:serverpod_swagger/serverpod_swagger.dart';

// In your server setup:
pod.webServer.addRoute(
  SwaggerUIRoute(Directory.current),
  '/swagger/**',
);
3

Generate & visit

dart run serverpod_swagger:generate --base-url=http://localhost:8080

Then visit http://localhost:8082/swagger/

Smart HTTP Method Detection

HTTP methods are automatically inferred from your endpoint method names.

GET

get, list, find, fetch, search, count, check

POST

create, add, insert, save, login, send

PATCH

update, modify, edit, change, rename

DELETE

delete, remove, destroy, clear, revoke

Unrecognized method names default to POST, matching Serverpod's RPC-style architecture.

Features

Everything you need for API documentation.

Auto Generation

Parses your Serverpod endpoints and models to produce a complete OpenAPI 3.0 specification automatically.

Smart HTTP Methods

Infers GET, POST, PATCH, DELETE from method names using naming conventions. No manual configuration needed.

Auth Support

Built-in support for JWT, API Key, Basic, and OAuth2 authentication schemes with per-endpoint control.

Live Reload

Swagger UI reads the spec on every request during development. See changes instantly without restarting.

Model Parsing

Automatically parses YAML model files and resolves cross-module dependencies for complete schema generation.

XSS Safe

All user-provided URLs are JSON-encoded before injection into HTML, preventing cross-site scripting attacks.

Compatibility

Serverpod

>=3.4.2

Dart SDK

>=3.5.0

OpenAPI

3.0.0

Swagger UI

5.18.2

Ready to document your API?

Get started in minutes with the full documentation.

Read the Docs