@itrabbit/payload-swagger-plugin
v0.0.7
Published
Payload CMS plugin for generate swagger documentation
Downloads
158
Readme
@itrabbit/payload-swagger-plugin
Payload CMS plugin for generate swagger documentation.
The plugin is under development!
- [ ] Collection fields
- [x] text, textarea, email, code, number, date
- [x] radio, select, checkbox
- [x] relationship, upload
- [ ] relationship with many
relationTo
- [x] row, collapsible
- [x] richText
- [ ] blocks
- [x] point
- [x] group
- [x] array
- [x] json
- [ ] tabs
- [ ] ui
- [x] Collection timestamp
- [x] CRUD for collections
- [x] CRUD for version collections
- [ ] Auth Operations
- [x] login
- [x] logout
- [ ] reset password
- [ ] forgot password
- [ ] verify email
- [ ] unlock
- [ ] refresh token
- [x] me
- [x] 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;
}