0.0.7 • Published 2 years ago
@itrabbit/payload-swagger-plugin v0.0.7
@itrabbit/payload-swagger-plugin
Payload CMS plugin for generate swagger documentation.
The plugin is under development!
- Collection fields
- text, textarea, email, code, number, date
- radio, select, checkbox
- relationship, upload
- relationship with many
relationTo
- row, collapsible
- richText
- blocks
- point
- group
- array
- json
- tabs
- ui
- Collection timestamp
- CRUD for collections
- CRUD for version collections
- Auth Operations
- login
- logout
- reset password
- forgot password
- verify email
- unlock
- refresh token
- me
- Custom Endpoints (use
collection.endpoints[n].custom.swagger
append path information, usecollection.custom.swagger
for append other info to swagger) - Preferences
- Global
Getting started
- Install the package with
npm i @itrabbit/payload-swagger-plugin
oryarn add @itrabbit/payload-swagger-plugin
. - Add the plugin to your
payload.config.ts
:
import swagger from '@itrabbit/payload-swagger-plugin';
export default buildConfig({
/* ... */
plugins: [
swagger(),
],
});
Open in browser https://localhost:3000/api/swagger
Plugin options
Optionally, you can pass the following options to tweak the behavior of the plugin:
export interface SwaggerPluginOptions {
/**
* Array of collection slugs that the plugin should apply to.
* If empty use all collection
*
* Default: []
*/
collections?: CollectionConfig['slug'][];
/**
* Path for serve documentation
*
* Default: /api/swagger
*/
path?: string;
/**
* Locale for documentation
*
* Default: en
*/
locale?: string;
}