serverpod_openapi 0.0.2
serverpod_openapi: ^0.0.2 copied to clipboard
OpenAPI 3.0 specification generator for Serverpod endpoints with Swagger UI integration
Example Usage #
This directory contains an example server.dart file showing how to integrate serverpod_openapi into your Serverpod project.
Setup #
- Copy this
server.dartfile to your Serverpod project'sbindirectory - Update the imports to match your project structure:
- Replace
package:your_server/src/generated/protocol.dartwith your actual protocol import - Replace
package:your_server/src/generated/endpoints.dartwith your actual endpoints import
- Replace
- Add
serverpod_openapito yourpubspec.yaml:dependencies: serverpod_openapi: ^0.0.1 - Run
dart pub get - Start your server and visit
http://localhost:8082/openapito view the API documentation
Customization #
You can customize the OpenAPI documentation by modifying the RouteOpenApi parameters:
pod.webServer.addRoute(
RouteOpenApi(
pod,
title: 'Your API Title',
version: '1.0.0',
description: 'Your API description',
),
'/openapi', // Customize the path if needed
);