API Plugin
The API plugin enables automatic generation of API documentation from OpenAPI specifications and Kubernetes Custom Resource Definitions (CRDs).Features
- OpenAPI Support - Convert OpenAPI 2.0 (Swagger) and 3.0+ specs to documentation
- CRD Documentation - Generate docs from Kubernetes CRD YAML files
- Automatic Schema Conversion - Converts OpenAPI schemas to JSON Schema
- Runtime Access - Access API specs and CRDs in your components
Configuration
Configure the API plugin in yourdoom.config.ts:
OpenAPI Documentation
Supported Formats
The plugin supports multiple OpenAPI formats:- OpenAPI 3.1.x (native)
- OpenAPI 3.0.x (converted to 3.1)
- Swagger 2.0 (converted to OpenAPI 3.1)
Automatic Conversion
The plugin automatically handles format conversion:packages/doom/src/plugins/api/index.ts:48-62
CRD Documentation
CRD Structure
The plugin expects standard Kubernetes CRD format:TypeScript Types
The plugin provides TypeScript types for CRDs:packages/doom/src/plugins/api/types.ts:11-38
Runtime Access
Access API specs and CRDs in your components:Plugin Options
packages/doom/src/plugins/api/types.ts:3-9
Example Usage
Create an API documentation page:docs/api/my-api.mdx
Best Practices
- Organize by Version - Keep different API versions in separate files
- Use Glob Patterns - Leverage glob patterns to include multiple specs
- External References - Use the
referencesoption for external APIs - Validate Specs - Ensure OpenAPI specs are valid before building
- Document Schemas - Add descriptions to all schema properties