Package Exports
- payload-oapi
- payload-oapi/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (payload-oapi) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Payload OpenAPI Plugin
Autogenerate an OpenAPI specification from your Payload CMS instance and use it for documentation or to generate client SDKs.
Roadmap
- Complete description of collection CRUD endpoints
- Complete description of globals CRUD endpoints
- Integrated Swagger UI and Rapidoc
- Custom endpoints
- Authentication endpoints and specification
- Preferences endpoints
Installation
Install the plugin from npm - yarn add payload-oapi
or npm i payload-oapi
.
Setup
To add the OpenAPI specification endpoint to your Payload app, simply import the openapi
plugin and add it to your payload configuration:
import { openapi } from 'payload-oapi'
buildConfig({
plugins: [
openapi({ openapiVersion: '3.0', metadata: { title: 'Dev API', version: '0.0.1' } }),
// ...
],
// ...
})
To add a documentation UI, use the swaggerUI
, rapidoc
or redoc
plugins, respectively:
import { openapi, swaggerUI } from 'payload-oapi'
buildConfig({
plugins: [
openapi(/* ... */),
swaggerUI({/* ... */})
],
// ...
})