serverpod_openapi 0.0.3 copy "serverpod_openapi: ^0.0.3" to clipboard
serverpod_openapi: ^0.0.3 copied to clipboard

OpenAPI 3.0 specification generator for Serverpod endpoints with Swagger UI integration

example/README.md

Example Usage #

This directory contains an example server.dart file showing how to integrate serverpod_openapi into your Serverpod project.

Complete Example Code #

Here's the complete server.dart file:

// NOTE: This is an example file. Update the imports below to match your Serverpod project structure.
// ignore_for_file: uri_does_not_exist, undefined_function

import 'package:serverpod/serverpod.dart';
import 'package:serverpod_openapi/serverpod_openapi.dart';

void run(List<String> args) async {
  // Initialize Serverpod
  final pod = Serverpod(
    args,
    Protocol(),
    Endpoints(),
  );

  // Add OpenAPI documentation route
  // This will be available at http://localhost:8082/openapi
  pod.webServer.addRoute(
    RouteOpenApi(
      pod,
      title: 'E-Commerce API',
      version: '1.0.0',
      description: 'Complete API for managing products, orders, and customers.',
    ),
    '/openapi',
  );

  // Optional: Add additional routes or middleware here
  // pod.webServer.addRoute(...);

  // Start the server
  await pod.start();
}
1
likes
150
points
107
downloads

Publisher

verified publisherizeesoft.com

Weekly Downloads

OpenAPI 3.0 specification generator for Serverpod endpoints with Swagger UI integration

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

serverpod

More

Packages that depend on serverpod_openapi