Installation
This guide will walk you through the process of installing and setting up Serverpod Swagger in your Serverpod project.
Prerequisites
Before you begin, make sure you have:
- A Serverpod project set up and running
- Dart SDK 2.17.0 or higher
- Serverpod 1.x.x or higher
Adding the Package Dependency
To add Serverpod Swagger to your project, you need to add it as a dependency in your pubspec.yaml
file.
1dependencies:
2 serverpod: ^1.0.0
3 serverpod_swagger: ^1.0.0
Then run the following command to install the package:
1dart pub get
Project Structure
After installing the package, your project structure should look something like this:
1your_project/
2├── your_project_server/
3│ ├── lib/
4│ │ ├── src/
5│ │ │ ├── endpoints/
6│ │ │ ├── generated/
7│ │ │ └── ...
8│ │ └── server.dart
9│ ├── pubspec.yaml
10│ └── ...
11├── your_project_client/
12└── your_project_flutter/
You'll be primarily working with the server part of your Serverpod project when integrating Swagger.
Verifying Installation
To verify that Serverpod Swagger has been installed correctly, you can import it in your server.dart
file:
1import 'package:serverpod/serverpod.dart';
2import 'package:serverpod_swagger/serverpod_swagger.dart';
If there are no errors when importing the package, it means the installation was successful.
Next Steps
Now that you have installed Serverpod Swagger, you can proceed to:
Tip: If you're upgrading from an older version of Serverpod Swagger, make sure to check thechangelog for any breaking changes.